diff options
author | David Majnemer <david.majnemer@gmail.com> | 2015-06-17 20:52:32 +0000 |
---|---|---|
committer | David Majnemer <david.majnemer@gmail.com> | 2015-06-17 20:52:32 +0000 |
commit | 7fddeccb8b4694002e3a2130d4bce07d628b1db2 (patch) | |
tree | 01bc06f3a0d026c80340d658807481ae33240033 /llvm/lib/AsmParser | |
parent | f32991461f301bbc99c17cc51fd44a50d2012179 (diff) | |
download | bcm5719-llvm-7fddeccb8b4694002e3a2130d4bce07d628b1db2.tar.gz bcm5719-llvm-7fddeccb8b4694002e3a2130d4bce07d628b1db2.zip |
Move the personality function from LandingPadInst to Function
The personality routine currently lives in the LandingPadInst.
This isn't desirable because:
- All LandingPadInsts in the same function must have the same
personality routine. This means that each LandingPadInst beyond the
first has an operand which produces no additional information.
- There is ongoing work to introduce EH IR constructs other than
LandingPadInst. Moving the personality routine off of any one
particular Instruction and onto the parent function seems a lot better
than have N different places a personality function can sneak onto an
exceptional function.
Differential Revision: http://reviews.llvm.org/D10429
llvm-svn: 239940
Diffstat (limited to 'llvm/lib/AsmParser')
-rw-r--r-- | llvm/lib/AsmParser/LLParser.cpp | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/llvm/lib/AsmParser/LLParser.cpp b/llvm/lib/AsmParser/LLParser.cpp index 064b74304a9..a121e59e1f1 100644 --- a/llvm/lib/AsmParser/LLParser.cpp +++ b/llvm/lib/AsmParser/LLParser.cpp @@ -4057,7 +4057,7 @@ bool LLParser::ParseTypeAndBasicBlock(BasicBlock *&BB, LocTy &Loc, /// FunctionHeader /// ::= OptionalLinkage OptionalVisibility OptionalCallingConv OptRetAttrs /// OptUnnamedAddr Type GlobalName '(' ArgList ')' OptFuncAttrs OptSection -/// OptionalAlign OptGC OptionalPrefix OptionalPrologue +/// OptionalAlign OptGC OptionalPrefix OptionalPrologue OptPersonalityFn bool LLParser::ParseFunctionHeader(Function *&Fn, bool isDefine) { // Parse the linkage. LocTy LinkageLoc = Lex.getLoc(); @@ -4139,6 +4139,7 @@ bool LLParser::ParseFunctionHeader(Function *&Fn, bool isDefine) { LocTy UnnamedAddrLoc; Constant *Prefix = nullptr; Constant *Prologue = nullptr; + Constant *PersonalityFn = nullptr; Comdat *C; if (ParseArgumentList(ArgList, isVarArg) || @@ -4155,7 +4156,9 @@ bool LLParser::ParseFunctionHeader(Function *&Fn, bool isDefine) { (EatIfPresent(lltok::kw_prefix) && ParseGlobalTypeAndValue(Prefix)) || (EatIfPresent(lltok::kw_prologue) && - ParseGlobalTypeAndValue(Prologue))) + ParseGlobalTypeAndValue(Prologue)) || + (EatIfPresent(lltok::kw_personality) && + ParseGlobalTypeAndValue(PersonalityFn))) return true; if (FuncAttrs.contains(Attribute::Builtin)) @@ -4254,6 +4257,7 @@ bool LLParser::ParseFunctionHeader(Function *&Fn, bool isDefine) { Fn->setAlignment(Alignment); Fn->setSection(Section); Fn->setComdat(C); + Fn->setPersonalityFn(PersonalityFn); if (!GC.empty()) Fn->setGC(GC.c_str()); Fn->setPrefixData(Prefix); Fn->setPrologueData(Prologue); @@ -5105,14 +5109,11 @@ int LLParser::ParsePHI(Instruction *&Inst, PerFunctionState &PFS) { /// ::= 'filter' TypeAndValue ( ',' TypeAndValue )* bool LLParser::ParseLandingPad(Instruction *&Inst, PerFunctionState &PFS) { Type *Ty = nullptr; LocTy TyLoc; - Value *PersFn; LocTy PersFnLoc; - if (ParseType(Ty, TyLoc) || - ParseToken(lltok::kw_personality, "expected 'personality'") || - ParseTypeAndValue(PersFn, PersFnLoc, PFS)) + if (ParseType(Ty, TyLoc)) return true; - std::unique_ptr<LandingPadInst> LP(LandingPadInst::Create(Ty, PersFn, 0)); + std::unique_ptr<LandingPadInst> LP(LandingPadInst::Create(Ty, 0)); LP->setCleanup(EatIfPresent(lltok::kw_cleanup)); while (Lex.getKind() == lltok::kw_catch || Lex.getKind() == lltok::kw_filter){ |