2007-02-27 13:57:32 +08:00
|
|
|
//===- TargetCallingConv.td - Target Calling Conventions ---*- tablegen -*-===//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
2007-12-30 04:36:04 +08:00
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
2007-02-27 13:57:32 +08:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// This file defines the target-independent interfaces with which targets
|
|
|
|
// describe their calling conventions.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2007-02-28 13:29:33 +08:00
|
|
|
/// CCIfType - If the current argument is one of the specified types, apply
|
2007-02-27 13:57:32 +08:00
|
|
|
/// Action A.
|
2007-02-28 13:29:33 +08:00
|
|
|
class CCIfType<list<ValueType> vts, CCAction A> : CCPredicateAction<A> {
|
2007-02-28 04:45:02 +08:00
|
|
|
list<ValueType> VTs = vts;
|
2007-02-27 13:57:32 +08:00
|
|
|
}
|
|
|
|
|
2007-02-28 13:29:33 +08:00
|
|
|
/// CCIf - If the predicate matches, apply A.
|
|
|
|
class CCIf<string predicate, CCAction A> : CCPredicateAction<A> {
|
2007-02-27 13:57:32 +08:00
|
|
|
string Predicate = predicate;
|
|
|
|
}
|
|
|
|
|
2008-01-15 11:34:58 +08:00
|
|
|
/// CCIfByVal - If the current argument has ByVal parameter attribute, apply
|
2007-07-06 18:57:03 +08:00
|
|
|
/// Action A.
|
2008-01-15 11:34:58 +08:00
|
|
|
class CCIfByVal<CCAction A> : CCIf<"ArgFlags & ISD::ParamFlags::ByVal", A> {
|
2007-07-06 18:57:03 +08:00
|
|
|
}
|
|
|
|
|
2007-02-28 13:29:33 +08:00
|
|
|
/// CCIfCC - Match of the current calling convention is 'CC'.
|
|
|
|
class CCIfCC<string CC, CCAction A>
|
|
|
|
: CCIf<!strconcat("State.getCallingConv() == ", CC), A> {}
|
|
|
|
|
|
|
|
/// CCIfInReg - If this argument is marked with the 'inreg' attribute, apply
|
|
|
|
/// the specified action.
|
2007-03-08 00:25:09 +08:00
|
|
|
class CCIfInReg<CCAction A> : CCIf<"ArgFlags & ISD::ParamFlags::InReg", A> {}
|
2007-02-28 13:29:33 +08:00
|
|
|
|
2007-07-27 20:58:54 +08:00
|
|
|
/// CCIfNest - If this argument is marked with the 'nest' attribute, apply
|
|
|
|
/// the specified action.
|
|
|
|
class CCIfNest<CCAction A> : CCIf<"ArgFlags & ISD::ParamFlags::Nest", A> {}
|
|
|
|
|
2007-06-19 08:13:10 +08:00
|
|
|
/// CCIfNotVarArg - If the current function is not vararg - apply the action
|
|
|
|
class CCIfNotVarArg<CCAction A> : CCIf<"!State.isVarArg()", A> {}
|
2007-02-27 13:57:32 +08:00
|
|
|
|
|
|
|
/// 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.
|
|
|
|
class CCAssignToReg<list<Register> regList> : CCAction {
|
|
|
|
list<Register> RegList = regList;
|
|
|
|
}
|
|
|
|
|
|
|
|
/// CCAssignToStack - This action always matches: it assigns the value to a
|
2007-11-14 16:29:13 +08:00
|
|
|
/// stack slot of the specified size and alignment on the stack. If size is
|
|
|
|
/// zero then the ABI size is used; if align is zero then the ABI alignment
|
|
|
|
/// is used - these may depend on the target or subtarget.
|
2007-02-27 13:57:32 +08:00
|
|
|
class CCAssignToStack<int size, int align> : CCAction {
|
|
|
|
int Size = size;
|
|
|
|
int Align = align;
|
|
|
|
}
|
|
|
|
|
2008-01-15 11:34:58 +08:00
|
|
|
/// CCPassByVal - This action always matches: it assigns the value to a stack
|
|
|
|
/// slot to implement ByVal aggregate parameter passing. Size and alignment
|
|
|
|
/// specify the minimum size and alignment for the stack slot.
|
|
|
|
class CCPassByVal<int size, int align> : CCAction {
|
|
|
|
int Size = size;
|
|
|
|
int Align = align;
|
2007-07-06 18:57:03 +08:00
|
|
|
}
|
2007-02-27 13:57:32 +08:00
|
|
|
|
|
|
|
/// CCPromoteToType - If applied, this promotes the specified current value to
|
|
|
|
/// the specified type.
|
|
|
|
class CCPromoteToType<ValueType destTy> : CCAction {
|
|
|
|
ValueType DestTy = destTy;
|
|
|
|
}
|
|
|
|
|
|
|
|
/// CCDelegateTo - This action invokes the specified sub-calling-convention. It
|
|
|
|
/// is successful if the specified CC matches.
|
|
|
|
class CCDelegateTo<CallingConv cc> : CCAction {
|
|
|
|
CallingConv CC = cc;
|
|
|
|
}
|
|
|
|
|
|
|
|
/// CallingConv - An instance of this is used to define each calling convention
|
|
|
|
/// that the target supports.
|
|
|
|
class CallingConv<list<CCAction> actions> {
|
|
|
|
list<CCAction> Actions = actions;
|
|
|
|
}
|