[llvm-commits] CVS: llvm/lib/Target/X86/X86CallingConv.td X86ISelLowering.cpp
Changes in directory llvm/lib/Target/X86: X86CallingConv.td updated: 1.13 - 1.14 X86ISelLowering.cpp updated: 1.412 - 1.413 --- Log message: If a function is vararg, never pass inreg arguments in registers. Thanks to Anton for half of this patch. --- Diffs of the changes: (+18 -14) X86CallingConv.td |6 +++--- X86ISelLowering.cpp | 26 +++--- 2 files changed, 18 insertions(+), 14 deletions(-) Index: llvm/lib/Target/X86/X86CallingConv.td diff -u llvm/lib/Target/X86/X86CallingConv.td:1.13 llvm/lib/Target/X86/X86CallingConv.td:1.14 --- llvm/lib/Target/X86/X86CallingConv.td:1.13 Sat Mar 31 04:36:12 2007 +++ llvm/lib/Target/X86/X86CallingConv.td Mon Jun 18 19:13:10 2007 @@ -148,9 +148,9 @@ // Promote i8/i16 arguments to i32. CCIfType[i8, i16], CCPromoteToTypei32, - // The first 3 integer arguments, if marked 'inreg', are passed in integer - // registers. - CCIfInRegCCIfType[i32], CCAssignToReg[EAX, EDX, ECX], + // The first 3 integer arguments, if marked 'inreg' and if the call is not + // a vararg call, are passed in integer registers. + CCIfNotVarArgCCIfInRegCCIfType[i32], CCAssignToReg[EAX, EDX, ECX], // Otherwise, same as everything else. CCDelegateToCC_X86_32_Common Index: llvm/lib/Target/X86/X86ISelLowering.cpp diff -u llvm/lib/Target/X86/X86ISelLowering.cpp:1.412 llvm/lib/Target/X86/X86ISelLowering.cpp:1.413 --- llvm/lib/Target/X86/X86ISelLowering.cpp:1.412 Mon Jun 18 19:02:56 2007 +++ llvm/lib/Target/X86/X86ISelLowering.cpp Mon Jun 18 19:13:10 2007 @@ -502,7 +502,8 @@ SmallVectorCCValAssign, 16 RVLocs; unsigned CC = DAG.getMachineFunction().getFunction()-getCallingConv(); - CCState CCInfo(CC, getTargetMachine(), RVLocs); + bool isVarArg = DAG.getMachineFunction().getFunction()-isVarArg(); + CCState CCInfo(CC, isVarArg, getTargetMachine(), RVLocs); CCInfo.AnalyzeReturn(Op.Val, RetCC_X86); @@ -582,7 +583,8 @@ // Assign locations to each value returned by this call. SmallVectorCCValAssign, 16 RVLocs; - CCState CCInfo(CallingConv, getTargetMachine(), RVLocs); + bool isVarArg = castConstantSDNode(TheCall-getOperand(2))-getValue() != 0; + CCState CCInfo(CallingConv, isVarArg, getTargetMachine(), RVLocs); CCInfo.AnalyzeCallResult(TheCall, RetCC_X86); @@ -667,8 +669,8 @@ // Assign locations to all of the incoming arguments. SmallVectorCCValAssign, 16 ArgLocs; - CCState CCInfo(MF.getFunction()-getCallingConv(), getTargetMachine(), - ArgLocs); + CCState CCInfo(MF.getFunction()-getCallingConv(), isVarArg, + getTargetMachine(), ArgLocs); CCInfo.AnalyzeFormalArguments(Op.Val, CC_X86_32_C); SmallVectorSDOperand, 8 ArgValues; @@ -764,7 +766,7 @@ // Analyze operands of the call, assigning locations to each operand. SmallVectorCCValAssign, 16 ArgLocs; - CCState CCInfo(CC, getTargetMachine(), ArgLocs); + CCState CCInfo(CC, isVarArg, getTargetMachine(), ArgLocs); CCInfo.AnalyzeCallOperands(Op.Val, CC_X86_32_C); // Get a count of how many bytes are to be pushed on the stack. @@ -919,11 +921,12 @@ MachineFunction MF = DAG.getMachineFunction(); MachineFrameInfo *MFI = MF.getFrameInfo(); SDOperand Root = Op.getOperand(0); + bool isVarArg = castConstantSDNode(Op.getOperand(2))-getValue() != 0; // Assign locations to all of the incoming arguments. SmallVectorCCValAssign, 16 ArgLocs; - CCState CCInfo(MF.getFunction()-getCallingConv(), getTargetMachine(), - ArgLocs); + CCState CCInfo(MF.getFunction()-getCallingConv(), isVarArg, + getTargetMachine(), ArgLocs); CCInfo.AnalyzeFormalArguments(Op.Val, CC_X86_32_FastCall); SmallVectorSDOperand, 8 ArgValues; @@ -1003,11 +1006,12 @@ unsigned CC) { SDOperand Chain = Op.getOperand(0); bool isTailCall = castConstantSDNode(Op.getOperand(3))-getValue() != 0; + bool isVarArg = castConstantSDNode(Op.getOperand(2))-getValue() != 0; SDOperand Callee= Op.getOperand(4); // Analyze operands of the call, assigning locations to each operand. SmallVectorCCValAssign, 16 ArgLocs; - CCState CCInfo(CC, getTargetMachine(), ArgLocs); + CCState CCInfo(CC, isVarArg, getTargetMachine(), ArgLocs); CCInfo.AnalyzeCallOperands(Op.Val, CC_X86_32_FastCall); // Get a count of how many bytes are to be pushed on the stack. @@ -1156,8 +1160,8 @@ // Assign locations to all of the incoming arguments. SmallVectorCCValAssign, 16 ArgLocs; - CCState CCInfo(MF.getFunction()-getCallingConv(), getTargetMachine(), - ArgLocs); + CCState CCInfo(MF.getFunction()-getCallingConv(), isVarArg, + getTargetMachine(), ArgLocs); CCInfo.AnalyzeFormalArguments(Op.Val, CC_X86_64_C); SmallVectorSDOperand, 8 ArgValues; @@ -1292,7 +1296,7 @@ // Analyze operands of the call, assigning locations to each operand.
[llvm-commits] CVS: llvm/lib/Target/X86/X86CallingConv.td
Changes in directory llvm/lib/Target/X86: X86CallingConv.td updated: 1.12 - 1.13 --- Log message: Fix comment. --- Diffs of the changes: (+1 -1) X86CallingConv.td |2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/Target/X86/X86CallingConv.td diff -u llvm/lib/Target/X86/X86CallingConv.td:1.12 llvm/lib/Target/X86/X86CallingConv.td:1.13 --- llvm/lib/Target/X86/X86CallingConv.td:1.12 Fri Mar 30 20:03:53 2007 +++ llvm/lib/Target/X86/X86CallingConv.td Sat Mar 31 04:36:12 2007 @@ -101,7 +101,7 @@ CCIfType[f32, f64, v16i8, v8i16, v4i32, v2i64, v4f32, v2f64], CCAssignToReg[XMM0, XMM1, XMM2, XMM3, XMM4, XMM5, XMM6, XMM7], - // The first 8 MMX vector arguments are passed in MMX registers. + // The first 8 MMX vector arguments are passed in GPRs. CCIfType[v8i8, v4i16, v2i32, v1i64], CCAssignToReg[RDI, RSI, RDX, RCX, R8 , R9 ], ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Target/X86/X86CallingConv.td
Changes in directory llvm/lib/Target/X86: X86CallingConv.td updated: 1.11 - 1.12 --- Log message: Match GCC's MMX calling convention. --- Diffs of the changes: (+4 -0) X86CallingConv.td |4 1 files changed, 4 insertions(+) Index: llvm/lib/Target/X86/X86CallingConv.td diff -u llvm/lib/Target/X86/X86CallingConv.td:1.11 llvm/lib/Target/X86/X86CallingConv.td:1.12 --- llvm/lib/Target/X86/X86CallingConv.td:1.11 Thu Mar 29 19:35:22 2007 +++ llvm/lib/Target/X86/X86CallingConv.td Fri Mar 30 20:03:53 2007 @@ -101,6 +101,10 @@ CCIfType[f32, f64, v16i8, v8i16, v4i32, v2i64, v4f32, v2f64], CCAssignToReg[XMM0, XMM1, XMM2, XMM3, XMM4, XMM5, XMM6, XMM7], + // The first 8 MMX vector arguments are passed in MMX registers. + CCIfType[v8i8, v4i16, v2i32, v1i64], + CCAssignToReg[RDI, RSI, RDX, RCX, R8 , R9 ], + // Integer/FP values get stored in stack slots that are 8 bytes in size and // 8-byte aligned if there are no more registers to hold them. CCIfType[i32, i64, f32, f64], CCAssignToStack8, 8, ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Target/X86/X86CallingConv.td
Changes in directory llvm/lib/Target/X86: X86CallingConv.td updated: 1.10 - 1.11 --- Log message: Add MMX calling conventions. --- Diffs of the changes: (+14 -4) X86CallingConv.td | 18 ++ 1 files changed, 14 insertions(+), 4 deletions(-) Index: llvm/lib/Target/X86/X86CallingConv.td diff -u llvm/lib/Target/X86/X86CallingConv.td:1.10 llvm/lib/Target/X86/X86CallingConv.td:1.11 --- llvm/lib/Target/X86/X86CallingConv.td:1.10 Wed Feb 28 12:35:11 2007 +++ llvm/lib/Target/X86/X86CallingConv.td Thu Mar 29 19:35:22 2007 @@ -30,7 +30,11 @@ // Vector types are always returned in XMM0. If the target doesn't have XMM0, // it won't have vector types. - CCIfType[v16i8, v8i16, v4i32, v2i64, v4f32, v2f64], CCAssignToReg[XMM0] + CCIfType[v16i8, v8i16, v4i32, v2i64, v4f32, v2f64], CCAssignToReg[XMM0], + + // MMX vector types are always returned in MM0. If the target doesn't have + // MM0, it doesn't support these vector types. + CCIfType[v8i8, v4i16, v2i32, v1i64], CCAssignToReg[MM0] ]; // X86-32 C return-value convention. @@ -102,8 +106,10 @@ CCIfType[i32, i64, f32, f64], CCAssignToStack8, 8, // Vectors get 16-byte stack slots that are 16-byte aligned. - CCIfType[v16i8, v8i16, v4i32, v2i64, v4f32, v2f64], - CCAssignToStack16, 16 + CCIfType[v16i8, v8i16, v4i32, v2i64, v4f32, v2f64], CCAssignToStack16, 16, + + // __m64 vectors get 8-byte stack slots that are 8-byte aligned. + CCIfType[v8i8, v4i16, v2i32, v1i64], CCAssignToStack8, 8 ]; @@ -127,7 +133,11 @@ CCAssignToReg[XMM0, XMM1, XMM2, XMM3], // Other vectors get 16-byte stack slots that are 16-byte aligned. - CCIfType[v16i8, v8i16, v4i32, v2i64, v4f32, v2f64], CCAssignToStack16, 16 + CCIfType[v16i8, v8i16, v4i32, v2i64, v4f32, v2f64], CCAssignToStack16, 16, + + // __m64 vectors get 8-byte stack slots that are 8-byte aligned. They are + // passed in the parameter area. + CCIfType[v8i8, v4i16, v2i32, v1i64], CCAssignToStack8, 8 ]; def CC_X86_32_C : CallingConv[ ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Target/X86/X86CallingConv.td
Changes in directory llvm/lib/Target/X86: X86CallingConv.td updated: 1.9 - 1.10 --- Log message: bugfix: fastcall does not require the first two params to be marked 'inreg', they always get registers. --- Diffs of the changes: (+1 -1) X86CallingConv.td |2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/Target/X86/X86CallingConv.td diff -u llvm/lib/Target/X86/X86CallingConv.td:1.9 llvm/lib/Target/X86/X86CallingConv.td:1.10 --- llvm/lib/Target/X86/X86CallingConv.td:1.9 Wed Feb 28 00:20:01 2007 +++ llvm/lib/Target/X86/X86CallingConv.td Wed Feb 28 12:35:11 2007 @@ -148,7 +148,7 @@ CCIfType[i8, i16], CCPromoteToTypei32, // The first 2 integer arguments are passed in ECX/EDX - CCIfInRegCCIfType[i32], CCAssignToReg[ECX, EDX], + CCIfType[i32], CCAssignToReg[ECX, EDX], // Otherwise, same as everything else. CCDelegateToCC_X86_32_Common ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Target/X86/X86CallingConv.td
Changes in directory llvm/lib/Target/X86: X86CallingConv.td updated: 1.5 - 1.6 --- Log message: make subtarget references work. --- Diffs of the changes: (+7 -3) X86CallingConv.td | 10 +++--- 1 files changed, 7 insertions(+), 3 deletions(-) Index: llvm/lib/Target/X86/X86CallingConv.td diff -u llvm/lib/Target/X86/X86CallingConv.td:1.5 llvm/lib/Target/X86/X86CallingConv.td:1.6 --- llvm/lib/Target/X86/X86CallingConv.td:1.5 Tue Feb 27 00:59:52 2007 +++ llvm/lib/Target/X86/X86CallingConv.td Tue Feb 27 22:51:41 2007 @@ -12,6 +12,10 @@ // //===--===// +/// CCMatchIfSubtarget - Match if the current subtarget has a feature F. +class CCMatchIfSubtargetstring F, CCAction A + : CCMatchIf!strconcat(State.getTarget().getSubtargetX86Subtarget().,F),A; + //===--===// // Return Value Calling Conventions //===--===// @@ -42,8 +46,8 @@ def RetCC_X86_32_Fast : CallingConv[ // The X86-32 fastcc returns FP values in XMM0 if the target has SSE2, // otherwise it is the the C calling conventions. - CCMatchType[f32], CCMatchIfSubtarget-hasSSE2(), CCAssignToReg[XMM0], - CCMatchType[f64], CCMatchIfSubtarget-hasSSE2(), CCAssignToReg[XMM0], + CCMatchType[f32], CCMatchIfSubtargethasSSE2(), CCAssignToReg[XMM0], + CCMatchType[f64], CCMatchIfSubtargethasSSE2(), CCAssignToReg[XMM0], CCDelegateToRetCC_X86Common ]; @@ -73,7 +77,7 @@ // This is the return-value convention used for the entire X86 backend. def RetCC_X86 : CallingConv[ - CCMatchIfSubtarget-is64Bit(), CCDelegateToRetCC_X86_64, + CCMatchIfSubtargetis64Bit(), CCDelegateToRetCC_X86_64, CCDelegateToRetCC_X86_32 ]; ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Target/X86/X86CallingConv.td
Changes in directory llvm/lib/Target/X86: X86CallingConv.td updated: 1.6 - 1.7 --- Log message: rename stuff --- Diffs of the changes: (+24 -24) X86CallingConv.td | 48 1 files changed, 24 insertions(+), 24 deletions(-) Index: llvm/lib/Target/X86/X86CallingConv.td diff -u llvm/lib/Target/X86/X86CallingConv.td:1.6 llvm/lib/Target/X86/X86CallingConv.td:1.7 --- llvm/lib/Target/X86/X86CallingConv.td:1.6 Tue Feb 27 22:51:41 2007 +++ llvm/lib/Target/X86/X86CallingConv.td Tue Feb 27 23:30:29 2007 @@ -12,9 +12,9 @@ // //===--===// -/// CCMatchIfSubtarget - Match if the current subtarget has a feature F. -class CCMatchIfSubtargetstring F, CCAction A - : CCMatchIf!strconcat(State.getTarget().getSubtargetX86Subtarget().,F),A; +/// CCIfSubtarget - Match if the current subtarget has a feature F. +class CCIfSubtargetstring F, CCAction A + : CCIf!strconcat(State.getTarget().getSubtargetX86Subtarget()., F), A; //===--===// // Return Value Calling Conventions @@ -23,22 +23,22 @@ // Return-value conventions common to all X86 CC's. def RetCC_X86Common : CallingConv[ // Scalar values are returned in AX first, then DX. - CCMatchType[i8] , CCAssignToReg[AL], - CCMatchType[i16], CCAssignToReg[AX], - CCMatchType[i32], CCAssignToReg[EAX, EDX], - CCMatchType[i64], CCAssignToReg[RAX, RDX], + CCIfType[i8] , CCAssignToReg[AL], + CCIfType[i16], CCAssignToReg[AX], + CCIfType[i32], CCAssignToReg[EAX, EDX], + CCIfType[i64], CCAssignToReg[RAX, RDX], // Vector types are always returned in XMM0. If the target doesn't have XMM0, // it won't have vector types. - CCMatchType[v16i8, v8i16, v4i32, v2i64, v4f32, v2f64], CCAssignToReg[XMM0] + CCIfType[v16i8, v8i16, v4i32, v2i64, v4f32, v2f64], CCAssignToReg[XMM0] ]; // X86-32 C return-value convention. def RetCC_X86_32_C : CallingConv[ // The X86-32 calling convention returns FP values in ST0, otherwise it is the // same as the common X86 calling conv. - CCMatchType[f32], CCAssignToReg[ST0], - CCMatchType[f64], CCAssignToReg[ST0], + CCIfType[f32], CCAssignToReg[ST0], + CCIfType[f64], CCAssignToReg[ST0], CCDelegateToRetCC_X86Common ]; @@ -46,16 +46,16 @@ def RetCC_X86_32_Fast : CallingConv[ // The X86-32 fastcc returns FP values in XMM0 if the target has SSE2, // otherwise it is the the C calling conventions. - CCMatchType[f32], CCMatchIfSubtargethasSSE2(), CCAssignToReg[XMM0], - CCMatchType[f64], CCMatchIfSubtargethasSSE2(), CCAssignToReg[XMM0], + CCIfType[f32], CCIfSubtargethasSSE2(), CCAssignToReg[XMM0], + CCIfType[f64], CCIfSubtargethasSSE2(), CCAssignToReg[XMM0], CCDelegateToRetCC_X86Common ]; // X86-64 C return-value convention. def RetCC_X86_64_C : CallingConv[ // The X86-64 calling convention always returns FP values in XMM0. - CCMatchType[f32], CCAssignToReg[XMM0], - CCMatchType[f64], CCAssignToReg[XMM0], + CCIfType[f32], CCAssignToReg[XMM0], + CCIfType[f64], CCAssignToReg[XMM0], CCDelegateToRetCC_X86Common ]; @@ -64,7 +64,7 @@ // This is the root return-value convention for the X86-32 backend. def RetCC_X86_32 : CallingConv[ // If FastCC, use RetCC_X86_32_Fast. - CCMatchIfCCCallingConv::Fast, CCDelegateToRetCC_X86_32_Fast, + CCIfCCCallingConv::Fast, CCDelegateToRetCC_X86_32_Fast, // Otherwise, use RetCC_X86_32_C. CCDelegateToRetCC_X86_32_C ]; @@ -77,34 +77,34 @@ // This is the return-value convention used for the entire X86 backend. def RetCC_X86 : CallingConv[ - CCMatchIfSubtargetis64Bit(), CCDelegateToRetCC_X86_64, + CCIfSubtargetis64Bit(), CCDelegateToRetCC_X86_64, CCDelegateToRetCC_X86_32 ]; //===--===// -// Argument Calling Conventions +// X86-64 Argument Calling Conventions //===--===// - def CC_X86_64_C : CallingConv[ // Promote i8/i16 arguments to i32. - CCMatchType[i8, i16], CCPromoteToTypei32, + CCIfType[i8, i16], CCPromoteToTypei32, // The first 6 integer arguments are passed in integer registers. - CCMatchType[i32], CCAssignToReg[EDI, ESI, EDX, ECX, R8D, R9D], - CCMatchType[i64], CCAssignToReg[RDI, RSI, RDX, RCX, R8 , R9 ], + CCIfType[i32], CCAssignToReg[EDI, ESI, EDX, ECX, R8D, R9D], + CCIfType[i64], CCAssignToReg[RDI, RSI, RDX, RCX, R8 , R9 ], // The first 8 FP/Vector arguments are passed in XMM registers. - CCMatchType[f32, f64, v16i8, v8i16, v4i32, v2i64, v4f32, v2f64], + CCIfType[f32, f64, v16i8, v8i16, v4i32, v2i64, v4f32, v2f64], CCAssignToReg[XMM0, XMM1, XMM2, XMM3, XMM4, XMM5, XMM6, XMM7], // Integer/FP values get stored in stack slots that are 8 bytes in size and // 8-byte aligned if there are no more registers to hold them. - CCMatchType[i32, i64, f32, f64],
[llvm-commits] CVS: llvm/lib/Target/X86/X86CallingConv.td X86ISelLowering.cpp
Changes in directory llvm/lib/Target/X86: X86CallingConv.td updated: 1.7 - 1.8 X86ISelLowering.cpp updated: 1.346 - 1.347 --- Log message: switch LowerallTo over to using an autogenerated callingconv --- Diffs of the changes: (+71 -110) X86CallingConv.td | 28 + X86ISelLowering.cpp | 153 ++-- 2 files changed, 71 insertions(+), 110 deletions(-) Index: llvm/lib/Target/X86/X86CallingConv.td diff -u llvm/lib/Target/X86/X86CallingConv.td:1.7 llvm/lib/Target/X86/X86CallingConv.td:1.8 --- llvm/lib/Target/X86/X86CallingConv.td:1.7 Tue Feb 27 23:30:29 2007 +++ llvm/lib/Target/X86/X86CallingConv.td Tue Feb 27 23:31:48 2007 @@ -107,4 +107,32 @@ ]; +//===--===// +// X86 C Calling Convention +//===--===// + +def CC_X86_32_C : CallingConv[ + // Promote i8/i16 arguments to i32. + CCIfType[i8, i16], CCPromoteToTypei32, + + // The first 3 integer arguments, if marked 'inreg', are passed in integer + // registers. + CCIfInRegCCIfType[i32], CCAssignToReg[EAX, EDX, ECX], + + // Other Integer/Float values get stored in stack slots that are 4 bytes in + // size and 4-byte aligned. + CCIfType[i32, f32], CCAssignToStack4, 4, + + // Doubles get 8-byte slots that are 4-byte aligned. + CCIfType[f64], CCAssignToStack8, 4, + + // The first 4 Vector arguments are passed in XMM registers. + CCIfType[v16i8, v8i16, v4i32, v2i64, v4f32, v2f64], + CCAssignToReg[XMM0, XMM1, XMM2, XMM3], + + // Other vectors get 16-byte stack slots that are 16-byte aligned. + CCIfType[v16i8, v8i16, v4i32, v2i64, v4f32, v2f64], CCAssignToStack16, 16 +]; + + Index: llvm/lib/Target/X86/X86ISelLowering.cpp diff -u llvm/lib/Target/X86/X86ISelLowering.cpp:1.346 llvm/lib/Target/X86/X86ISelLowering.cpp:1.347 --- llvm/lib/Target/X86/X86ISelLowering.cpp:1.346 Tue Feb 27 22:55:35 2007 +++ llvm/lib/Target/X86/X86ISelLowering.cpp Tue Feb 27 23:31:48 2007 @@ -641,14 +641,6 @@ else ObjSize = 4; break; - case MVT::i64: - if (ArgInReg (NumIntRegs+2 = MaxNumIntRegs)) { - ObjIntRegs = 2; - } else if (ArgInReg (NumIntRegs+1 = MaxNumIntRegs)) { - ObjIntRegs = 1; - ObjSize = 4; - } else - ObjSize = 8; case MVT::f32: ObjSize = 4; break; @@ -808,121 +800,62 @@ SDOperand Callee= Op.getOperand(4); unsigned NumOps = (Op.getNumOperands() - 5) / 2; - static const unsigned XMMArgRegs[] = { -X86::XMM0, X86::XMM1, X86::XMM2, X86::XMM3 - }; - static const unsigned GPR32ArgRegs[] = { -X86::EAX, X86::EDX, X86::ECX - }; - - // Count how many bytes are to be pushed on the stack. - unsigned NumBytes = 0; - // Keep track of the number of integer regs passed so far. - unsigned NumIntRegs = 0; - // Keep track of the number of XMM regs passed so far. - unsigned NumXMMRegs = 0; - // How much bytes on stack used for struct return - unsigned NumSRetBytes= 0; - - // Handle regparm attribute - SmallVectorbool, 8 ArgInRegs(NumOps, false); - SmallVectorbool, 8 SRetArgs(NumOps, false); - for (unsigned i = 0; iNumOps; ++i) { -unsigned Flags = - dyn_castConstantSDNode(Op.getOperand(5+2*i+1))-getValue(); -ArgInRegs[i] = (Flags 1) 1; -SRetArgs[i] = (Flags 2) 1; - } + SmallVectorCCValAssign, 16 ArgLocs; + CCState CCInfo(CC, getTargetMachine(), ArgLocs); - // Calculate stack frame size for (unsigned i = 0; i != NumOps; ++i) { -SDOperand Arg = Op.getOperand(5+2*i); -unsigned ArgIncrement = 4; -unsigned ObjSize = 0; -unsigned ObjIntRegs = 0; -unsigned ObjXMMRegs = 0; - -HowToPassCallArgument(Arg.getValueType(), - ArgInRegs[i], - NumIntRegs, NumXMMRegs, 3, - ObjSize, ObjIntRegs, ObjXMMRegs); -if (ObjSize 4) - ArgIncrement = ObjSize; - -NumIntRegs += ObjIntRegs; -NumXMMRegs += ObjXMMRegs; -if (ObjSize) { - // XMM arguments have to be aligned on 16-byte boundary. - if (ObjSize == 16) -NumBytes = ((NumBytes + 15) / 16) * 16; - NumBytes += ArgIncrement; -} +MVT::ValueType ArgVT = Op.getOperand(5+2*i).getValueType(); +unsigned ArgFlags =castConstantSDNode(Op.getOperand(5+2*i+1))-getValue(); +if (CC_X86_32_C(i, ArgVT, ArgVT, CCValAssign::Full, ArgFlags, CCInfo)) + assert(0 Unhandled argument type!); } + + // Get a count of how many bytes are to be pushed on the stack. + unsigned NumBytes = CCInfo.getNextStackOffset(); Chain = DAG.getCALLSEQ_START(Chain,DAG.getConstant(NumBytes, getPointerTy())); - // Arguments go on the stack in reverse order, as specified by the ABI. - unsigned ArgOffset = 0; - NumXMMRegs = 0; - NumIntRegs = 0; SmallVectorstd::pairunsigned, SDOperand, 8 RegsToPass; SmallVectorSDOperand, 8 MemOpChains; - SDOperand
[llvm-commits] CVS: llvm/lib/Target/X86/X86CallingConv.td
Changes in directory llvm/lib/Target/X86: X86CallingConv.td updated: 1.8 - 1.9 --- Log message: add new CC_X86_32_FastCall calling conv, which describes fastcall on win32. Factor out a CC_X86_32_Common convention, which is the part shared between ccc, stdcall and fastcall --- Diffs of the changes: (+29 -10) X86CallingConv.td | 39 +-- 1 files changed, 29 insertions(+), 10 deletions(-) Index: llvm/lib/Target/X86/X86CallingConv.td diff -u llvm/lib/Target/X86/X86CallingConv.td:1.8 llvm/lib/Target/X86/X86CallingConv.td:1.9 --- llvm/lib/Target/X86/X86CallingConv.td:1.8 Tue Feb 27 23:31:48 2007 +++ llvm/lib/Target/X86/X86CallingConv.td Wed Feb 28 00:20:01 2007 @@ -111,22 +111,18 @@ // X86 C Calling Convention //===--===// -def CC_X86_32_C : CallingConv[ - // Promote i8/i16 arguments to i32. - CCIfType[i8, i16], CCPromoteToTypei32, - - // The first 3 integer arguments, if marked 'inreg', are passed in integer - // registers. - CCIfInRegCCIfType[i32], CCAssignToReg[EAX, EDX, ECX], - - // Other Integer/Float values get stored in stack slots that are 4 bytes in +/// CC_X86_32_Common - In all X86-32 calling conventions, extra integers and FP +/// values are spilled on the stack, and the first 4 vector values go in XMM +/// regs. +def CC_X86_32_Common : CallingConv[ + // Integer/Float values get stored in stack slots that are 4 bytes in // size and 4-byte aligned. CCIfType[i32, f32], CCAssignToStack4, 4, // Doubles get 8-byte slots that are 4-byte aligned. CCIfType[f64], CCAssignToStack8, 4, - // The first 4 Vector arguments are passed in XMM registers. + // The first 4 vector arguments are passed in XMM registers. CCIfType[v16i8, v8i16, v4i32, v2i64, v4f32, v2f64], CCAssignToReg[XMM0, XMM1, XMM2, XMM3], @@ -134,5 +130,28 @@ CCIfType[v16i8, v8i16, v4i32, v2i64, v4f32, v2f64], CCAssignToStack16, 16 ]; +def CC_X86_32_C : CallingConv[ + // Promote i8/i16 arguments to i32. + CCIfType[i8, i16], CCPromoteToTypei32, + + // The first 3 integer arguments, if marked 'inreg', are passed in integer + // registers. + CCIfInRegCCIfType[i32], CCAssignToReg[EAX, EDX, ECX], + + // Otherwise, same as everything else. + CCDelegateToCC_X86_32_Common +]; + + +def CC_X86_32_FastCall : CallingConv[ + // Promote i8/i16 arguments to i32. + CCIfType[i8, i16], CCPromoteToTypei32, + + // The first 2 integer arguments are passed in ECX/EDX + CCIfInRegCCIfType[i32], CCAssignToReg[ECX, EDX], + + // Otherwise, same as everything else. + CCDelegateToCC_X86_32_Common +]; ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Target/X86/X86CallingConv.td X86.td
Changes in directory llvm/lib/Target/X86: X86CallingConv.td added (r1.1) X86.td updated: 1.28 - 1.29 --- Log message: Add a description of the X86-64 calling convention and the return conventions. This doesn't do anything yet, but may in the future. --- Diffs of the changes: (+143 -0) X86.td| 11 X86CallingConv.td | 132 ++ 2 files changed, 143 insertions(+) Index: llvm/lib/Target/X86/X86CallingConv.td diff -c /dev/null llvm/lib/Target/X86/X86CallingConv.td:1.1 *** /dev/null Mon Feb 26 12:17:24 2007 --- llvm/lib/Target/X86/X86CallingConv.td Mon Feb 26 12:17:14 2007 *** *** 0 --- 1,132 + //===- X86CallingConv.td - Calling Conventions for X86 32/64 *- C++ -*-===// + // + // The LLVM Compiler Infrastructure + // + // This file was developed by the LLVM research group and is distributed under + // the University of Illinois Open Source License. See LICENSE.TXT for details. + // + //===--===// + // + // This describes the calling conventions for the X86-32 and X86-64 + // architectures. + // + //===--===// + + + class CCAction; + class CallingConv; + + + /// CCMatchType - If the current argument is one of the specified types, apply + /// Action A. + class CCMatchTypelistValueType VTs, CCAction A : CCAction { + } + + /// CCMatchIf - If the predicate matches, apply A. + class CCMatchIfstring predicate, CCAction A : CCAction { + string Predicate = predicate; + } + + /// CCAssignToReg - This action matches if there is a register in the specified + /// list that is still available. If so, it assigns the value to the first + /// available register and succeeds. + class CCAssignToReglistRegister regList : CCAction { + listRegister RegList = regList; + } + + /// CCAssignToStack - This action always matches: it assigns the value to a + /// stack slot of the specified size and alignment on the stack. + class CCAssignToStackint size, int align : CCAction { + int Size = size; + int Align = align; + } + + + + /// CCPromoteToType - If applied, this promotes the specified current value to + /// the specified type. + class CCPromoteToTypeValueType destTy : CCAction { + ValueType DestTy = destTy; + } + + /// CCDelegateTo - This action invokes the specified sub-calling-convention. It + /// is successful if the specified CC matches. + class CCDelegateToCallingConv cc : CCAction { + CallingConv CC = cc; + } + + + class CallingConvlistCCAction actions { + listCCAction Actions = actions; + } + + //===--===// + // Return Value Calling Conventions + //===--===// + + def RetCC_X86Common : CallingConv[ + // Scalar values are returned in AX first, then DX. + CCMatchType[i8] , CCAssignToReg[AL], + CCMatchType[i16], CCAssignToReg[AX], + CCMatchType[i32], CCAssignToReg[EAX, EDX], + CCMatchType[i64], CCAssignToReg[RAX, RDX], + + // Vector types are always returned in XMM0. If the target doesn't have XMM0, + // it won't have vector types. + CCMatchType[v16i8, v8i16, v4i32, v2i64, v4f32, v2f64], CCAssignToReg[XMM0] + ]; + + // Return conventions for the X86-32 C calling convention. + def RetCC_X86_32_C : CallingConv[ + // The X86-32 calling convention returns FP values in ST0, otherwise it is the + // same as the common X86 calling conv. + CCMatchType[f32], CCAssignToReg[ST0], + CCMatchType[f64], CCAssignToReg[ST0], + CCDelegateToRetCC_X86Common + ]; + + // Return conventions for the X86-32 Fast calling convention. + def RetCC_X86_32_Fast : CallingConv[ + // The X86-32 fastcc returns FP values in XMM0 if the target has SSE2, + // otherwise it is the the C calling conventions. + CCMatchType[f32], CCMatchIfSubtarget-hasSSE2(), CCAssignToReg[XMM0], + CCMatchType[f64], CCMatchIfSubtarget-hasSSE2(), CCAssignToReg[XMM0], + CCDelegateToRetCC_X86Common + ]; + + // Return conventions for the X86-64 C calling convention. + def RetCC_X86_64_C : CallingConv[ + // The X86-64 calling convention always returns FP values in XMM0. + CCMatchType[f32], CCAssignToReg[XMM0], + CCMatchType[f64], CCAssignToReg[XMM0], + CCDelegateToRetCC_X86Common + ]; + + + //===--===// + // Argument Calling Conventions + //===--===// + + + def CC_X86_64_C : CallingConv[ + // Promote i8/i16 arguments to i32. + CCMatchType[i8, i16], CCPromoteToTypei32, + + // The first 6 integer arguments are passed in integer registers. + CCMatchType[i32], CCAssignToReg[EDI, ESI, EDX, ECX, R8D, R9D], + CCMatchType[i64], CCAssignToReg[RDI, RSI, RDX,
[llvm-commits] CVS: llvm/lib/Target/X86/X86CallingConv.td
Changes in directory llvm/lib/Target/X86: X86CallingConv.td updated: 1.1 - 1.2 --- Log message: fix attribution --- Diffs of the changes: (+1 -1) X86CallingConv.td |2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/Target/X86/X86CallingConv.td diff -u llvm/lib/Target/X86/X86CallingConv.td:1.1 llvm/lib/Target/X86/X86CallingConv.td:1.2 --- llvm/lib/Target/X86/X86CallingConv.td:1.1 Mon Feb 26 12:17:14 2007 +++ llvm/lib/Target/X86/X86CallingConv.td Mon Feb 26 12:56:07 2007 @@ -2,7 +2,7 @@ // // The LLVM Compiler Infrastructure // -// This file was developed by the LLVM research group and is distributed under +// This file was developed by Chris Lattner and is distributed under // the University of Illinois Open Source License. See LICENSE.TXT for details. // //===--===// ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Target/X86/X86CallingConv.td
Changes in directory llvm/lib/Target/X86: X86CallingConv.td updated: 1.2 - 1.3 --- Log message: fill in some holes --- Diffs of the changes: (+33 -7) X86CallingConv.td | 40 +--- 1 files changed, 33 insertions(+), 7 deletions(-) Index: llvm/lib/Target/X86/X86CallingConv.td diff -u llvm/lib/Target/X86/X86CallingConv.td:1.2 llvm/lib/Target/X86/X86CallingConv.td:1.3 --- llvm/lib/Target/X86/X86CallingConv.td:1.2 Mon Feb 26 12:56:07 2007 +++ llvm/lib/Target/X86/X86CallingConv.td Mon Feb 26 23:51:05 2007 @@ -12,21 +12,30 @@ // //===--===// - class CCAction; class CallingConv; +/// CCPredicateAction - Instances of this class check some predicate, then +/// delegate to another action if the predicate is true. +class CCPredicateActionCCAction A : CCAction { + CCAction SubAction = A; +} /// CCMatchType - If the current argument is one of the specified types, apply /// Action A. -class CCMatchTypelistValueType VTs, CCAction A : CCAction { +class CCMatchTypelistValueType VTs, CCAction A : CCPredicateActionA { } /// CCMatchIf - If the predicate matches, apply A. -class CCMatchIfstring predicate, CCAction A : CCAction { +class CCMatchIfstring predicate, CCAction A : CCPredicateActionA { string Predicate = predicate; } +/// CCMatchIfCC - Match of the current calling convention is 'CC'. +class CCMatchIfCCstring CC, CCAction A : CCPredicateActionA { + string CallingConv = CC; +} + /// CCAssignToReg - This action matches if there is a register in the specified /// list that is still available. If so, it assigns the value to the first /// available register and succeeds. @@ -42,7 +51,6 @@ } - /// CCPromoteToType - If applied, this promotes the specified current value to /// the specified type. class CCPromoteToTypeValueType destTy : CCAction { @@ -64,6 +72,7 @@ // Return Value Calling Conventions //===--===// +// Return-value conventions common to all X86 CC's. def RetCC_X86Common : CallingConv[ // Scalar values are returned in AX first, then DX. CCMatchType[i8] , CCAssignToReg[AL], @@ -76,7 +85,7 @@ CCMatchType[v16i8, v8i16, v4i32, v2i64, v4f32, v2f64], CCAssignToReg[XMM0] ]; -// Return conventions for the X86-32 C calling convention. +// X86-32 C return-value convention. def RetCC_X86_32_C : CallingConv[ // The X86-32 calling convention returns FP values in ST0, otherwise it is the // same as the common X86 calling conv. @@ -85,7 +94,7 @@ CCDelegateToRetCC_X86Common ]; -// Return conventions for the X86-32 Fast calling convention. +// X86-32 FastCC return-value convention. def RetCC_X86_32_Fast : CallingConv[ // The X86-32 fastcc returns FP values in XMM0 if the target has SSE2, // otherwise it is the the C calling conventions. @@ -94,7 +103,7 @@ CCDelegateToRetCC_X86Common ]; -// Return conventions for the X86-64 C calling convention. +// X86-64 C return-value convention. def RetCC_X86_64_C : CallingConv[ // The X86-64 calling convention always returns FP values in XMM0. CCMatchType[f32], CCAssignToReg[XMM0], @@ -103,6 +112,23 @@ ]; + +// This is the root return-value convention for the X86-32 backend. +def RetCC_X86_32 : CallingConv[ + // If FastCC, use RetCC_X86_32_Fast. + CCMatchIfCCCallingConv::Fast, CCDelegateToRetCC_X86_32_Fast, + // Otherwise, use RetCC_X86_32_C. + CCDelegateToRetCC_X86_32_C +]; + +// This is the root return-value convention for the X86-64 backend. +def RetCC_X86_64 : CallingConv[ + // Always just the same as C calling conv for X86-64. + CCDelegateToRetCC_X86_64_C +]; + + + //===--===// // Argument Calling Conventions //===--===// ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Target/X86/X86CallingConv.td
Changes in directory llvm/lib/Target/X86: X86CallingConv.td updated: 1.3 - 1.4 --- Log message: move target independent calling convention stuff to TargetCallingConv.td --- Diffs of the changes: (+0 -56) X86CallingConv.td | 56 -- 1 files changed, 56 deletions(-) Index: llvm/lib/Target/X86/X86CallingConv.td diff -u llvm/lib/Target/X86/X86CallingConv.td:1.3 llvm/lib/Target/X86/X86CallingConv.td:1.4 --- llvm/lib/Target/X86/X86CallingConv.td:1.3 Mon Feb 26 23:51:05 2007 +++ llvm/lib/Target/X86/X86CallingConv.td Mon Feb 26 23:57:32 2007 @@ -12,62 +12,6 @@ // //===--===// -class CCAction; -class CallingConv; - -/// CCPredicateAction - Instances of this class check some predicate, then -/// delegate to another action if the predicate is true. -class CCPredicateActionCCAction A : CCAction { - CCAction SubAction = A; -} - -/// CCMatchType - If the current argument is one of the specified types, apply -/// Action A. -class CCMatchTypelistValueType VTs, CCAction A : CCPredicateActionA { -} - -/// CCMatchIf - If the predicate matches, apply A. -class CCMatchIfstring predicate, CCAction A : CCPredicateActionA { - string Predicate = predicate; -} - -/// CCMatchIfCC - Match of the current calling convention is 'CC'. -class CCMatchIfCCstring CC, CCAction A : CCPredicateActionA { - string CallingConv = CC; -} - -/// CCAssignToReg - This action matches if there is a register in the specified -/// list that is still available. If so, it assigns the value to the first -/// available register and succeeds. -class CCAssignToReglistRegister regList : CCAction { - listRegister RegList = regList; -} - -/// CCAssignToStack - This action always matches: it assigns the value to a -/// stack slot of the specified size and alignment on the stack. -class CCAssignToStackint size, int align : CCAction { - int Size = size; - int Align = align; -} - - -/// CCPromoteToType - If applied, this promotes the specified current value to -/// the specified type. -class CCPromoteToTypeValueType destTy : CCAction { - ValueType DestTy = destTy; -} - -/// CCDelegateTo - This action invokes the specified sub-calling-convention. It -/// is successful if the specified CC matches. -class CCDelegateToCallingConv cc : CCAction { - CallingConv CC = cc; -} - - -class CallingConvlistCCAction actions { - listCCAction Actions = actions; -} - //===--===// // Return Value Calling Conventions //===--===// ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Target/X86/X86CallingConv.td
Changes in directory llvm/lib/Target/X86: X86CallingConv.td updated: 1.4 - 1.5 --- Log message: Add calling convention info --- Diffs of the changes: (+5 -1) X86CallingConv.td |6 +- 1 files changed, 5 insertions(+), 1 deletion(-) Index: llvm/lib/Target/X86/X86CallingConv.td diff -u llvm/lib/Target/X86/X86CallingConv.td:1.4 llvm/lib/Target/X86/X86CallingConv.td:1.5 --- llvm/lib/Target/X86/X86CallingConv.td:1.4 Mon Feb 26 23:57:32 2007 +++ llvm/lib/Target/X86/X86CallingConv.td Tue Feb 27 00:59:52 2007 @@ -71,7 +71,11 @@ CCDelegateToRetCC_X86_64_C ]; - +// This is the return-value convention used for the entire X86 backend. +def RetCC_X86 : CallingConv[ + CCMatchIfSubtarget-is64Bit(), CCDelegateToRetCC_X86_64, + CCDelegateToRetCC_X86_32 +]; //===--===// // Argument Calling Conventions ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits