aboutsummaryrefslogtreecommitdiff
path: root/lib/Bitcode/NaCl/Reader/NaClBitcodeReader.h
diff options
context:
space:
mode:
authorMark Seaborn <mseaborn@chromium.org>2013-06-26 11:04:18 -0700
committerMark Seaborn <mseaborn@chromium.org>2013-06-26 11:04:18 -0700
commitafa589d27ad90bcfebae9566dd31785d4ba9696f (patch)
tree30786f10784974d898c902ecda02c8ee2f409831 /lib/Bitcode/NaCl/Reader/NaClBitcodeReader.h
parent69aca3260c03ec742256b5518886f0562a658df2 (diff)
PNaCl wire format: Use FORWARDTYPEREF consistently for all forward references
Before this change, the writer would only emit FORWARDTYPEREF for some operands, e.g. the first operand of BINOP but not the second, on the grounds that the type of the second operand can be inferred. However, that makes the format complicated. Change the writer so that it always emits FORWARDTYPEREF for a forward ref. This unifies PushValueAndType() and pushValue(). pushValue() gains a call to EmitFnForwardTypeRef() so becomes the same as PushValueAndType(). Change the reader to be stricter, so that it requires a FORWARDTYPEREF to have been emitted in most cases. This is done by ignoring the implied type argument. Tasks still remaining: * Make reader stricter so that multiple FORWARDTYPEREFs are disallowed. * Remove now-unused Type arguments in the reader. BUG=https://code.google.com/p/nativeclient/issues/detail?id=3507 TEST=new llvm-lit test + PNaCl toolchain trybots Review URL: https://codereview.chromium.org/17806003
Diffstat (limited to 'lib/Bitcode/NaCl/Reader/NaClBitcodeReader.h')
-rw-r--r--lib/Bitcode/NaCl/Reader/NaClBitcodeReader.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/Bitcode/NaCl/Reader/NaClBitcodeReader.h b/lib/Bitcode/NaCl/Reader/NaClBitcodeReader.h
index 57757e7ded..e6ea6266be 100644
--- a/lib/Bitcode/NaCl/Reader/NaClBitcodeReader.h
+++ b/lib/Bitcode/NaCl/Reader/NaClBitcodeReader.h
@@ -297,6 +297,7 @@ private:
/// getValue -- Version of getValue that returns ResVal directly,
/// or 0 if there is an error.
+ /// TODO(mseaborn): Remove the unused Type argument from this function.
Value *getValue(SmallVector<uint64_t, 64> &Record, unsigned Slot,
unsigned InstNum, Type *Ty) {
if (Slot == Record.size()) return 0;
@@ -304,10 +305,11 @@ private:
// Adjust the ValNo, if it was encoded relative to the InstNum.
if (UseRelativeIDs)
ValNo = InstNum - ValNo;
- return getOrCreateFnValueByID(ValNo, Ty);
+ return getFnValueByID(ValNo);
}
/// getValueSigned -- Like getValue, but decodes signed VBRs.
+ /// TODO(mseaborn): Remove the unused Type argument from this function.
Value *getValueSigned(SmallVector<uint64_t, 64> &Record, unsigned Slot,
unsigned InstNum, Type *Ty) {
if (Slot == Record.size()) return 0;
@@ -315,7 +317,7 @@ private:
// Adjust the ValNo, if it was encoded relative to the InstNum.
if (UseRelativeIDs)
ValNo = InstNum - ValNo;
- return getOrCreateFnValueByID(ValNo, Ty);
+ return getFnValueByID(ValNo);
}
bool ParseModule(bool Resume);