From e4977cf750eaff28275429191821420c20b0c64f Mon Sep 17 00:00:00 2001 From: Dan Gohman Date: Fri, 23 May 2008 01:55:30 +0000 Subject: Make structs and arrays first-class types, and add assembly and bitcode support for the extractvalue and insertvalue instructions and constant expressions. Note that this does not yet include CodeGen support. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51468 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Bitcode/Writer/BitcodeWriter.cpp | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'lib/Bitcode/Writer/BitcodeWriter.cpp') diff --git a/lib/Bitcode/Writer/BitcodeWriter.cpp b/lib/Bitcode/Writer/BitcodeWriter.cpp index ad651d36bf..cb5963cb8e 100644 --- a/lib/Bitcode/Writer/BitcodeWriter.cpp +++ b/lib/Bitcode/Writer/BitcodeWriter.cpp @@ -610,6 +610,20 @@ static void WriteConstants(unsigned FirstVal, unsigned LastVal, Record.push_back(VE.getValueID(C->getOperand(i))); } break; + case Instruction::ExtractValue: + Code = bitc::CST_CODE_CE_EXTRACTVAL; + for (unsigned i = 0, e = CE->getNumOperands(); i != e; ++i) { + Record.push_back(VE.getTypeID(C->getOperand(i)->getType())); + Record.push_back(VE.getValueID(C->getOperand(i))); + } + break; + case Instruction::InsertValue: + Code = bitc::CST_CODE_CE_INSERTVAL; + for (unsigned i = 0, e = CE->getNumOperands(); i != e; ++i) { + Record.push_back(VE.getTypeID(C->getOperand(i)->getType())); + Record.push_back(VE.getValueID(C->getOperand(i))); + } + break; case Instruction::Select: Code = bitc::CST_CODE_CE_SELECT; Record.push_back(VE.getValueID(C->getOperand(0))); @@ -718,6 +732,16 @@ static void WriteInstruction(const Instruction &I, unsigned InstID, for (unsigned i = 0, e = I.getNumOperands(); i != e; ++i) PushValueAndType(I.getOperand(i), InstID, Vals, VE); break; + case Instruction::ExtractValue: + Code = bitc::FUNC_CODE_INST_EXTRACTVAL; + for (unsigned i = 0, e = I.getNumOperands(); i != e; ++i) + PushValueAndType(I.getOperand(i), InstID, Vals, VE); + break; + case Instruction::InsertValue: + Code = bitc::FUNC_CODE_INST_INSERTVAL; + for (unsigned i = 0, e = I.getNumOperands(); i != e; ++i) + PushValueAndType(I.getOperand(i), InstID, Vals, VE); + break; case Instruction::Select: Code = bitc::FUNC_CODE_INST_SELECT; PushValueAndType(I.getOperand(1), InstID, Vals, VE); -- cgit v1.2.3-18-g5258