diff --git a/lib/Target/X86/X86CallingConv.td b/lib/Target/X86/X86CallingConv.td index de9a544a0db..110335b8c10 100644 --- a/lib/Target/X86/X86CallingConv.td +++ b/lib/Target/X86/X86CallingConv.td @@ -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 CCPredicateAction : CCAction { + CCAction SubAction = A; +} /// CCMatchType - If the current argument is one of the specified types, apply /// Action A. -class CCMatchType VTs, CCAction A> : CCAction { +class CCMatchType VTs, CCAction A> : CCPredicateAction { } /// CCMatchIf - If the predicate matches, apply A. -class CCMatchIf : CCAction { +class CCMatchIf : CCPredicateAction { string Predicate = predicate; } +/// CCMatchIfCC - Match of the current calling convention is 'CC'. +class CCMatchIfCC : CCPredicateAction { + 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 @@ class CCAssignToStack : CCAction { } - /// CCPromoteToType - If applied, this promotes the specified current value to /// the specified type. class CCPromoteToType : CCAction { @@ -64,6 +72,7 @@ class CallingConv actions> { // 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 @@ def RetCC_X86Common : CallingConv<[ 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 @@ def RetCC_X86_32_C : CallingConv<[ CCDelegateTo ]>; -// 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 @@ def RetCC_X86_32_Fast : CallingConv<[ CCDelegateTo ]>; -// 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 @@ def RetCC_X86_64_C : CallingConv<[ ]>; + +// This is the root return-value convention for the X86-32 backend. +def RetCC_X86_32 : CallingConv<[ + // If FastCC, use RetCC_X86_32_Fast. + CCMatchIfCC<"CallingConv::Fast", CCDelegateTo>, + // Otherwise, use RetCC_X86_32_C. + CCDelegateTo +]>; + +// 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. + CCDelegateTo +]>; + + + //===----------------------------------------------------------------------===// // Argument Calling Conventions //===----------------------------------------------------------------------===//