summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Bitcode
diff options
context:
space:
mode:
authorDevang Patel <dpatel@apple.com>2008-02-22 02:49:49 +0000
committerDevang Patel <dpatel@apple.com>2008-02-22 02:49:49 +0000
commit49cfe7018fdfe80aa1227a1fad5ba646f4d10fa7 (patch)
tree7803dcb8bfae0ced8f51bbe710a1ac415db93d59 /llvm/lib/Bitcode
parent997b3a65ca582632aa53dad60eb4a8f819da29b1 (diff)
downloadbcm5719-llvm-49cfe7018fdfe80aa1227a1fad5ba646f4d10fa7.tar.gz
bcm5719-llvm-49cfe7018fdfe80aa1227a1fad5ba646f4d10fa7.zip
Read and write getresult.
llvm-svn: 47471
Diffstat (limited to 'llvm/lib/Bitcode')
-rw-r--r--llvm/lib/Bitcode/Reader/BitcodeReader.cpp10
-rw-r--r--llvm/lib/Bitcode/Writer/BitcodeWriter.cpp5
2 files changed, 15 insertions, 0 deletions
diff --git a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
index ec71ba4e9c6..24bf978a2b0 100644
--- a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
+++ b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
@@ -1325,6 +1325,16 @@ bool BitcodeReader::ParseFunctionBody(Function *F) {
I = new ICmpInst((ICmpInst::Predicate)Record[OpNum], LHS, RHS);
break;
}
+ case bitc::FUNC_CODE_INST_GETRESULT: { // GETRESULT: [ty, val, n]
+ if (Record.size() != 2)
+ return Error("Invalid GETRESULT record");
+ unsigned OpNum = 0;
+ Value *Op;
+ getValueTypePair(Record, OpNum, NextValueNo, Op);
+ unsigned Index = Record[1];
+ I = new GetResultInst(Op, Index);
+ break;
+ }
case bitc::FUNC_CODE_INST_RET: // RET: [opty,opval<optional>]
if (Record.empty()) {
diff --git a/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp b/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
index fe013e81569..306433b1b52 100644
--- a/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
+++ b/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
@@ -744,6 +744,11 @@ static void WriteInstruction(const Instruction &I, unsigned InstID,
Vals.push_back(VE.getValueID(I.getOperand(1)));
Vals.push_back(cast<CmpInst>(I).getPredicate());
break;
+ case Instruction::GetResult:
+ Code = bitc::FUNC_CODE_INST_GETRESULT;
+ PushValueAndType(I.getOperand(0), InstID, Vals, VE);
+ Vals.push_back(Log2_32(cast<GetResultInst>(I).getIndex())+1);
+ break;
case Instruction::Ret:
Code = bitc::FUNC_CODE_INST_RET;
OpenPOWER on IntegriCloud