brandtbucher wrote:

Thanks @efriedma-quic, I missed that the base pointer is `ESI` (not `EBX`) on 
32-bit targets. I forgot about the "nest" parameter (`ECX`), and the GOT 
pointer (`EBX`) too.

How's this for the new parameter list?

```diff
diff --git a/llvm/lib/Target/X86/X86CallingConv.td 
b/llvm/lib/Target/X86/X86CallingConv.td
index 6a8599a6c7c1..32eedcb9ca79 100644
--- a/llvm/lib/Target/X86/X86CallingConv.td
+++ b/llvm/lib/Target/X86/X86CallingConv.td
@@ -1052,8 +1052,12 @@ def CC_X86_64_Preserve_None : CallingConv<[
 ]>;
 
 def CC_X86_32_Preserve_None : CallingConv<[
-  // 32-bit variant of CC_X86_64_Preserve_None, above.
-  CCIfType<[i32], CCAssignToReg<[EDI, ESI, EDX, ECX, EAX]>>,
+  // 32-bit variant of CC_X86_64_Preserve_None, above. Use everything except:
+  //   - EBP        frame pointer
+  //   - ECX        'nest' parameter
+  //   - ESI        base pointer
+  //   - EBX        GOT pointer for PLT calls
+  CCIfType<[i32], CCAssignToReg<[EDI, EDX, EAX]>>,
   CCDelegateTo<CC_X86_32_C>
 ]>;
```



https://github.com/llvm/llvm-project/pull/150106
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to