Revert the part of 75177 that split ConstantRange into two classes, and
[oota-llvm.git] / include / llvm / Target / TargetCallingConv.td
1 //===- TargetCallingConv.td - Target Calling Conventions ---*- tablegen -*-===//
2 // 
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 // 
8 //===----------------------------------------------------------------------===//
9 //
10 // This file defines the target-independent interfaces with which targets
11 // describe their calling conventions.
12 //
13 //===----------------------------------------------------------------------===//
14
15 class CCAction;
16 class CallingConv;
17
18 /// CCCustom - Calls a custom arg handling function.
19 class CCCustom<string fn> : CCAction {
20   string FuncName = fn;
21 }
22
23 /// CCPredicateAction - Instances of this class check some predicate, then
24 /// delegate to another action if the predicate is true.
25 class CCPredicateAction<CCAction A> : CCAction {
26   CCAction SubAction = A;
27 }
28
29 /// CCIfType - If the current argument is one of the specified types, apply
30 /// Action A.
31 class CCIfType<list<ValueType> vts, CCAction A> : CCPredicateAction<A> {
32   list<ValueType> VTs = vts;
33 }
34
35 /// CCIf - If the predicate matches, apply A.
36 class CCIf<string predicate, CCAction A> : CCPredicateAction<A> {
37   string Predicate = predicate;
38 }
39
40 /// CCIfByVal - If the current argument has ByVal parameter attribute, apply
41 /// Action A.
42 class CCIfByVal<CCAction A> : CCIf<"ArgFlags.isByVal()", A> {
43 }
44
45 /// CCIfCC - Match of the current calling convention is 'CC'.
46 class CCIfCC<string CC, CCAction A>
47   : CCIf<!strconcat("State.getCallingConv() == ", CC), A> {}
48
49 /// CCIfInReg - If this argument is marked with the 'inreg' attribute, apply
50 /// the specified action.
51 class CCIfInReg<CCAction A> : CCIf<"ArgFlags.isInReg()", A> {}
52
53 /// CCIfNest - If this argument is marked with the 'nest' attribute, apply
54 /// the specified action.
55 class CCIfNest<CCAction A> : CCIf<"ArgFlags.isNest()", A> {}
56
57 /// CCIfSplit - If this argument is marked with the 'split' attribute, apply
58 /// the specified action.
59 class CCIfSplit<CCAction A> : CCIf<"ArgFlags.isSplit()", A> {}
60
61 /// CCIfNotVarArg - If the current function is not vararg - apply the action
62 class CCIfNotVarArg<CCAction A> : CCIf<"!State.isVarArg()", A> {}
63
64 /// CCAssignToReg - This action matches if there is a register in the specified
65 /// list that is still available.  If so, it assigns the value to the first
66 /// available register and succeeds.
67 class CCAssignToReg<list<Register> regList> : CCAction {
68   list<Register> RegList = regList;
69 }
70
71 /// CCAssignToRegWithShadow - Same as CCAssignToReg, but with list of registers
72 /// which became shadowed, when some register is used.
73 class CCAssignToRegWithShadow<list<Register> regList,
74                               list<Register> shadowList> : CCAction {
75   list<Register> RegList = regList;
76   list<Register> ShadowRegList = shadowList;
77 }
78
79 /// CCAssignToStack - This action always matches: it assigns the value to a
80 /// stack slot of the specified size and alignment on the stack.  If size is
81 /// zero then the ABI size is used; if align is zero then the ABI alignment
82 /// is used - these may depend on the target or subtarget.
83 class CCAssignToStack<int size, int align> : CCAction {
84   int Size = size;
85   int Align = align;
86 }
87
88 /// CCPassByVal - This action always matches: it assigns the value to a stack
89 /// slot to implement ByVal aggregate parameter passing. Size and alignment
90 /// specify the minimum size and alignment for the stack slot.
91 class CCPassByVal<int size, int align> : CCAction {
92   int Size = size;
93   int Align = align;
94 }
95
96 /// CCPromoteToType - If applied, this promotes the specified current value to
97 /// the specified type.
98 class CCPromoteToType<ValueType destTy> : CCAction {
99   ValueType DestTy = destTy;
100 }
101
102 /// CCBitConvertToType - If applied, this bitconverts the specified current
103 /// value to the specified type.
104 class CCBitConvertToType<ValueType destTy> : CCAction {
105   ValueType DestTy = destTy;
106 }
107
108 /// CCDelegateTo - This action invokes the specified sub-calling-convention.  It
109 /// is successful if the specified CC matches.
110 class CCDelegateTo<CallingConv cc> : CCAction {
111   CallingConv CC = cc;
112 }
113
114 /// CallingConv - An instance of this is used to define each calling convention
115 /// that the target supports.
116 class CallingConv<list<CCAction> actions> {
117   list<CCAction> Actions = actions;
118 }