2007-02-27 05:57:32 +00:00
|
|
|
//===- TargetCallingConv.td - Target Calling Conventions ---*- tablegen -*-===//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
2007-12-29 20:36:04 +00:00
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
2007-02-27 05:57:32 +00:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// This file defines the target-independent interfaces with which targets
|
|
|
|
// describe their calling conventions.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
class CCAction;
|
|
|
|
class CallingConv;
|
|
|
|
|
2009-04-17 19:07:39 +00:00
|
|
|
/// CCCustom - Calls a custom arg handling function.
|
|
|
|
class CCCustom<string fn> : CCAction {
|
|
|
|
string FuncName = fn;
|
|
|
|
}
|
|
|
|
|
2007-02-27 05:57:32 +00:00
|
|
|
/// 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 05:29:33 +00:00
|
|
|
/// CCIfType - If the current argument is one of the specified types, apply
|
2007-02-27 05:57:32 +00:00
|
|
|
/// Action A.
|
2007-02-28 05:29:33 +00:00
|
|
|
class CCIfType<list<ValueType> vts, CCAction A> : CCPredicateAction<A> {
|
2007-02-27 20:45:02 +00:00
|
|
|
list<ValueType> VTs = vts;
|
2007-02-27 05:57:32 +00:00
|
|
|
}
|
|
|
|
|
2007-02-28 05:29:33 +00:00
|
|
|
/// CCIf - If the predicate matches, apply A.
|
|
|
|
class CCIf<string predicate, CCAction A> : CCPredicateAction<A> {
|
2007-02-27 05:57:32 +00:00
|
|
|
string Predicate = predicate;
|
|
|
|
}
|
|
|
|
|
2008-01-15 03:34:58 +00:00
|
|
|
/// CCIfByVal - If the current argument has ByVal parameter attribute, apply
|
2007-07-06 10:57:03 +00:00
|
|
|
/// Action A.
|
2008-03-21 09:14:45 +00:00
|
|
|
class CCIfByVal<CCAction A> : CCIf<"ArgFlags.isByVal()", A> {
|
2007-07-06 10:57:03 +00:00
|
|
|
}
|
|
|
|
|
2014-05-09 14:01:47 +00:00
|
|
|
/// CCIfConsecutiveRegs - If the current argument has InConsecutiveRegs
|
|
|
|
/// parameter attribute, apply Action A.
|
|
|
|
class CCIfConsecutiveRegs<CCAction A> : CCIf<"ArgFlags.isInConsecutiveRegs()", A> {
|
|
|
|
}
|
|
|
|
|
2010-08-27 21:38:11 +00:00
|
|
|
/// CCIfCC - Match if the current calling convention is 'CC'.
|
2007-02-28 05:29:33 +00:00
|
|
|
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.
|
2008-03-21 09:14:45 +00:00
|
|
|
class CCIfInReg<CCAction A> : CCIf<"ArgFlags.isInReg()", A> {}
|
2007-02-28 05:29:33 +00:00
|
|
|
|
2007-07-27 12:58:54 +00:00
|
|
|
/// CCIfNest - If this argument is marked with the 'nest' attribute, apply
|
|
|
|
/// the specified action.
|
2008-03-21 09:14:45 +00:00
|
|
|
class CCIfNest<CCAction A> : CCIf<"ArgFlags.isNest()", A> {}
|
2007-07-27 12:58:54 +00:00
|
|
|
|
2009-07-03 06:45:56 +00:00
|
|
|
/// CCIfSplit - If this argument is marked with the 'split' attribute, apply
|
|
|
|
/// the specified action.
|
|
|
|
class CCIfSplit<CCAction A> : CCIf<"ArgFlags.isSplit()", A> {}
|
|
|
|
|
2009-07-12 13:15:50 +00:00
|
|
|
/// CCIfSRet - If this argument is marked with the 'sret' attribute, apply
|
|
|
|
/// the specified action.
|
|
|
|
class CCIfSRet<CCAction A> : CCIf<"ArgFlags.isSRet()", A> {}
|
|
|
|
|
2014-11-07 11:43:49 +00:00
|
|
|
/// CCIfVarArg - If the current function is vararg - apply the action
|
|
|
|
class CCIfVarArg<CCAction A> : CCIf<"State.isVarArg()", A> {}
|
|
|
|
|
2007-06-19 00:13:10 +00:00
|
|
|
/// CCIfNotVarArg - If the current function is not vararg - apply the action
|
|
|
|
class CCIfNotVarArg<CCAction A> : CCIf<"!State.isVarArg()", A> {}
|
2007-02-27 05:57:32 +00: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;
|
|
|
|
}
|
|
|
|
|
2008-04-02 05:23:57 +00:00
|
|
|
/// CCAssignToRegWithShadow - Same as CCAssignToReg, but with list of registers
|
|
|
|
/// which became shadowed, when some register is used.
|
|
|
|
class CCAssignToRegWithShadow<list<Register> regList,
|
|
|
|
list<Register> shadowList> : CCAction {
|
|
|
|
list<Register> RegList = regList;
|
|
|
|
list<Register> ShadowRegList = shadowList;
|
|
|
|
}
|
|
|
|
|
2007-02-27 05:57:32 +00:00
|
|
|
/// CCAssignToStack - This action always matches: it assigns the value to a
|
2007-11-14 08:29:13 +00: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 05:57:32 +00:00
|
|
|
class CCAssignToStack<int size, int align> : CCAction {
|
|
|
|
int Size = size;
|
|
|
|
int Align = align;
|
|
|
|
}
|
|
|
|
|
2014-02-07 11:19:53 +00:00
|
|
|
/// CCAssignToStackWithShadow - Same as CCAssignToStack, but with a list of
|
|
|
|
/// registers to be shadowed. Note that, unlike CCAssignToRegWithShadow, this
|
|
|
|
/// shadows ALL of the registers in shadowList.
|
|
|
|
class CCAssignToStackWithShadow<int size,
|
|
|
|
int align,
|
|
|
|
list<Register> shadowList> : CCAction {
|
|
|
|
int Size = size;
|
|
|
|
int Align = align;
|
|
|
|
list<Register> ShadowRegList = shadowList;
|
2010-08-06 15:35:32 +00:00
|
|
|
}
|
|
|
|
|
2008-01-15 03:34:58 +00: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 10:57:03 +00:00
|
|
|
}
|
2007-02-27 05:57:32 +00:00
|
|
|
|
|
|
|
/// CCPromoteToType - If applied, this promotes the specified current value to
|
|
|
|
/// the specified type.
|
|
|
|
class CCPromoteToType<ValueType destTy> : CCAction {
|
|
|
|
ValueType DestTy = destTy;
|
|
|
|
}
|
|
|
|
|
2014-09-25 12:15:05 +00:00
|
|
|
/// CCPromoteToUpperBitsInType - If applied, this promotes the specified current
|
|
|
|
/// value to the specified type and shifts the value into the upper bits.
|
|
|
|
class CCPromoteToUpperBitsInType<ValueType destTy> : CCAction {
|
|
|
|
ValueType DestTy = destTy;
|
|
|
|
}
|
|
|
|
|
2009-04-17 19:07:39 +00:00
|
|
|
/// CCBitConvertToType - If applied, this bitconverts the specified current
|
|
|
|
/// value to the specified type.
|
|
|
|
class CCBitConvertToType<ValueType destTy> : CCAction {
|
|
|
|
ValueType DestTy = destTy;
|
|
|
|
}
|
|
|
|
|
2009-08-03 08:13:56 +00:00
|
|
|
/// CCPassIndirect - If applied, this stores the value to stack and passes the pointer
|
|
|
|
/// as normal argument.
|
|
|
|
class CCPassIndirect<ValueType destTy> : CCAction {
|
|
|
|
ValueType DestTy = destTy;
|
|
|
|
}
|
|
|
|
|
2007-02-27 05:57:32 +00:00
|
|
|
/// 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;
|
2014-11-01 17:38:22 +00:00
|
|
|
bit Custom = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/// CustomCallingConv - An instance of this is used to declare calling
|
|
|
|
/// conventions that are implemented using a custom function of the same name.
|
|
|
|
class CustomCallingConv : CallingConv<[]> {
|
|
|
|
let Custom = 1;
|
2007-02-27 05:57:32 +00:00
|
|
|
}
|
2012-01-17 22:46:58 +00:00
|
|
|
|
|
|
|
/// CalleeSavedRegs - A list of callee saved registers for a given calling
|
|
|
|
/// convention. The order of registers is used by PrologEpilogInsertion when
|
|
|
|
/// allocation stack slots for saved registers.
|
|
|
|
///
|
|
|
|
/// For each CalleeSavedRegs def, TableGen will emit a FOO_SaveList array for
|
|
|
|
/// returning from getCalleeSavedRegs(), and a FOO_RegMask bit mask suitable for
|
|
|
|
/// returning from getCallPreservedMask().
|
|
|
|
class CalleeSavedRegs<dag saves> {
|
|
|
|
dag SaveList = saves;
|
2013-08-23 02:25:47 +00:00
|
|
|
|
|
|
|
// Registers that are also preserved across function calls, but should not be
|
|
|
|
// included in the generated FOO_SaveList array. These registers will be
|
|
|
|
// included in the FOO_RegMask bit mask. This can be used for registers that
|
|
|
|
// are saved automatically, like the SPARC register windows.
|
|
|
|
dag OtherPreserved;
|
2012-01-17 22:46:58 +00:00
|
|
|
}
|