aboutsummaryrefslogtreecommitdiff
path: root/lib/Bitcode/NaCl/Writer/NaClValueEnumerator.cpp
diff options
context:
space:
mode:
authorMark Seaborn <mseaborn@chromium.org>2013-09-09 10:06:19 -0700
committerMark Seaborn <mseaborn@chromium.org>2013-09-09 10:06:19 -0700
commit1c0cea6c1fc807794f0d785392e05b19d0c70210 (patch)
tree46f959c795c6b5314d723e3264ccab02f359e5df /lib/Bitcode/NaCl/Writer/NaClValueEnumerator.cpp
parent9ca910d4038b63e416311f7c4122de25c15cc5b0 (diff)
PNaCl bitcode: Change FORWARDTYPEREF to never use pointer types
Before, FORWARDTYPEREFs used i8* type rather than i32 if they referenced an "alloca" instruction. Clean this up so that FORWARDTYPEREFs use i32 instead in this case. Note that this means that a forward-referenced "alloca" can be used via an ptrtoint+inttoptr, rather than a bitcast, but that's no problem. This is a step towards removing TYPE_CODE_POINTER from the types table, to simplify the PNaCl bitcode format. Rename NormalizeParamType() to NormalizeScalarType() to reflect that it's used in more cases; make it public. BUG=https://code.google.com/p/nativeclient/issues/detail?id=3671 TEST=test/NaCl/Bitcode/*.ll Review URL: https://codereview.chromium.org/23719016
Diffstat (limited to 'lib/Bitcode/NaCl/Writer/NaClValueEnumerator.cpp')
-rw-r--r--lib/Bitcode/NaCl/Writer/NaClValueEnumerator.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/Bitcode/NaCl/Writer/NaClValueEnumerator.cpp b/lib/Bitcode/NaCl/Writer/NaClValueEnumerator.cpp
index ca34ac9c77..cabdc420c6 100644
--- a/lib/Bitcode/NaCl/Writer/NaClValueEnumerator.cpp
+++ b/lib/Bitcode/NaCl/Writer/NaClValueEnumerator.cpp
@@ -298,7 +298,7 @@ void NaClValueEnumerator::EnumerateValue(const Value *VIn) {
}
-Type *NaClValueEnumerator::NormalizeParamType(Type *Ty) const {
+Type *NaClValueEnumerator::NormalizeScalarType(Type *Ty) const {
// Strip pointer types.
if (Ty->isPointerTy() && PNaClVersion >= 2)
Ty = IntPtrType;
@@ -309,8 +309,8 @@ Type *NaClValueEnumerator::NormalizeType(Type *Ty) const {
if (FunctionType *FTy = dyn_cast<FunctionType>(Ty)) {
SmallVector<Type *, 8> ArgTypes;
for (unsigned I = 0, E = FTy->getNumParams(); I < E; ++I)
- ArgTypes.push_back(NormalizeParamType(FTy->getParamType(I)));
- Ty = FunctionType::get(NormalizeParamType(FTy->getReturnType()),
+ ArgTypes.push_back(NormalizeScalarType(FTy->getParamType(I)));
+ Ty = FunctionType::get(NormalizeScalarType(FTy->getReturnType()),
ArgTypes, false);
}
return Ty;