diff --git a/lib/Target/TargetCallingConv.td b/lib/Target/TargetCallingConv.td index 3a01ddff2bf..a3b84f4b6f0 100644 --- a/lib/Target/TargetCallingConv.td +++ b/lib/Target/TargetCallingConv.td @@ -32,9 +32,9 @@ class CCIf : CCPredicateAction { string Predicate = predicate; } -/// CCIfStruct - If the current argument is a struct, apply +/// CCIfByVal - If the current argument has ByVal parameter attribute, apply /// Action A. -class CCIfStruct : CCIf<"ArgFlags & ISD::ParamFlags::ByVal", A> { +class CCIfByVal : CCIf<"ArgFlags & ISD::ParamFlags::ByVal", A> { } /// CCIfCC - Match of the current calling convention is 'CC'. @@ -68,11 +68,12 @@ class CCAssignToStack : CCAction { int Align = align; } -/// CCStructAssign - This action always matches: it will use the C ABI and -/// the register availability to decided whether to assign to a set of -/// registers or to a stack slot. -class CCStructAssign regList> : CCAction { - list RegList = regList; +/// CCPassByVal - This action always matches: it assigns the value to a stack +/// slot to implement ByVal aggregate parameter passing. Size and alignment +/// specify the minimum size and alignment for the stack slot. +class CCPassByVal : CCAction { + int Size = size; + int Align = align; } /// CCPromoteToType - If applied, this promotes the specified current value to diff --git a/lib/Target/X86/X86CallingConv.td b/lib/Target/X86/X86CallingConv.td index aaa304e45f1..24a50de829e 100644 --- a/lib/Target/X86/X86CallingConv.td +++ b/lib/Target/X86/X86CallingConv.td @@ -97,7 +97,7 @@ def RetCC_X86 : CallingConv<[ def CC_X86_64_C : CallingConv<[ // Handles byval parameters. - CCIfStruct>, + CCIfByVal>, // Promote i8/i16 arguments to i32. CCIfType<[i8, i16], CCPromoteToType>, @@ -136,7 +136,7 @@ def CC_X86_64_C : CallingConv<[ // namely R9 def CC_X86_64_TailCall : CallingConv<[ // Handles byval parameters. - CCIfStruct>, + CCIfByVal>, // Promote i8/i16 arguments to i32. CCIfType<[i8, i16], CCPromoteToType>, @@ -177,7 +177,7 @@ def CC_X86_64_TailCall : CallingConv<[ /// regs. def CC_X86_32_Common : CallingConv<[ // Handles byval parameters. - CCIfStruct>, + CCIfByVal>, // Integer/Float values get stored in stack slots that are 4 bytes in // size and 4-byte aligned. diff --git a/utils/TableGen/CallingConvEmitter.cpp b/utils/TableGen/CallingConvEmitter.cpp index f7c2eda5e86..0ffbd683d38 100644 --- a/utils/TableGen/CallingConvEmitter.cpp +++ b/utils/TableGen/CallingConvEmitter.cpp @@ -140,9 +140,12 @@ void CallingConvEmitter::EmitAction(Record *Action, << IndentStr << IndentStr << "LocInfo = CCValAssign::ZExt;\n" << IndentStr << "else\n" << IndentStr << IndentStr << "LocInfo = CCValAssign::AExt;\n"; - } else if (Action->isSubClassOf("CCStructAssign")) { - O << IndentStr << - "State.HandleStruct(ValNo, ValVT, LocVT, LocInfo, ArgFlags);\n"; + } else if (Action->isSubClassOf("CCPassByVal")) { + int Size = Action->getValueAsInt("Size"); + int Align = Action->getValueAsInt("Align"); + O << IndentStr + << "State.HandleByVal(ValNo, ValVT, LocVT, LocInfo, " + << Size << ", " << Align << ", ArgFlags);\n"; O << IndentStr << "return false;\n"; } else { Action->dump();