summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/WebAssembly
diff options
context:
space:
mode:
authorReid Kleckner <rnk@google.com>2017-04-13 00:58:09 +0000
committerReid Kleckner <rnk@google.com>2017-04-13 00:58:09 +0000
commit7f72033e1cde7a3a76da8c79634dfb7bf4919b54 (patch)
tree91cd8b6c041464464cf122c8b204588149e44536 /llvm/lib/Target/WebAssembly
parent4104cf8257717c068622383441ee37bacaa1b74a (diff)
downloadbcm5719-llvm-7f72033e1cde7a3a76da8c79634dfb7bf4919b54.tar.gz
bcm5719-llvm-7f72033e1cde7a3a76da8c79634dfb7bf4919b54.zip
[IR] Take func, ret, and arg attrs separately in AttributeList::get
This seems like a much more natural API, based on Derek Schuff's comments on r300015. It further hides the implementation detail of AttributeList that function attributes come last and appear at index ~0U, which is easy for the user to screw up. git diff says it saves code as well: 97 insertions(+), 137 deletions(-) This also makes it easier to change the implementation, which I want to do next. llvm-svn: 300153
Diffstat (limited to 'llvm/lib/Target/WebAssembly')
-rw-r--r--llvm/lib/Target/WebAssembly/WebAssemblyLowerEmscriptenEHSjLj.cpp14
1 files changed, 6 insertions, 8 deletions
diff --git a/llvm/lib/Target/WebAssembly/WebAssemblyLowerEmscriptenEHSjLj.cpp b/llvm/lib/Target/WebAssembly/WebAssemblyLowerEmscriptenEHSjLj.cpp
index e1b2f79c81c..6af7d107934 100644
--- a/llvm/lib/Target/WebAssembly/WebAssemblyLowerEmscriptenEHSjLj.cpp
+++ b/llvm/lib/Target/WebAssembly/WebAssemblyLowerEmscriptenEHSjLj.cpp
@@ -435,22 +435,20 @@ Value *WebAssemblyLowerEmscriptenEHSjLj::wrapInvoke(CallOrInvoke *CI) {
// Because we added the pointer to the callee as first argument, all
// argument attribute indices have to be incremented by one.
- SmallVector<AttributeSet, 8> AttributesVec;
+ SmallVector<AttributeSet, 8> ArgAttributes;
const AttributeList &InvokeAL = CI->getAttributes();
- // Add any return attributes.
- AttributesVec.push_back(InvokeAL.getRetAttributes());
// No attributes for the callee pointer.
- AttributesVec.push_back(AttributeSet());
+ ArgAttributes.push_back(AttributeSet());
// Copy the argument attributes from the original
for (unsigned i = 1, e = CI->getNumArgOperands(); i <= e; ++i) {
- AttributesVec.push_back(InvokeAL.getParamAttributes(i));
+ ArgAttributes.push_back(InvokeAL.getParamAttributes(i));
}
- // Add any function attributes.
- AttributesVec.push_back(InvokeAL.getFnAttributes());
// Reconstruct the AttributesList based on the vector we constructed.
- AttributeList NewCallAL = AttributeList::get(C, AttributesVec);
+ AttributeList NewCallAL =
+ AttributeList::get(C, InvokeAL.getFnAttributes(),
+ InvokeAL.getRetAttributes(), ArgAttributes);
NewCall->setAttributes(NewCallAL);
CI->replaceAllUsesWith(NewCall);
OpenPOWER on IntegriCloud