aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2008-05-23 01:55:30 +0000
committerDan Gohman <gohman@apple.com>2008-05-23 01:55:30 +0000
commit30499844ead34cae1687c3fb2cb697a695a38db2 (patch)
treee4ed6d258fb8c12ad953a3352bbdb7275829dac3 /llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
parent53b2698531719c987822f8352844a23ab2d8c9d8 (diff)
downloadllvm-30499844ead34cae1687c3fb2cb697a695a38db2.zip
llvm-30499844ead34cae1687c3fb2cb697a695a38db2.tar.gz
llvm-30499844ead34cae1687c3fb2cb697a695a38db2.tar.bz2
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. llvm-svn: 51468
Diffstat (limited to 'llvm/lib/Bitcode/Writer/BitcodeWriter.cpp')
-rw-r--r--llvm/lib/Bitcode/Writer/BitcodeWriter.cpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp b/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
index ad651d3..cb5963c 100644
--- a/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
+++ b/llvm/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);