diff options
author | Reid Kleckner <reid@kleckner.net> | 2014-01-31 23:50:57 +0000 |
---|---|---|
committer | Reid Kleckner <reid@kleckner.net> | 2014-01-31 23:50:57 +0000 |
commit | 8a24e835504105efdf6d882053d5da7b0e1dccd3 (patch) | |
tree | 51aae09038f8ef7f890074e673143426c48763e8 /include | |
parent | cb6684b63b3c4c5a90e194c5719bc82690180f30 (diff) | |
download | llvm-8a24e835504105efdf6d882053d5da7b0e1dccd3.tar.gz llvm-8a24e835504105efdf6d882053d5da7b0e1dccd3.tar.bz2 llvm-8a24e835504105efdf6d882053d5da7b0e1dccd3.tar.xz |
Implement inalloca codegen for x86 with the new inalloca design
Calls with inalloca are lowered by skipping all stores for arguments
passed in memory and the initial stack adjustment to allocate argument
memory.
Now the frontend is responsible for the memory layout, and the backend
doesn't have to do any work. As a result these changes are pretty
minimal.
Reviewers: echristo
Differential Revision: http://llvm-reviews.chandlerc.com/D2637
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@200596 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r-- | include/llvm/Support/CallSite.h | 5 | ||||
-rw-r--r-- | include/llvm/Target/TargetCallingConv.h | 5 | ||||
-rw-r--r-- | include/llvm/Target/TargetLowering.h | 10 |
3 files changed, 14 insertions, 6 deletions
diff --git a/include/llvm/Support/CallSite.h b/include/llvm/Support/CallSite.h index d2c47b53ed..f4324cb7ba 100644 --- a/include/llvm/Support/CallSite.h +++ b/include/llvm/Support/CallSite.h @@ -268,9 +268,10 @@ public: paramHasAttr(ArgNo + 1, Attribute::InAlloca); } - /// @brief Determine if there are any inalloca arguments. + /// @brief Determine if there are is an inalloca argument. Only the last + /// argument can have the inalloca attribute. bool hasInAllocaArgument() const { - return getAttributes().hasAttrSomewhere(Attribute::InAlloca); + return paramHasAttr(arg_size(), Attribute::InAlloca); } bool doesNotAccessMemory(unsigned ArgNo) const { diff --git a/include/llvm/Target/TargetCallingConv.h b/include/llvm/Target/TargetCallingConv.h index 9cc52a591b..758a9c9ca8 100644 --- a/include/llvm/Target/TargetCallingConv.h +++ b/include/llvm/Target/TargetCallingConv.h @@ -42,6 +42,8 @@ namespace ISD { static const uint64_t ByValAlignOffs = 7; static const uint64_t Split = 1ULL<<11; static const uint64_t SplitOffs = 11; + static const uint64_t InAlloca = 1ULL<<12; ///< Passed with inalloca + static const uint64_t InAllocaOffs = 12; static const uint64_t OrigAlign = 0x1FULL<<27; static const uint64_t OrigAlignOffs = 27; static const uint64_t ByValSize = 0xffffffffULL<<32; ///< Struct size @@ -68,6 +70,9 @@ namespace ISD { bool isByVal() const { return Flags & ByVal; } void setByVal() { Flags |= One << ByValOffs; } + bool isInAlloca() const { return Flags & InAlloca; } + void setInAlloca() { Flags |= One << InAllocaOffs; } + bool isNest() const { return Flags & Nest; } void setNest() { Flags |= One << NestOffs; } diff --git a/include/llvm/Target/TargetLowering.h b/include/llvm/Target/TargetLowering.h index e9d87291aa..b5c7e43858 100644 --- a/include/llvm/Target/TargetLowering.h +++ b/include/llvm/Target/TargetLowering.h @@ -609,8 +609,9 @@ public: return getValueType(Ty, AllowUnknown).getSimpleVT(); } - /// Return the desired alignment for ByVal aggregate function arguments in the - /// caller parameter area. This is the actual alignment, not its logarithm. + /// Return the desired alignment for ByVal or InAlloca aggregate function + /// arguments in the caller parameter area. This is the actual alignment, not + /// its logarithm. virtual unsigned getByValTypeAlignment(Type *Ty) const; /// Return the type of registers that this ValueType will eventually require. @@ -1965,12 +1966,13 @@ public: bool isSRet : 1; bool isNest : 1; bool isByVal : 1; + bool isInAlloca : 1; bool isReturned : 1; uint16_t Alignment; ArgListEntry() : isSExt(false), isZExt(false), isInReg(false), - isSRet(false), isNest(false), isByVal(false), isReturned(false), - Alignment(0) { } + isSRet(false), isNest(false), isByVal(false), isInAlloca(false), + isReturned(false), Alignment(0) { } void setAttributes(ImmutableCallSite *CS, unsigned AttrIdx); }; |