diff options
| author | Cliff Click <cliffc@acm.org> | 2025-04-14 10:37:53 -0700 |
|---|---|---|
| committer | Cliff Click <cliffc@acm.org> | 2025-04-14 10:37:53 -0700 |
| commit | e1351e0f4788779e9f37a77f0abb936f2869cbfc (patch) | |
| tree | 201923576d914708b7e5360d76acfc3654ce7767 /chapter21/src/main/java/com | |
| parent | faf6bae55523f12c32b0e21b3c39445459c50f71 (diff) | |
| download | Simple-e1351e0f4788779e9f37a77f0abb936f2869cbfc.tar.gz Simple-e1351e0f4788779e9f37a77f0abb936f2869cbfc.zip | |
NewXXX honors declared CC
Diffstat (limited to 'chapter21/src/main/java/com')
| -rw-r--r-- | chapter21/src/main/java/com/seaofnodes/simple/node/cpus/x86_64_v2/NewX86.java | 17 |
1 files changed, 3 insertions, 14 deletions
diff --git a/chapter21/src/main/java/com/seaofnodes/simple/node/cpus/x86_64_v2/NewX86.java b/chapter21/src/main/java/com/seaofnodes/simple/node/cpus/x86_64_v2/NewX86.java index a87074f4..e751fa23 100644 --- a/chapter21/src/main/java/com/seaofnodes/simple/node/cpus/x86_64_v2/NewX86.java +++ b/chapter21/src/main/java/com/seaofnodes/simple/node/cpus/x86_64_v2/NewX86.java @@ -6,33 +6,22 @@ import com.seaofnodes.simple.node.*; import com.seaofnodes.simple.type.TypeFunPtr; public class NewX86 extends NewNode implements MachNode { - public static final String OS = System.getProperty("os.name"); - public static final RegMask ARG2 = OS.startsWith("Windows") - ? x86_64_v2.callWin64(TypeFunPtr.CALLOC,2) - : x86_64_v2.callSys5 (TypeFunPtr.CALLOC,2); - public static final RegMask ARG3 = OS.startsWith("Windows") - ? x86_64_v2.callWin64(TypeFunPtr.CALLOC,3) - : x86_64_v2.callSys5 (TypeFunPtr.CALLOC,3); - // A pre-zeroed chunk of memory. NewX86( NewNode nnn ) { super(nnn); } @Override public String op() { return "alloc"; } // Size and pointer result in standard calling convention; null for all the // memory aliases edges - @Override public RegMask regmap(int i) { return i==1 ? ARG2 : null; } + @Override public RegMask regmap(int i) { return i==1 ? x86_64_v2.callInMask(TypeFunPtr.CALLOC,2) : null; } @Override public RegMask outregmap(int i) { return i == 1 ? x86_64_v2.RAX_MASK : null; } @Override public RegMask outregmap() { return null; } - @Override public RegMask killmap() { - return OS.startsWith("Windows") - ? x86_64_v2. WIN64_CALLER_SAVE_MASK - : x86_64_v2.SYSTEM5_CALLER_SAVE_MASK; - } + @Override public RegMask killmap() { return x86_64_v2.x86CallerSave(); } @Override public void encoding( Encoding enc ) { enc.external(this,"calloc"); // This has to call the *native* ABI, regardless of how Simple is // being compiled, because it links against the native calloc. // ldi rcx,#1 // number of elements to calloc + RegMask ARG3 = x86_64_v2.callInMask(TypeFunPtr.CALLOC,3); enc.add1(0xB8 + ARG3.firstReg()).add4(1); // E8 cd CALL rel32; enc.add1(0xE8); |
