diff options
Diffstat (limited to 'llvm/lib/AsmParser/LLParser.cpp')
-rw-r--r-- | llvm/lib/AsmParser/LLParser.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/llvm/lib/AsmParser/LLParser.cpp b/llvm/lib/AsmParser/LLParser.cpp index 042f324249f..c204a9448ce 100644 --- a/llvm/lib/AsmParser/LLParser.cpp +++ b/llvm/lib/AsmParser/LLParser.cpp @@ -3414,7 +3414,8 @@ bool LLParser::ParseValID(ValID &ID, PerFunctionState *PFS) { } // Unary Operators. - case lltok::kw_fneg: { + case lltok::kw_fneg: + case lltok::kw_freeze: { unsigned Opc = Lex.getUIntVal(); Constant *Val; Lex.Lex(); @@ -3429,6 +3430,8 @@ bool LLParser::ParseValID(ValID &ID, PerFunctionState *PFS) { if (!Val->getType()->isFPOrFPVectorTy()) return Error(ID.Loc, "constexpr requires fp operands"); break; + case Instruction::Freeze: + break; default: llvm_unreachable("Unknown unary operator!"); } unsigned Flags = 0; @@ -5722,6 +5725,7 @@ int LLParser::ParseInstruction(Instruction *&Inst, BasicBlock *BB, Inst->setFastMathFlags(FMF); return false; } + case lltok::kw_freeze: return ParseUnaryOp(Inst, PFS, KeywordVal, false); // Binary Operators. case lltok::kw_add: case lltok::kw_sub: @@ -6325,16 +6329,14 @@ bool LLParser::ParseCleanupPad(Instruction *&Inst, PerFunctionState &PFS) { /// ParseUnaryOp /// ::= UnaryOp TypeAndValue ',' Value /// -/// If IsFP is false, then any integer operand is allowed, if it is true, any fp -/// operand is allowed. +/// If IsFP is true, then fp operand is only allowed. bool LLParser::ParseUnaryOp(Instruction *&Inst, PerFunctionState &PFS, unsigned Opc, bool IsFP) { LocTy Loc; Value *LHS; if (ParseTypeAndValue(LHS, Loc, PFS)) return true; - bool Valid = IsFP ? LHS->getType()->isFPOrFPVectorTy() - : LHS->getType()->isIntOrIntVectorTy(); + bool Valid = !IsFP || LHS->getType()->isFPOrFPVectorTy(); if (!Valid) return Error(Loc, "invalid operand type for instruction"); |