summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
diff options
context:
space:
mode:
authoraqjune <aqjune@gmail.com>2019-11-05 15:53:22 +0900
committeraqjune <aqjune@gmail.com>2019-11-05 15:54:56 +0900
commit58acbce3def63a207b8f5a69318a99666a4aac53 (patch)
tree876e5223495c373292d079b27cfe70c8d49693a1 /llvm/lib/Bitcode/Reader/BitcodeReader.cpp
parent9f34447f3ff525029ec889bf3a82b04678a9d7c0 (diff)
downloadbcm5719-llvm-58acbce3def63a207b8f5a69318a99666a4aac53.tar.gz
bcm5719-llvm-58acbce3def63a207b8f5a69318a99666a4aac53.zip
[IR] Add Freeze instruction
Summary: - Define Instruction::Freeze, let it be UnaryOperator - Add support for freeze to LLLexer/LLParser/BitcodeReader/BitcodeWriter The format is `%x = freeze <ty> %v` - Add support for freeze instruction to llvm-c interface. - Add m_Freeze in PatternMatch. - Erase freeze when lowering IR to SelDag. Reviewers: deadalnix, hfinkel, efriedma, lebedev.ri, nlopes, jdoerfert, regehr, filcab, delcypher, whitequark Reviewed By: lebedev.ri, jdoerfert Subscribers: jfb, kristof.beyls, hiraditya, lebedev.ri, steven_wu, dexonsmith, xbolva00, delcypher, spatel, regehr, trentxintong, vsk, filcab, nlopes, mehdi_amini, deadalnix, llvm-commits Differential Revision: https://reviews.llvm.org/D29011
Diffstat (limited to 'llvm/lib/Bitcode/Reader/BitcodeReader.cpp')
-rw-r--r--llvm/lib/Bitcode/Reader/BitcodeReader.cpp11
1 files changed, 4 insertions, 7 deletions
diff --git a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
index ed736298dfa..71166ba337e 100644
--- a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
+++ b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
@@ -1055,16 +1055,13 @@ static int getDecodedCastOpcode(unsigned Val) {
}
static int getDecodedUnaryOpcode(unsigned Val, Type *Ty) {
- bool IsFP = Ty->isFPOrFPVectorTy();
- // UnOps are only valid for int/fp or vector of int/fp types
- if (!IsFP && !Ty->isIntOrIntVectorTy())
- return -1;
-
switch (Val) {
default:
return -1;
case bitc::UNOP_FNEG:
- return IsFP ? Instruction::FNeg : -1;
+ return Ty->isFPOrFPVectorTy() ? Instruction::FNeg : -1;
+ case bitc::UNOP_FREEZE:
+ return Instruction::Freeze;
}
}
@@ -3865,7 +3862,7 @@ Error BitcodeReader::parseFunctionBody(Function *F) {
case bitc::FUNC_CODE_INST_UNOP: { // UNOP: [opval, ty, opcode]
unsigned OpNum = 0;
Value *LHS;
- if (getValueTypePair(Record, OpNum, NextValueNo, LHS) ||
+ if (getValueTypePair(Record, OpNum, NextValueNo, LHS, &FullTy) ||
OpNum+1 > Record.size())
return error("Invalid record");
OpenPOWER on IntegriCloud