[llvm-commits] CVS: llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
Chris Lattner
sabre at nondot.org
Sat May 5 18:28:18 PDT 2007
Changes in directory llvm/lib/Bitcode/Writer:
BitcodeWriter.cpp updated: 1.46 -> 1.47
---
Log message:
add some abbrevs for ret and unreachable, shrinking kc++ from 2717360->2705388
---
Diffs of the changes: (+31 -3)
BitcodeWriter.cpp | 34 +++++++++++++++++++++++++++++++---
1 files changed, 31 insertions(+), 3 deletions(-)
Index: llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
diff -u llvm/lib/Bitcode/Writer/BitcodeWriter.cpp:1.46 llvm/lib/Bitcode/Writer/BitcodeWriter.cpp:1.47
--- llvm/lib/Bitcode/Writer/BitcodeWriter.cpp:1.46 Sat May 5 19:53:07 2007
+++ llvm/lib/Bitcode/Writer/BitcodeWriter.cpp Sat May 5 20:28:01 2007
@@ -43,7 +43,10 @@
CONSTANTS_NULL_Abbrev,
// FUNCTION_BLOCK abbrev id's.
- FUNCTION_INST_LOAD_ABBREV = bitc::FIRST_APPLICATION_ABBREV
+ FUNCTION_INST_LOAD_ABBREV = bitc::FIRST_APPLICATION_ABBREV,
+ FUNCTION_INST_RET_VOID_ABBREV,
+ FUNCTION_INST_RET_VAL_ABBREV,
+ FUNCTION_INST_UNREACHABLE_ABBREV
};
@@ -697,8 +700,10 @@
case Instruction::Ret:
Code = bitc::FUNC_CODE_INST_RET;
- if (I.getNumOperands())
- PushValueAndType(I.getOperand(0), InstID, Vals, VE);
+ if (!I.getNumOperands())
+ AbbrevToUse = FUNCTION_INST_RET_VOID_ABBREV;
+ else if (!PushValueAndType(I.getOperand(0), InstID, Vals, VE))
+ AbbrevToUse = FUNCTION_INST_RET_VAL_ABBREV;
break;
case Instruction::Br:
Code = bitc::FUNC_CODE_INST_BR;
@@ -740,6 +745,7 @@
break;
case Instruction::Unreachable:
Code = bitc::FUNC_CODE_INST_UNREACHABLE;
+ AbbrevToUse = FUNCTION_INST_UNREACHABLE_ABBREV;
break;
case Instruction::PHI:
@@ -1056,6 +1062,28 @@
Abbv) != FUNCTION_INST_LOAD_ABBREV)
assert(0 && "Unexpected abbrev ordering!");
}
+ { // INST_RET abbrev for FUNCTION_BLOCK.
+ BitCodeAbbrev *Abbv = new BitCodeAbbrev();
+ Abbv->Add(BitCodeAbbrevOp(bitc::FUNC_CODE_INST_RET));
+ if (Stream.EmitBlockInfoAbbrev(bitc::FUNCTION_BLOCK_ID,
+ Abbv) != FUNCTION_INST_RET_VOID_ABBREV)
+ assert(0 && "Unexpected abbrev ordering!");
+ }
+ { // INST_RET abbrev for FUNCTION_BLOCK.
+ BitCodeAbbrev *Abbv = new BitCodeAbbrev();
+ Abbv->Add(BitCodeAbbrevOp(bitc::FUNC_CODE_INST_RET));
+ Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // ValID
+ if (Stream.EmitBlockInfoAbbrev(bitc::FUNCTION_BLOCK_ID,
+ Abbv) != FUNCTION_INST_RET_VAL_ABBREV)
+ assert(0 && "Unexpected abbrev ordering!");
+ }
+ { // INST_UNREACHABLE abbrev for FUNCTION_BLOCK.
+ BitCodeAbbrev *Abbv = new BitCodeAbbrev();
+ Abbv->Add(BitCodeAbbrevOp(bitc::FUNC_CODE_INST_UNREACHABLE));
+ if (Stream.EmitBlockInfoAbbrev(bitc::FUNCTION_BLOCK_ID,
+ Abbv) != FUNCTION_INST_UNREACHABLE_ABBREV)
+ assert(0 && "Unexpected abbrev ordering!");
+ }
Stream.ExitBlock();
}
More information about the llvm-commits
mailing list