P5.4 core: drive the whole build from sx default_pipeline (no auto-emit/link)
The compiler's post-IR role shrinks to: codegen -> invoke the build callback. There is NO Zig auto-emit / auto-link anymore; emit + link are sx-called actions. - emit_object() is now an ACTION (verify + emit via a host BuildHooks vtable), returning the object path. New query primitives build_output/build_target/ build_frameworks/build_flags (data reads from the merged BuildConfig). - library/modules/build.sx imports compiler.sx and defines default_pipeline: emit_object -> gather c_object_paths -> link(objs, output, libs, fws, flags, target). The std<->build import cycle is handled by the resolver. - The compiler FORCE-LOWERS default_pipeline (well-known name) and AUTO-INVOKES it post-codegen when no on_build/set_post_link_callback override was registered (driver's final fallback: invokeByName default_pipeline). - Prelude-less programs (e.g. asm tests) don't import build.sx, so the BUILD path auto-imports modules/build.sx (idempotent if already transitive) so default_pipeline is always available. JIT sx run is untouched (emits in-process). - Removed the build cache short-circuits (incompatible with the always-run sx driver; a future cache can live in default_pipeline). Benign 37-.ir churn (build.sx grew); zero behavior changes (verified diff is .ir-only). 705/0 both gates.
This commit is contained in:
@@ -557,6 +557,30 @@ declare void @parse(ptr sret({ { i64, [24 x i8] }, i32 }), ptr, ptr, ptr) #0
|
||||
; Function Attrs: nounwind
|
||||
declare ptr @escape(ptr, ptr) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare void @c_object_paths(ptr sret({ ptr, i64, i64 })) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare void @link_libraries(ptr sret({ ptr, i64, i64 })) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare ptr @emit_object() #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare ptr @build_output() #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare ptr @build_target() #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare void @build_frameworks(ptr sret({ ptr, i64, i64 })) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare void @build_flags(ptr sret({ ptr, i64, i64 })) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare void @link(ptr, ptr, ptr, ptr, ptr, ptr) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare void @BuildOptions.add_link_flag(i64, ptr) #0
|
||||
|
||||
@@ -671,6 +695,9 @@ declare void @set_post_link_callback(i64, ptr) #0
|
||||
; Function Attrs: nounwind
|
||||
declare void @on_build(ptr) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare i1 @default_pipeline(ptr, {}) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare ptr @spaces.44(ptr, i32) #0
|
||||
|
||||
@@ -1092,3 +1119,104 @@ entry:
|
||||
call void @CAllocator.dealloc_bytes(ptr %0, ptr %1, ptr %2)
|
||||
ret void
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind
|
||||
define internal void @List__string.append(ptr %0, ptr %1, { ptr, i64 } %2, { ptr, ptr, ptr } %3) #0 {
|
||||
entry:
|
||||
%alloca = alloca ptr, align 8
|
||||
%allocaN = alloca i64, align 8
|
||||
%allocaN = alloca ptr, align 8
|
||||
store ptr %1, ptr %alloca, align 8
|
||||
%allocaN = alloca { ptr, i64 }, align 8
|
||||
store { ptr, i64 } %2, ptr %allocaN, align 8
|
||||
%allocaN = alloca { ptr, ptr, ptr }, align 8
|
||||
store { ptr, ptr, ptr } %3, ptr %allocaN, align 8
|
||||
%load = load ptr, ptr %alloca, align 8
|
||||
%loadN = load { ptr, i64, i64 }, ptr %load, align 8
|
||||
%sg = extractvalue { ptr, i64, i64 } %loadN, 1
|
||||
%loadN = load ptr, ptr %alloca, align 8
|
||||
%loadN = load { ptr, i64, i64 }, ptr %loadN, align 8
|
||||
%sgN = extractvalue { ptr, i64, i64 } %loadN, 2
|
||||
%icmp = icmp sge i64 %sg, %sgN
|
||||
br i1 %icmp, label %if.then.2, label %if.merge.3
|
||||
|
||||
if.then.2: ; preds = %entry
|
||||
%loadN = load ptr, ptr %alloca, align 8
|
||||
%loadN = load { ptr, i64, i64 }, ptr %loadN, align 8
|
||||
%sgN = extractvalue { ptr, i64, i64 } %loadN, 2
|
||||
%icmpN = icmp eq i64 %sgN, 0
|
||||
br i1 %icmpN, label %if.then.4, label %if.else.5
|
||||
|
||||
if.merge.3: ; preds = %if.merge.8, %entry
|
||||
%loadN = load { ptr, i64 }, ptr %allocaN, align 8
|
||||
%loadN = load ptr, ptr %alloca, align 8
|
||||
%loadN = load { ptr, i64, i64 }, ptr %loadN, align 8
|
||||
%sgN = extractvalue { ptr, i64, i64 } %loadN, 1
|
||||
%loadN = load ptr, ptr %alloca, align 8
|
||||
%loadN = load { ptr, i64, i64 }, ptr %loadN, align 8
|
||||
%sgN = extractvalue { ptr, i64, i64 } %loadN, 0
|
||||
%igp.ptr = getelementptr { ptr, i64 }, ptr %sgN, i64 %sgN
|
||||
store { ptr, i64 } %loadN, ptr %igp.ptr, align 8
|
||||
%loadN = load ptr, ptr %alloca, align 8
|
||||
%gep = getelementptr inbounds nuw { ptr, i64, i64 }, ptr %loadN, i32 0, i32 1
|
||||
%loadN = load i64, ptr %gep, align 8
|
||||
%add = add i64 %loadN, 1
|
||||
store i64 %add, ptr %gep, align 8
|
||||
ret void
|
||||
|
||||
if.then.4: ; preds = %if.then.2
|
||||
br label %if.merge.6
|
||||
|
||||
if.else.5: ; preds = %if.then.2
|
||||
%loadN = load ptr, ptr %alloca, align 8
|
||||
%loadN = load { ptr, i64, i64 }, ptr %loadN, align 8
|
||||
%sgN = extractvalue { ptr, i64, i64 } %loadN, 2
|
||||
%mul = mul i64 %sgN, 2
|
||||
br label %if.merge.6
|
||||
|
||||
if.merge.6: ; preds = %if.else.5, %if.then.4
|
||||
%bp = phi i64 [ 4, %if.then.4 ], [ %mul, %if.else.5 ]
|
||||
store i64 %bp, ptr %allocaN, align 8
|
||||
%loadN = load i64, ptr %allocaN, align 8
|
||||
%mulN = mul i64 %loadN, 16
|
||||
%loadN = load { ptr, ptr, ptr }, ptr %allocaN, align 8
|
||||
%sgN = extractvalue { ptr, ptr, ptr } %loadN, 0
|
||||
%sgN = extractvalue { ptr, ptr, ptr } %loadN, 1
|
||||
%icall = call ptr %sgN(ptr %0, ptr %sgN, i64 %mulN)
|
||||
store ptr %icall, ptr %allocaN, align 8
|
||||
%loadN = load ptr, ptr %alloca, align 8
|
||||
%loadN = load { ptr, i64, i64 }, ptr %loadN, align 8
|
||||
%sgN = extractvalue { ptr, i64, i64 } %loadN, 1
|
||||
%icmpN = icmp sgt i64 %sgN, 0
|
||||
br i1 %icmpN, label %if.then.7, label %if.merge.8
|
||||
|
||||
if.then.7: ; preds = %if.merge.6
|
||||
%loadN = load ptr, ptr %allocaN, align 8
|
||||
%loadN = load ptr, ptr %alloca, align 8
|
||||
%loadN = load { ptr, i64, i64 }, ptr %loadN, align 8
|
||||
%sgN = extractvalue { ptr, i64, i64 } %loadN, 0
|
||||
%loadN = load ptr, ptr %alloca, align 8
|
||||
%loadN = load { ptr, i64, i64 }, ptr %loadN, align 8
|
||||
%sgN = extractvalue { ptr, i64, i64 } %loadN, 1
|
||||
%mulN = mul i64 %sgN, 16
|
||||
%call = call ptr @memcpy(ptr %loadN, ptr %sgN, i64 %mulN)
|
||||
%loadN = load ptr, ptr %alloca, align 8
|
||||
%loadN = load { ptr, i64, i64 }, ptr %loadN, align 8
|
||||
%sgN = extractvalue { ptr, i64, i64 } %loadN, 0
|
||||
%loadN = load { ptr, ptr, ptr }, ptr %allocaN, align 8
|
||||
%sgN = extractvalue { ptr, ptr, ptr } %loadN, 0
|
||||
%sgN = extractvalue { ptr, ptr, ptr } %loadN, 2
|
||||
call void %sgN(ptr %0, ptr %sgN, ptr %sgN)
|
||||
br label %if.merge.8
|
||||
|
||||
if.merge.8: ; preds = %if.then.7, %if.merge.6
|
||||
%loadN = load ptr, ptr %allocaN, align 8
|
||||
%loadN = load ptr, ptr %alloca, align 8
|
||||
%gepN = getelementptr inbounds nuw { ptr, i64, i64 }, ptr %loadN, i32 0, i32 0
|
||||
store ptr %loadN, ptr %gepN, align 8
|
||||
%loadN = load i64, ptr %allocaN, align 8
|
||||
%loadN = load ptr, ptr %alloca, align 8
|
||||
%gepN = getelementptr inbounds nuw { ptr, i64, i64 }, ptr %loadN, i32 0, i32 2
|
||||
store i64 %loadN, ptr %gepN, align 8
|
||||
br label %if.merge.3
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user