summaryrefslogtreecommitdiff
path: root/lib/Target/X86/X86CallingConv.td
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2007-02-27 05:51:05 +0000
committerChris Lattner <sabre@nondot.org>2007-02-27 05:51:05 +0000
commitd50110d8dce25cb802f3a80e0bc0bb3ff2ccbfb0 (patch)
tree2f4853de9ba2bbea36adbeb7be1c5c6dc46d9b7f /lib/Target/X86/X86CallingConv.td
parent9774c915f1d27ba6de6b886c537f5fcfab81fd2d (diff)
downloadllvm-d50110d8dce25cb802f3a80e0bc0bb3ff2ccbfb0.tar.gz
llvm-d50110d8dce25cb802f3a80e0bc0bb3ff2ccbfb0.tar.bz2
llvm-d50110d8dce25cb802f3a80e0bc0bb3ff2ccbfb0.tar.xz
fill in some holes
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34658 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/X86/X86CallingConv.td')
-rw-r--r--lib/Target/X86/X86CallingConv.td40
1 files changed, 33 insertions, 7 deletions
diff --git a/lib/Target/X86/X86CallingConv.td b/lib/Target/X86/X86CallingConv.td
index de9a544a0d..110335b8c1 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 A> : CCAction {
+ CCAction SubAction = A;
+}
/// CCMatchType - If the current argument is one of the specified types, apply
/// Action A.
-class CCMatchType<list<ValueType> VTs, CCAction A> : CCAction {
+class CCMatchType<list<ValueType> VTs, CCAction A> : CCPredicateAction<A> {
}
/// CCMatchIf - If the predicate matches, apply A.
-class CCMatchIf<string predicate, CCAction A> : CCAction {
+class CCMatchIf<string predicate, CCAction A> : CCPredicateAction<A> {
string Predicate = predicate;
}
+/// CCMatchIfCC - Match of the current calling convention is 'CC'.
+class CCMatchIfCC<string CC, CCAction A> : CCPredicateAction<A> {
+ 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<int size, int align> : CCAction {
}
-
/// CCPromoteToType - If applied, this promotes the specified current value to
/// the specified type.
class CCPromoteToType<ValueType destTy> : CCAction {
@@ -64,6 +72,7 @@ class CallingConv<list<CCAction> 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<RetCC_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 @@ def RetCC_X86_32_Fast : CallingConv<[
CCDelegateTo<RetCC_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 @@ 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<RetCC_X86_32_Fast>>,
+ // Otherwise, use RetCC_X86_32_C.
+ CCDelegateTo<RetCC_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.
+ CCDelegateTo<RetCC_X86_64_C>
+]>;
+
+
+
//===----------------------------------------------------------------------===//
// Argument Calling Conventions
//===----------------------------------------------------------------------===//