aboutsummaryrefslogtreecommitdiff
path: root/lib/Bitcode/Writer/BitcodeWriter.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-10-28 05:14:34 +0000
committerChris Lattner <sabre@nondot.org>2009-10-28 05:14:34 +0000
commit0eeb913aa17a68b1f2963b02ca1d68f09dba0b78 (patch)
tree59af809ede34a9dd1b0bd71d65537f2787b08ebe /lib/Bitcode/Writer/BitcodeWriter.cpp
parent46b3abc9f759ed4bbf88be611cc577b21a8ffa8b (diff)
Previously, all operands to Constant were themselves constant.
In the new world order, BlockAddress can have a BasicBlock operand. This doesn't permute much, because if you have a ConstantExpr (or anything more specific than Constant) we still know the operand has to be a Constant. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85375 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Bitcode/Writer/BitcodeWriter.cpp')
-rw-r--r--lib/Bitcode/Writer/BitcodeWriter.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/Bitcode/Writer/BitcodeWriter.cpp b/lib/Bitcode/Writer/BitcodeWriter.cpp
index 692c289b83..98f782ff5b 100644
--- a/lib/Bitcode/Writer/BitcodeWriter.cpp
+++ b/lib/Bitcode/Writer/BitcodeWriter.cpp
@@ -751,10 +751,11 @@ static void WriteConstants(unsigned FirstVal, unsigned LastVal,
assert (0 && "Unknown FP type!");
}
} else if (isa<ConstantArray>(C) && cast<ConstantArray>(C)->isString()) {
+ const ConstantArray *CA = cast<ConstantArray>(C);
// Emit constant strings specially.
- unsigned NumOps = C->getNumOperands();
+ unsigned NumOps = CA->getNumOperands();
// If this is a null-terminated string, use the denser CSTRING encoding.
- if (C->getOperand(NumOps-1)->isNullValue()) {
+ if (CA->getOperand(NumOps-1)->isNullValue()) {
Code = bitc::CST_CODE_CSTRING;
--NumOps; // Don't encode the null, which isn't allowed by char6.
} else {
@@ -764,7 +765,7 @@ static void WriteConstants(unsigned FirstVal, unsigned LastVal,
bool isCStr7 = Code == bitc::CST_CODE_CSTRING;
bool isCStrChar6 = Code == bitc::CST_CODE_CSTRING;
for (unsigned i = 0; i != NumOps; ++i) {
- unsigned char V = cast<ConstantInt>(C->getOperand(i))->getZExtValue();
+ unsigned char V = cast<ConstantInt>(CA->getOperand(i))->getZExtValue();
Record.push_back(V);
isCStr7 &= (V & 128) == 0;
if (isCStrChar6)