1 //===- TargetCallingConv.td - Target Calling Conventions ---*- tablegen -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file was developed by Chris Lattner and is distributed under
6 // the University of Illinois Open Source License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file defines the target-independent interfaces with which targets
11 // describe their calling conventions.
13 //===----------------------------------------------------------------------===//
18 /// CCPredicateAction - Instances of this class check some predicate, then
19 /// delegate to another action if the predicate is true.
20 class CCPredicateAction<CCAction A> : CCAction {
21 CCAction SubAction = A;
24 /// CCIfType - If the current argument is one of the specified types, apply
26 class CCIfType<list<ValueType> vts, CCAction A> : CCPredicateAction<A> {
27 list<ValueType> VTs = vts;
30 /// CCIf - If the predicate matches, apply A.
31 class CCIf<string predicate, CCAction A> : CCPredicateAction<A> {
32 string Predicate = predicate;
35 /// CCIfStruct - If the current argument is a struct, apply
37 class CCIfStruct<CCAction A> : CCIf<"ArgFlags & ISD::ParamFlags::ByVal", A> {
40 /// CCIfCC - Match of the current calling convention is 'CC'.
41 class CCIfCC<string CC, CCAction A>
42 : CCIf<!strconcat("State.getCallingConv() == ", CC), A> {}
44 /// CCIfInReg - If this argument is marked with the 'inreg' attribute, apply
45 /// the specified action.
46 class CCIfInReg<CCAction A> : CCIf<"ArgFlags & ISD::ParamFlags::InReg", A> {}
48 /// CCIfNotVarArg - If the current function is not vararg - apply the action
49 class CCIfNotVarArg<CCAction A> : CCIf<"!State.isVarArg()", A> {}
51 /// CCAssignToReg - This action matches if there is a register in the specified
52 /// list that is still available. If so, it assigns the value to the first
53 /// available register and succeeds.
54 class CCAssignToReg<list<Register> regList> : CCAction {
55 list<Register> RegList = regList;
58 /// CCAssignToStack - This action always matches: it assigns the value to a
59 /// stack slot of the specified size and alignment on the stack.
60 class CCAssignToStack<int size, int align> : CCAction {
65 /// CCStructAssign - This action always matches: it will use the C ABI and
66 /// the register availability to decided whether to assign to a set of
67 /// registers or to a stack slot.
68 class CCStructAssign<list<Register> regList> : CCAction {
69 list<Register> RegList = regList;
72 /// CCPromoteToType - If applied, this promotes the specified current value to
73 /// the specified type.
74 class CCPromoteToType<ValueType destTy> : CCAction {
75 ValueType DestTy = destTy;
78 /// CCDelegateTo - This action invokes the specified sub-calling-convention. It
79 /// is successful if the specified CC matches.
80 class CCDelegateTo<CallingConv cc> : CCAction {
84 /// CallingConv - An instance of this is used to define each calling convention
85 /// that the target supports.
86 class CallingConv<list<CCAction> actions> {
87 list<CCAction> Actions = actions;