stage3 ai编写并提供测试用例并重构nob
This commit is contained in:
1 parent
2c531f23de
commit
b4831c8d1c
150 files changed
+15838
-231
No files matched your search
+18
-5
@@ -942,6 +942,12 @@ fn cg_control(cg: *Cgen, ref: usize, n: *IrEntry) {
|
||||
var nargs = cl.params.len;
|
||||
|
||||
if nat_idx >= 0 {
|
||||
var ret_is_sret = ir_is_aggregate(ctx, cl.tid);
|
||||
var sret_off: usize = 0;
|
||||
if ret_is_sret {
|
||||
sret_off = slot_data(&cg.frame, ref);
|
||||
cg_laddr(cg, sret_off);
|
||||
}
|
||||
var i: usize = 0;
|
||||
while i < nargs {
|
||||
var pref = usize_at(&cl.params, i);
|
||||
@@ -951,12 +957,19 @@ fn cg_control(cg: *Cgen, ref: usize, n: *IrEntry) {
|
||||
i = i + 1;
|
||||
}
|
||||
cg_push(cg, .U64, nat_idx as usize);
|
||||
emit(cg, .Ncall, .Void, nargs);
|
||||
var rk = vm_kind_of(ctx, cl.tid);
|
||||
if @enum2int(rk) == @enum2int(VmKind.Void) {
|
||||
emit(cg, .Drop, .Void, 0);
|
||||
var actual = nargs;
|
||||
if ret_is_sret { actual = actual + 1; }
|
||||
emit(cg, .Ncall, .Void, actual);
|
||||
if ret_is_sret {
|
||||
cg_laddr(cg, sret_off);
|
||||
cg_store_slot(cg, ref, .Ptr);
|
||||
} else {
|
||||
cg_store_slot(cg, ref, rk);
|
||||
var rk = vm_kind_of(ctx, cl.tid);
|
||||
if @enum2int(rk) == @enum2int(VmKind.Void) {
|
||||
emit(cg, .Drop, .Void, 0);
|
||||
} else {
|
||||
cg_store_slot(cg, ref, rk);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
/* ABI:实参下方预留 2 个空闲 slot(PAD0/PAD1)。 */
|
||||
|
||||
Reference in new issue
Block a user