]> git.proxmox.com Git - rustc.git/blame - src/llvm/include/llvm/Target/TargetCallingConv.td
Imported Upstream version 1.0.0+dfsg1
[rustc.git] / src / llvm / include / llvm / Target / TargetCallingConv.td
CommitLineData
223e47cc
LB
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
15class CCAction;
16class CallingConv;
17
18/// CCCustom - Calls a custom arg handling function.
19class 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.
25class 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.
31class CCIfType<list<ValueType> vts, CCAction A> : CCPredicateAction<A> {
32 list<ValueType> VTs = vts;
33}
34
35/// CCIf - If the predicate matches, apply A.
36class 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.
42class CCIfByVal<CCAction A> : CCIf<"ArgFlags.isByVal()", A> {
43}
44
1a4d82fc
JJ
45/// CCIfConsecutiveRegs - If the current argument has InConsecutiveRegs
46/// parameter attribute, apply Action A.
47class CCIfConsecutiveRegs<CCAction A> : CCIf<"ArgFlags.isInConsecutiveRegs()", A> {
48}
49
223e47cc
LB
50/// CCIfCC - Match if the current calling convention is 'CC'.
51class CCIfCC<string CC, CCAction A>
52 : CCIf<!strconcat("State.getCallingConv() == ", CC), A> {}
53
54/// CCIfInReg - If this argument is marked with the 'inreg' attribute, apply
55/// the specified action.
56class CCIfInReg<CCAction A> : CCIf<"ArgFlags.isInReg()", A> {}
57
58/// CCIfNest - If this argument is marked with the 'nest' attribute, apply
59/// the specified action.
60class CCIfNest<CCAction A> : CCIf<"ArgFlags.isNest()", A> {}
61
62/// CCIfSplit - If this argument is marked with the 'split' attribute, apply
63/// the specified action.
64class CCIfSplit<CCAction A> : CCIf<"ArgFlags.isSplit()", A> {}
65
66/// CCIfSRet - If this argument is marked with the 'sret' attribute, apply
67/// the specified action.
68class CCIfSRet<CCAction A> : CCIf<"ArgFlags.isSRet()", A> {}
69
85aaf69f
SL
70/// CCIfVarArg - If the current function is vararg - apply the action
71class CCIfVarArg<CCAction A> : CCIf<"State.isVarArg()", A> {}
72
223e47cc
LB
73/// CCIfNotVarArg - If the current function is not vararg - apply the action
74class CCIfNotVarArg<CCAction A> : CCIf<"!State.isVarArg()", A> {}
75
76/// CCAssignToReg - This action matches if there is a register in the specified
77/// list that is still available. If so, it assigns the value to the first
78/// available register and succeeds.
79class CCAssignToReg<list<Register> regList> : CCAction {
80 list<Register> RegList = regList;
81}
82
83/// CCAssignToRegWithShadow - Same as CCAssignToReg, but with list of registers
84/// which became shadowed, when some register is used.
85class CCAssignToRegWithShadow<list<Register> regList,
86 list<Register> shadowList> : CCAction {
87 list<Register> RegList = regList;
88 list<Register> ShadowRegList = shadowList;
89}
90
91/// CCAssignToStack - This action always matches: it assigns the value to a
92/// stack slot of the specified size and alignment on the stack. If size is
93/// zero then the ABI size is used; if align is zero then the ABI alignment
94/// is used - these may depend on the target or subtarget.
95class CCAssignToStack<int size, int align> : CCAction {
96 int Size = size;
97 int Align = align;
98}
99
1a4d82fc
JJ
100/// CCAssignToStackWithShadow - Same as CCAssignToStack, but with a list of
101/// registers to be shadowed. Note that, unlike CCAssignToRegWithShadow, this
102/// shadows ALL of the registers in shadowList.
103class CCAssignToStackWithShadow<int size,
104 int align,
105 list<Register> shadowList> : CCAction {
106 int Size = size;
107 int Align = align;
108 list<Register> ShadowRegList = shadowList;
223e47cc
LB
109}
110
111/// CCPassByVal - This action always matches: it assigns the value to a stack
112/// slot to implement ByVal aggregate parameter passing. Size and alignment
113/// specify the minimum size and alignment for the stack slot.
114class CCPassByVal<int size, int align> : CCAction {
115 int Size = size;
116 int Align = align;
117}
118
119/// CCPromoteToType - If applied, this promotes the specified current value to
120/// the specified type.
121class CCPromoteToType<ValueType destTy> : CCAction {
122 ValueType DestTy = destTy;
123}
124
1a4d82fc
JJ
125/// CCPromoteToUpperBitsInType - If applied, this promotes the specified current
126/// value to the specified type and shifts the value into the upper bits.
127class CCPromoteToUpperBitsInType<ValueType destTy> : CCAction {
128 ValueType DestTy = destTy;
129}
130
223e47cc
LB
131/// CCBitConvertToType - If applied, this bitconverts the specified current
132/// value to the specified type.
133class CCBitConvertToType<ValueType destTy> : CCAction {
134 ValueType DestTy = destTy;
135}
136
137/// CCPassIndirect - If applied, this stores the value to stack and passes the pointer
138/// as normal argument.
139class CCPassIndirect<ValueType destTy> : CCAction {
140 ValueType DestTy = destTy;
141}
142
143/// CCDelegateTo - This action invokes the specified sub-calling-convention. It
144/// is successful if the specified CC matches.
145class CCDelegateTo<CallingConv cc> : CCAction {
146 CallingConv CC = cc;
147}
148
149/// CallingConv - An instance of this is used to define each calling convention
150/// that the target supports.
151class CallingConv<list<CCAction> actions> {
152 list<CCAction> Actions = actions;
85aaf69f
SL
153 bit Custom = 0;
154}
155
156/// CustomCallingConv - An instance of this is used to declare calling
157/// conventions that are implemented using a custom function of the same name.
158class CustomCallingConv : CallingConv<[]> {
159 let Custom = 1;
223e47cc
LB
160}
161
162/// CalleeSavedRegs - A list of callee saved registers for a given calling
163/// convention. The order of registers is used by PrologEpilogInsertion when
164/// allocation stack slots for saved registers.
165///
166/// For each CalleeSavedRegs def, TableGen will emit a FOO_SaveList array for
167/// returning from getCalleeSavedRegs(), and a FOO_RegMask bit mask suitable for
168/// returning from getCallPreservedMask().
169class CalleeSavedRegs<dag saves> {
170 dag SaveList = saves;
1a4d82fc
JJ
171
172 // Registers that are also preserved across function calls, but should not be
173 // included in the generated FOO_SaveList array. These registers will be
174 // included in the FOO_RegMask bit mask. This can be used for registers that
175 // are saved automatically, like the SPARC register windows.
176 dag OtherPreserved;
223e47cc 177}