[PATCH] D13978: [X86] Support MCU psABI when marking inregs

Michael Kuperstein via cfe-commits cfe-commits at lists.llvm.org
Sun Oct 25 01:00:43 PDT 2015

mkuper added inline comments.

Comment at: lib/CodeGen/TargetInfo.cpp:857
@@ -854,3 +856,3 @@
-      IsSoftFloatABI(SoftFloatABI),
+      IsSoftFloatABI(SoftFloatABI), IsMCUABI(MCUABI),
       DefaultNumRegisterParameters(NumRegisterParameters) {}
rnk wrote:
> Rather than taking this as a parameter, how about initializing IsMCUABI with `getTarget().getTriple().isEnvironmentIAMCU()`? Then you can drop a level of parameters.
Sure, will do.

Comment at: test/CodeGen/x86_32-arguments-iamcu.c:1
@@ +1,2 @@
+// RUN: %clang_cc1 -w -triple i386-pc-elfiamcu -mfloat-abi soft -emit-llvm -o - %s | FileCheck %s
DavidKreitzer wrote:
> Good test!
> I think it would be a good idea to add a varargs function & verify that the args do not get marked inreg.
They do get marked inreg, actually.
The varargs handling for -mregparm - and that means for IAMCU as well - happens on the CG level.

def CC_X86_32_C : CallingConv<[
  // The first 3 integer arguments, if marked 'inreg' and if the call is not
  // a vararg call, are passed in integer registers.
  **CCIfNotVarArg**<CCIfInReg<CCIfType<[i32], CCAssignToReg<[EAX, EDX, ECX]>>>>,


(Yes, this is incredibly ugly. We should probably fix that in a separate patch.)


More information about the cfe-commits mailing list