diff options
author | Matt Arsenault <Matthew.Arsenault@amd.com> | 2013-11-15 01:34:59 +0000 |
---|---|---|
committer | Matt Arsenault <Matthew.Arsenault@amd.com> | 2013-11-15 01:34:59 +0000 |
commit | b03bd4d96bfa6fe58afd7e4c238fad354b701ecd (patch) | |
tree | 187df4c6d831f6521192e03afdc4a16fc259c50e /llvm/lib/Bitcode/Reader | |
parent | 08c0b1a1bd345aadf2755358e4463b2c1047c616 (diff) | |
download | bcm5719-llvm-b03bd4d96bfa6fe58afd7e4c238fad354b701ecd.tar.gz bcm5719-llvm-b03bd4d96bfa6fe58afd7e4c238fad354b701ecd.zip |
Add addrspacecast instruction.
Patch by Michele Scandale!
llvm-svn: 194760
Diffstat (limited to 'llvm/lib/Bitcode/Reader')
-rw-r--r-- | llvm/lib/Bitcode/Reader/BitcodeReader.cpp | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp index d25b33e9ab7..e052e6e5bae 100644 --- a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp +++ b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp @@ -128,6 +128,7 @@ static int GetDecodedCastOpcode(unsigned Val) { case bitc::CAST_PTRTOINT: return Instruction::PtrToInt; case bitc::CAST_INTTOPTR: return Instruction::IntToPtr; case bitc::CAST_BITCAST : return Instruction::BitCast; + case bitc::CAST_ADDRSPACECAST : return Instruction::AddrSpaceCast; } } static int GetDecodedBinaryOpcode(unsigned Val, Type *Ty) { @@ -1356,7 +1357,8 @@ error_code BitcodeReader::ParseConstants() { if (!OpTy) return Error(InvalidRecord); Constant *Op = ValueList.getConstantFwdRef(Record[2], OpTy); - V = ConstantExpr::getCast(Opc, Op, CurTy); + V = UpgradeBitCastExpr(Opc, Op, CurTy); + if (!V) V = ConstantExpr::getCast(Opc, Op, CurTy); } break; } @@ -2296,7 +2298,15 @@ error_code BitcodeReader::ParseFunctionBody(Function *F) { int Opc = GetDecodedCastOpcode(Record[OpNum+1]); if (Opc == -1 || ResTy == 0) return Error(InvalidRecord); - I = CastInst::Create((Instruction::CastOps)Opc, Op, ResTy); + Instruction *Temp = 0; + if ((I = UpgradeBitCastInst(Opc, Op, ResTy, Temp))) { + if (Temp) { + InstructionList.push_back(Temp); + CurBB->getInstList().push_back(Temp); + } + } else { + I = CastInst::Create((Instruction::CastOps)Opc, Op, ResTy); + } InstructionList.push_back(I); break; } |