diff options
author | Chris Lattner <sabre@nondot.org> | 2007-05-06 01:28:01 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2007-05-06 01:28:01 +0000 |
commit | 94687acd21209d4b9de72c42643d08a6f73e4050 (patch) | |
tree | ac6e72a8b0507829daa8cef4255540ada2293c7c /lib/Bitcode/Writer | |
parent | 7a303d1591ef1b2d087dd863f2f058d30fcf7830 (diff) | |
download | external_llvm-94687acd21209d4b9de72c42643d08a6f73e4050.zip external_llvm-94687acd21209d4b9de72c42643d08a6f73e4050.tar.gz external_llvm-94687acd21209d4b9de72c42643d08a6f73e4050.tar.bz2 |
add some abbrevs for ret and unreachable, shrinking kc++ from 2717360->2705388
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36823 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Bitcode/Writer')
-rw-r--r-- | lib/Bitcode/Writer/BitcodeWriter.cpp | 34 |
1 files changed, 31 insertions, 3 deletions
diff --git a/lib/Bitcode/Writer/BitcodeWriter.cpp b/lib/Bitcode/Writer/BitcodeWriter.cpp index 92475fc..8e1c4d2 100644 --- a/lib/Bitcode/Writer/BitcodeWriter.cpp +++ b/lib/Bitcode/Writer/BitcodeWriter.cpp @@ -43,7 +43,10 @@ enum { 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 @@ static void WriteInstruction(const Instruction &I, unsigned InstID, 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 @@ static void WriteInstruction(const Instruction &I, unsigned InstID, break; case Instruction::Unreachable: Code = bitc::FUNC_CODE_INST_UNREACHABLE; + AbbrevToUse = FUNCTION_INST_UNREACHABLE_ABBREV; break; case Instruction::PHI: @@ -1056,6 +1062,28 @@ static void WriteBlockInfo(const ValueEnumerator &VE, BitstreamWriter &Stream) { 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(); } |