diff options
author | Reid Kleckner <rnk@google.com> | 2017-04-12 00:38:00 +0000 |
---|---|---|
committer | Reid Kleckner <rnk@google.com> | 2017-04-12 00:38:00 +0000 |
commit | c2cb5600450b8c4e5fdd915bd8c848319c5e57e1 (patch) | |
tree | 621b8f69c41b1b0aead20855cdede8ddd54eae70 /llvm/lib/AsmParser | |
parent | bdbdd229375f1b7c112bb5ecef8aeb603ad8d07f (diff) | |
download | bcm5719-llvm-c2cb5600450b8c4e5fdd915bd8c848319c5e57e1.tar.gz bcm5719-llvm-c2cb5600450b8c4e5fdd915bd8c848319c5e57e1.zip |
[IR] Add AttributeSet to hide AttributeSetNode* again, NFC
Summary:
For now, it just wraps AttributeSetNode*. Eventually, it will hold
AvailableAttrs as an inline bitset, and adding and removing enum
attributes will be super cheap.
This sinks AttributeSetNode back down to lib/IR/AttributeImpl.h.
Reviewers: pete, chandlerc
Subscribers: llvm-commits, jfb
Differential Revision: https://reviews.llvm.org/D31940
llvm-svn: 300014
Diffstat (limited to 'llvm/lib/AsmParser')
-rw-r--r-- | llvm/lib/AsmParser/LLParser.cpp | 27 | ||||
-rw-r--r-- | llvm/lib/AsmParser/LLParser.h | 8 |
2 files changed, 17 insertions, 18 deletions
diff --git a/llvm/lib/AsmParser/LLParser.cpp b/llvm/lib/AsmParser/LLParser.cpp index ffe620348fb..68d448ed7e0 100644 --- a/llvm/lib/AsmParser/LLParser.cpp +++ b/llvm/lib/AsmParser/LLParser.cpp @@ -19,7 +19,6 @@ #include "llvm/ADT/STLExtras.h" #include "llvm/AsmParser/SlotMapping.h" #include "llvm/IR/Argument.h" -#include "llvm/IR/AttributeSetNode.h" #include "llvm/IR/AutoUpgrade.h" #include "llvm/IR/BasicBlock.h" #include "llvm/IR/CallingConv.h" @@ -2155,7 +2154,7 @@ bool LLParser::ParseParameterList(SmallVectorImpl<ParamInfo> &ArgList, return true; } ArgList.push_back(ParamInfo( - ArgLoc, V, AttributeSetNode::get(V->getContext(), ArgAttrs))); + ArgLoc, V, AttributeSet::get(V->getContext(), ArgAttrs))); } if (IsMustTailCall && InVarArgsFunc) @@ -2261,7 +2260,7 @@ bool LLParser::ParseArgumentList(SmallVectorImpl<ArgInfo> &ArgList, return Error(TypeLoc, "invalid type for function argument"); ArgList.emplace_back(TypeLoc, ArgTy, - AttributeSetNode::get(ArgTy->getContext(), Attrs), + AttributeSet::get(ArgTy->getContext(), Attrs), std::move(Name)); while (EatIfPresent(lltok::comma)) { @@ -2289,7 +2288,7 @@ bool LLParser::ParseArgumentList(SmallVectorImpl<ArgInfo> &ArgList, return Error(TypeLoc, "invalid type for function argument"); ArgList.emplace_back(TypeLoc, ArgTy, - AttributeSetNode::get(ArgTy->getContext(), Attrs), + AttributeSet::get(ArgTy->getContext(), Attrs), std::move(Name)); } } @@ -2314,7 +2313,7 @@ bool LLParser::ParseFunctionType(Type *&Result) { for (unsigned i = 0, e = ArgList.size(); i != e; ++i) { if (!ArgList[i].Name.empty()) return Error(ArgList[i].Loc, "argument name invalid in function type"); - if (ArgList[i].Attrs) + if (ArgList[i].Attrs.hasAttributes()) return Error(ArgList[i].Loc, "argument attributes invalid in function type"); } @@ -4763,16 +4762,16 @@ bool LLParser::ParseFunctionHeader(Function *&Fn, bool isDefine) { // Okay, if we got here, the function is syntactically valid. Convert types // and do semantic checks. std::vector<Type*> ParamTypeList; - SmallVector<AttributeSetNode *, 8> Attrs; + SmallVector<AttributeSet, 8> Attrs; - Attrs.push_back(AttributeSetNode::get(Context, RetAttrs)); + Attrs.push_back(AttributeSet::get(Context, RetAttrs)); for (unsigned i = 0, e = ArgList.size(); i != e; ++i) { ParamTypeList.push_back(ArgList[i].Ty); Attrs.push_back(ArgList[i].Attrs); } - Attrs.push_back(AttributeSetNode::get(Context, FuncAttrs)); + Attrs.push_back(AttributeSet::get(Context, FuncAttrs)); AttributeList PAL = AttributeList::get(Context, Attrs); @@ -5384,8 +5383,8 @@ bool LLParser::ParseInvoke(Instruction *&Inst, PerFunctionState &PFS) { return true; // Set up the Attribute for the function. - SmallVector<AttributeSetNode *, 8> Attrs; - Attrs.push_back(AttributeSetNode::get(Context, RetAttrs)); + SmallVector<AttributeSet, 8> Attrs; + Attrs.push_back(AttributeSet::get(Context, RetAttrs)); SmallVector<Value*, 8> Args; @@ -5414,7 +5413,7 @@ bool LLParser::ParseInvoke(Instruction *&Inst, PerFunctionState &PFS) { if (FnAttrs.hasAlignmentAttr()) return Error(CallLoc, "invoke instructions may not have an alignment"); - Attrs.push_back(AttributeSetNode::get(Context, FnAttrs)); + Attrs.push_back(AttributeSet::get(Context, FnAttrs)); // Finish off the Attribute and check them AttributeList PAL = AttributeList::get(Context, Attrs); @@ -5978,8 +5977,8 @@ bool LLParser::ParseCall(Instruction *&Inst, PerFunctionState &PFS, return true; // Set up the Attribute for the function. - SmallVector<AttributeSetNode *, 8> Attrs; - Attrs.push_back(AttributeSetNode::get(Context, RetAttrs)); + SmallVector<AttributeSet, 8> Attrs; + Attrs.push_back(AttributeSet::get(Context, RetAttrs)); SmallVector<Value*, 8> Args; @@ -6008,7 +6007,7 @@ bool LLParser::ParseCall(Instruction *&Inst, PerFunctionState &PFS, if (FnAttrs.hasAlignmentAttr()) return Error(CallLoc, "call instructions may not have an alignment"); - Attrs.push_back(AttributeSetNode::get(Context, FnAttrs)); + Attrs.push_back(AttributeSet::get(Context, FnAttrs)); // Finish off the Attribute and check them AttributeList PAL = AttributeList::get(Context, Attrs); diff --git a/llvm/lib/AsmParser/LLParser.h b/llvm/lib/AsmParser/LLParser.h index 2b693331548..4616c2e8694 100644 --- a/llvm/lib/AsmParser/LLParser.h +++ b/llvm/lib/AsmParser/LLParser.h @@ -397,8 +397,8 @@ namespace llvm { struct ParamInfo { LocTy Loc; Value *V; - AttributeSetNode *Attrs; - ParamInfo(LocTy loc, Value *v, AttributeSetNode *attrs) + AttributeSet Attrs; + ParamInfo(LocTy loc, Value *v, AttributeSet attrs) : Loc(loc), V(v), Attrs(attrs) {} }; bool ParseParameterList(SmallVectorImpl<ParamInfo> &ArgList, @@ -450,9 +450,9 @@ namespace llvm { struct ArgInfo { LocTy Loc; Type *Ty; - AttributeSetNode *Attrs; + AttributeSet Attrs; std::string Name; - ArgInfo(LocTy L, Type *ty, AttributeSetNode *Attr, const std::string &N) + ArgInfo(LocTy L, Type *ty, AttributeSet Attr, const std::string &N) : Loc(L), Ty(ty), Attrs(Attr), Name(N) {} }; bool ParseArgumentList(SmallVectorImpl<ArgInfo> &ArgList, bool &isVarArg); |