X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=lib%2FAsmParser%2FLLParser.h;h=24ff8e750237a86e768fd070676cc46259c25a21;hb=98f84ad174bb5d58e8b8024ee81367d2abdb5691;hp=7efcac7a19ae9e3fc3fcdcdcf8e9d84a75f8c263;hpb=4b50ecbf6a5a9cec8fe11256a7853ff168150328;p=oota-llvm.git diff --git a/lib/AsmParser/LLParser.h b/lib/AsmParser/LLParser.h index 7efcac7a19a..24ff8e75023 100644 --- a/lib/AsmParser/LLParser.h +++ b/lib/AsmParser/LLParser.h @@ -52,23 +52,26 @@ namespace llvm { t_Null, t_Undef, t_Zero, // No value. t_EmptyArray, // No value: [] t_Constant, // Value in ConstantVal. - t_InlineAsm, // Value in StrVal/StrVal2/UIntVal. + t_InlineAsm, // Value in FTy/StrVal/StrVal2/UIntVal. t_ConstantStruct, // Value in ConstantStructElts. t_PackedConstantStruct // Value in ConstantStructElts. - } Kind; + } Kind = t_LocalID; LLLexer::LocTy Loc; unsigned UIntVal; + FunctionType *FTy = nullptr; std::string StrVal, StrVal2; APSInt APSIntVal; - APFloat APFloatVal; + APFloat APFloatVal{0.0}; Constant *ConstantVal; - Constant **ConstantStructElts; - - ValID() : Kind(t_LocalID), APFloatVal(0.0) {} - ~ValID() { - if (Kind == t_ConstantStruct || Kind == t_PackedConstantStruct) - delete [] ConstantStructElts; + std::unique_ptr ConstantStructElts; + + ValID() = default; + ValID(const ValID &RHS) + : Kind(RHS.Kind), Loc(RHS.Loc), UIntVal(RHS.UIntVal), FTy(RHS.FTy), + StrVal(RHS.StrVal), StrVal2(RHS.StrVal2), APSIntVal(RHS.APSIntVal), + APFloatVal(RHS.APFloatVal), ConstantVal(RHS.ConstantVal) { + assert(!RHS.ConstantStructElts); } bool operator<(const ValID &RHS) const { @@ -105,6 +108,14 @@ namespace llvm { unsigned MDKind, MDSlot; }; + /// Indicates which operator an operand allows (for the few operands that + /// may only reference a certain operator). + enum OperatorConstraint { + OC_None = 0, // No constraint + OC_CatchPad, // Must be CatchPadInst + OC_CleanupPad // Must be CleanupPadInst + }; + SmallVector InstsWithTBAATag; // Type resolution handling data structures. The location is set when we @@ -143,7 +154,7 @@ namespace llvm { Slots(Slots), BlockAddressPFS(nullptr) {} bool Run(); - bool parseStandaloneConstantValue(Constant *&C); + bool parseStandaloneConstantValue(Constant *&C, const SlotMapping *Slots); LLVMContext &getContext() { return Context; } @@ -156,6 +167,10 @@ namespace llvm { return Error(Lex.getLoc(), Msg); } + /// Restore the internal name and slot mappings using the mappings that + /// were created at an earlier parsing stage. + void restoreParsingState(const SlotMapping *Slots); + /// GetGlobalVal - Get a value with the specified name or ID, creating a /// forward reference record if needed. This can return null if the value /// exists but does not have the right type. @@ -212,6 +227,8 @@ namespace llvm { return ParseUInt64(Val); } + bool ParseStringAttribute(AttrBuilder &B); + bool ParseTLSModel(GlobalVariable::ThreadLocalMode &TLM); bool ParseOptionalThreadLocal(GlobalVariable::ThreadLocalMode &TLM); bool parseOptionalUnnamedAddr(bool &UnnamedAddr) { @@ -320,8 +337,10 @@ namespace llvm { /// GetVal - Get a value with the specified name or ID, creating a /// forward reference record if needed. This can return null if the value /// exists but does not have the right type. - Value *GetVal(const std::string &Name, Type *Ty, LocTy Loc); - Value *GetVal(unsigned ID, Type *Ty, LocTy Loc); + Value *GetVal(const std::string &Name, Type *Ty, LocTy Loc, + OperatorConstraint OC = OC_None); + Value *GetVal(unsigned ID, Type *Ty, LocTy Loc, + OperatorConstraint OC = OC_None); /// SetInstName - After an instruction is parsed and inserted into its /// basic block, this installs its name. @@ -343,12 +362,15 @@ namespace llvm { }; bool ConvertValIDToValue(Type *Ty, ValID &ID, Value *&V, - PerFunctionState *PFS); + PerFunctionState *PFS, + OperatorConstraint OC = OC_None); bool parseConstantValue(Type *Ty, Constant *&C); - bool ParseValue(Type *Ty, Value *&V, PerFunctionState *PFS); - bool ParseValue(Type *Ty, Value *&V, PerFunctionState &PFS) { - return ParseValue(Ty, V, &PFS); + bool ParseValue(Type *Ty, Value *&V, PerFunctionState *PFS, + OperatorConstraint OC = OC_None); + bool ParseValue(Type *Ty, Value *&V, PerFunctionState &PFS, + OperatorConstraint OC = OC_None) { + return ParseValue(Ty, V, &PFS, OC); } bool ParseValue(Type *Ty, Value *&V, LocTy &Loc, PerFunctionState &PFS) { @@ -384,6 +406,13 @@ namespace llvm { bool IsMustTailCall = false, bool InVarArgsFunc = false); + bool + ParseOptionalOperandBundles(SmallVectorImpl &BundleList, + PerFunctionState &PFS); + + bool ParseExceptionArgs(SmallVectorImpl &Args, + PerFunctionState &PFS); + // Constant Parsing. bool ParseValID(ValID &ID, PerFunctionState *PFS = nullptr); bool ParseGlobalValue(Type *Ty, Constant *&V); @@ -444,6 +473,13 @@ namespace llvm { bool ParseIndirectBr(Instruction *&Inst, PerFunctionState &PFS); bool ParseInvoke(Instruction *&Inst, PerFunctionState &PFS); bool ParseResume(Instruction *&Inst, PerFunctionState &PFS); + bool ParseCleanupRet(Instruction *&Inst, PerFunctionState &PFS); + bool ParseCatchRet(Instruction *&Inst, PerFunctionState &PFS); + bool ParseCatchPad(Instruction *&Inst, PerFunctionState &PFS); + bool ParseTerminatePad(Instruction *&Inst, PerFunctionState &PFS); + bool ParseCleanupPad(Instruction *&Inst, PerFunctionState &PFS); + bool ParseCatchEndPad(Instruction *&Inst, PerFunctionState &PFS); + bool ParseCleanupEndPad(Instruction *&Inst, PerFunctionState &PFS); bool ParseArithmetic(Instruction *&I, PerFunctionState &PFS, unsigned Opc, unsigned OperandType);