aboutsummaryrefslogtreecommitdiff
path: root/lib/Bitcode/NaCl/Writer/NaClBitcodeWriter.cpp
diff options
context:
space:
mode:
authorMark Seaborn <mseaborn@chromium.org>2013-09-06 15:34:50 -0700
committerMark Seaborn <mseaborn@chromium.org>2013-09-06 15:34:50 -0700
commit083eeaf1e9fc4e929b8f805deb4d3d3d0be038fc (patch)
tree8458b12bd1b72f3746e81d16ef475dc0b5f2e473 /lib/Bitcode/NaCl/Writer/NaClBitcodeWriter.cpp
parent68cb3f7eca7536d85301f92314dbb5db6757cd94 (diff)
PNaCl bitcode: Use function type not ptr-to-function type to declare function
This is a step towards removing TYPE_CODE_POINTER from the types table. This will make the format simpler. It will also make bitcode files a little smaller, because we won't need to use type IDs for referring to pointer types. BUG=https://code.google.com/p/nativeclient/issues/detail?id=3671 TEST=test/NaCl/Bitcode/*.ll Review URL: https://codereview.chromium.org/24049002
Diffstat (limited to 'lib/Bitcode/NaCl/Writer/NaClBitcodeWriter.cpp')
-rw-r--r--lib/Bitcode/NaCl/Writer/NaClBitcodeWriter.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/Bitcode/NaCl/Writer/NaClBitcodeWriter.cpp b/lib/Bitcode/NaCl/Writer/NaClBitcodeWriter.cpp
index 3355bc757c..6280e5ccfc 100644
--- a/lib/Bitcode/NaCl/Writer/NaClBitcodeWriter.cpp
+++ b/lib/Bitcode/NaCl/Writer/NaClBitcodeWriter.cpp
@@ -418,7 +418,10 @@ static void WriteModuleInfo(const Module *M, const NaClValueEnumerator &VE,
SmallVector<unsigned, 64> Vals;
for (Module::const_iterator F = M->begin(), E = M->end(); F != E; ++F) {
// FUNCTION: [type, callingconv, isproto, linkage]
- Vals.push_back(VE.getTypeID(F->getType()));
+ Type *Ty = F->getType();
+ if (PNaClVersion >= 2)
+ Ty = Ty->getPointerElementType();
+ Vals.push_back(VE.getTypeID(Ty));
Vals.push_back(GetEncodedCallingConv(F->getCallingConv()));
Vals.push_back(F->isDeclaration());
Vals.push_back(getEncodedLinkage(F));