aboutsummaryrefslogtreecommitdiff
path: root/lib/Bitcode/NaCl/Reader/NaClBitcodeReader.h
diff options
context:
space:
mode:
authorJan Voung <jvoung@chromium.org>2013-11-20 13:21:04 -0800
committerJan Voung <jvoung@chromium.org>2013-11-20 13:21:04 -0800
commit32885ab95b44df7f2a3ace9ac7d227df9d648d46 (patch)
treee6f9abb43225b877f97819d0333a5956d4bc7074 /lib/Bitcode/NaCl/Reader/NaClBitcodeReader.h
parenta4504c6f116760d6c0f9f920bb755c3d0136f6c6 (diff)
Remove UseRelativeID branching from NaClBitcodeReader, assume true.
This was kept in upstream LLVM for backwards compatibiilty with version 0 bitcode, but PNaCl only accepts version 1 bitcode, so UseRelativeID is always true. This reduces the number of branches taken while llvm-dis'ing the Ogre SampleBrowser from 2,680,184,988 branches to 2,670,798,955 branches. A 2.5% difference in wall-clock time... BUG=none trybots: http://chromegw.corp.google.com/i/tryserver.nacl/builders/nacl-toolchain-linux-pnacl-x86_32/builds/939 http://chromegw.corp.google.com/i/tryserver.nacl/builders/nacl-toolchain-linux-pnacl-x86_64/builds/991 http://chromegw.corp.google.com/i/tryserver.nacl/builders/nacl-toolchain-mac-pnacl-x86_32/builds/933 R=mseaborn@chromium.org Review URL: https://codereview.chromium.org/77023007
Diffstat (limited to 'lib/Bitcode/NaCl/Reader/NaClBitcodeReader.h')
-rw-r--r--lib/Bitcode/NaCl/Reader/NaClBitcodeReader.h32
1 files changed, 9 insertions, 23 deletions
diff --git a/lib/Bitcode/NaCl/Reader/NaClBitcodeReader.h b/lib/Bitcode/NaCl/Reader/NaClBitcodeReader.h
index b6cf9fab80..2e2816f0f1 100644
--- a/lib/Bitcode/NaCl/Reader/NaClBitcodeReader.h
+++ b/lib/Bitcode/NaCl/Reader/NaClBitcodeReader.h
@@ -188,15 +188,6 @@ class NaClBitcodeReader : public GVMaterializer {
/// stream.
DenseMap<Function*, uint64_t> DeferredFunctionInfo;
- /// UseRelativeIDs - Indicates that we are using a new encoding for
- /// instruction operands where most operands in the current
- /// FUNCTION_BLOCK are encoded relative to the instruction number,
- /// for a more compact encoding. Some instruction operands are not
- /// relative to the instruction ID: basic block numbers, and types.
- /// Once the old style function blocks have been phased out, we would
- /// not need this flag.
- bool UseRelativeIDs;
-
/// \brief True if we should only accept supported bitcode format.
bool AcceptSupportedBitcodeOnly;
@@ -209,7 +200,7 @@ public:
: Context(C), TheModule(0), Buffer(buffer), BufferOwned(false),
LazyStreamer(0), NextUnreadBit(0), SeenValueSymbolTable(false),
ValueList(C),
- SeenFirstFunctionBody(false), UseRelativeIDs(false),
+ SeenFirstFunctionBody(false),
AcceptSupportedBitcodeOnly(AcceptSupportedOnly),
IntPtrType(IntegerType::get(C, PNaClIntPtrTypeBitSize)) {
}
@@ -218,7 +209,7 @@ public:
: Context(C), TheModule(0), Buffer(0), BufferOwned(false),
LazyStreamer(streamer), NextUnreadBit(0), SeenValueSymbolTable(false),
ValueList(C),
- SeenFirstFunctionBody(false), UseRelativeIDs(false),
+ SeenFirstFunctionBody(false),
AcceptSupportedBitcodeOnly(AcceptSupportedOnly),
IntPtrType(IntegerType::get(C, PNaClIntPtrTypeBitSize)) {
}
@@ -274,10 +265,8 @@ private:
bool popValue(const SmallVector<uint64_t, 64> &Record, unsigned *Slot,
unsigned InstNum, Value **ResVal) {
if (*Slot == Record.size()) return true;
- unsigned ValNo = (unsigned)Record[(*Slot)++];
- // Adjust the ValNo, if it was encoded relative to the InstNum.
- if (UseRelativeIDs)
- ValNo = InstNum - ValNo;
+ // ValNo is encoded relative to the InstNum.
+ unsigned ValNo = InstNum - (unsigned)Record[(*Slot)++];
*ResVal = getFnValueByID(ValNo);
return *ResVal == 0;
}
@@ -287,10 +276,8 @@ private:
Value *getValue(const SmallVector<uint64_t, 64> &Record, unsigned Slot,
unsigned InstNum) {
if (Slot == Record.size()) return 0;
- unsigned ValNo = (unsigned)Record[Slot];
- // Adjust the ValNo, if it was encoded relative to the InstNum.
- if (UseRelativeIDs)
- ValNo = InstNum - ValNo;
+ // ValNo is encoded relative to the InstNum.
+ unsigned ValNo = InstNum - (unsigned)Record[Slot];
return getFnValueByID(ValNo);
}
@@ -298,10 +285,9 @@ private:
Value *getValueSigned(const SmallVector<uint64_t, 64> &Record, unsigned Slot,
unsigned InstNum) {
if (Slot == Record.size()) return 0;
- unsigned ValNo = (unsigned) NaClDecodeSignRotatedValue(Record[Slot]);
- // Adjust the ValNo, if it was encoded relative to the InstNum.
- if (UseRelativeIDs)
- ValNo = InstNum - ValNo;
+ // ValNo is encoded relative to the InstNum.
+ unsigned ValNo = InstNum -
+ (unsigned) NaClDecodeSignRotatedValue(Record[Slot]);
return getFnValueByID(ValNo);
}