diff options
author | Bob Wilson <bob.wilson@apple.com> | 2009-04-17 19:07:39 +0000 |
---|---|---|
committer | Bob Wilson <bob.wilson@apple.com> | 2009-04-17 19:07:39 +0000 |
commit | 1f595bb42950088ccb8246e6b065a96027b46ec6 (patch) | |
tree | 4f697a8bf24d7aca7c17a6042b6c9307ce43c36d /include | |
parent | 5bea822a0c21d46b2ee539a38474735b2617365d (diff) | |
download | llvm-1f595bb42950088ccb8246e6b065a96027b46ec6.tar.gz llvm-1f595bb42950088ccb8246e6b065a96027b46ec6.tar.bz2 llvm-1f595bb42950088ccb8246e6b065a96027b46ec6.tar.xz |
Use CallConvLower.h and TableGen descriptions of the calling conventions
for ARM. Patch by Sandeep Patel.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@69371 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r-- | include/llvm/CodeGen/CallingConvLower.h | 40 | ||||
-rw-r--r-- | include/llvm/Target/TargetCallingConv.td | 11 |
2 files changed, 47 insertions, 4 deletions
diff --git a/include/llvm/CodeGen/CallingConvLower.h b/include/llvm/CodeGen/CallingConvLower.h index 2a57cc183d..4b7e54cc46 100644 --- a/include/llvm/CodeGen/CallingConvLower.h +++ b/include/llvm/CodeGen/CallingConvLower.h @@ -32,7 +32,8 @@ public: Full, // The value fills the full location. SExt, // The value is sign extended in the location. ZExt, // The value is zero extended in the location. - AExt // The value is extended with undefined upper bits. + AExt, // The value is extended with undefined upper bits. + BCvt // The value is bit-converted in the location // TODO: a subset of the value is in the location. }; private: @@ -45,8 +46,11 @@ private: /// isMem - True if this is a memory loc, false if it is a register loc. bool isMem : 1; + /// isCustom - True if this arg/retval requires special handling + bool isCustom : 1; + /// Information about how the value is assigned. - LocInfo HTP : 7; + LocInfo HTP : 6; /// ValVT - The type of the value being assigned. MVT ValVT; @@ -62,11 +66,22 @@ public: Ret.ValNo = ValNo; Ret.Loc = RegNo; Ret.isMem = false; + Ret.isCustom = false; Ret.HTP = HTP; Ret.ValVT = ValVT; Ret.LocVT = LocVT; return Ret; } + + static CCValAssign getCustomReg(unsigned ValNo, MVT ValVT, + unsigned RegNo, MVT LocVT, + LocInfo HTP) { + CCValAssign Ret; + Ret = getReg(ValNo, ValVT, RegNo, LocVT, HTP); + Ret.isCustom = true; + return Ret; + } + static CCValAssign getMem(unsigned ValNo, MVT ValVT, unsigned Offset, MVT LocVT, LocInfo HTP) { @@ -74,18 +89,30 @@ public: Ret.ValNo = ValNo; Ret.Loc = Offset; Ret.isMem = true; + Ret.isCustom = false; Ret.HTP = HTP; Ret.ValVT = ValVT; Ret.LocVT = LocVT; return Ret; } + static CCValAssign getCustomMem(unsigned ValNo, MVT ValVT, + unsigned Offset, MVT LocVT, + LocInfo HTP) { + CCValAssign Ret; + Ret = getMem(ValNo, ValVT, Offset, LocVT, HTP); + Ret.isCustom = true; + return Ret; + } + unsigned getValNo() const { return ValNo; } MVT getValVT() const { return ValVT; } bool isRegLoc() const { return !isMem; } bool isMemLoc() const { return isMem; } + bool needsCustom() const { return isCustom; } + unsigned getLocReg() const { assert(isRegLoc()); return Loc; } unsigned getLocMemOffset() const { assert(isMemLoc()); return Loc; } MVT getLocVT() const { return LocVT; } @@ -93,14 +120,19 @@ public: LocInfo getLocInfo() const { return HTP; } }; - /// CCAssignFn - This function assigns a location for Val, updating State to /// reflect the change. typedef bool CCAssignFn(unsigned ValNo, MVT ValVT, MVT LocVT, CCValAssign::LocInfo LocInfo, ISD::ArgFlagsTy ArgFlags, CCState &State); - +/// CCCustomFn - This function assigns a location for Val, possibly updating +/// all args to reflect changes and indicates if it handled it. It must set +/// isCustom if it handles the arg and returns true. +typedef bool CCCustomFn(unsigned &ValNo, MVT &ValVT, + MVT &LocVT, CCValAssign::LocInfo &LocInfo, + ISD::ArgFlagsTy &ArgFlags, CCState &State); + /// CCState - This class holds information needed while lowering arguments and /// return values. It captures which registers are already assigned and which /// stack slots are used. It provides accessors to allocate these values. diff --git a/include/llvm/Target/TargetCallingConv.td b/include/llvm/Target/TargetCallingConv.td index 908e16ed5e..224c08e176 100644 --- a/include/llvm/Target/TargetCallingConv.td +++ b/include/llvm/Target/TargetCallingConv.td @@ -15,6 +15,11 @@ class CCAction; class CallingConv; +/// CCCustom - Calls a custom arg handling function. +class CCCustom<string fn> : CCAction { + string FuncName = fn; +} + /// CCPredicateAction - Instances of this class check some predicate, then /// delegate to another action if the predicate is true. class CCPredicateAction<CCAction A> : CCAction { @@ -90,6 +95,12 @@ class CCPromoteToType<ValueType destTy> : CCAction { ValueType DestTy = destTy; } +/// CCBitConvertToType - If applied, this bitconverts the specified current +/// value to the specified type. +class CCBitConvertToType<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 { |