Index: src/IceConverter.cpp |
diff --git a/src/IceConverter.cpp b/src/IceConverter.cpp |
index 3c46496b70e656f0bdd61c6bb9691b3565575791..4682d092587e8f5d57b7458b60db7fa9b0f464b4 100644 |
--- a/src/IceConverter.cpp |
+++ b/src/IceConverter.cpp |
@@ -116,15 +116,24 @@ public: |
if (const auto GV = dyn_cast<GlobalValue>(Const)) { |
Ice::GlobalDeclaration *Decl = getConverter().getGlobalDeclaration(GV); |
const Ice::RelocOffsetT Offset = 0; |
- return Ctx->getConstantSym(TypeConverter.getIcePointerType(), |
- Offset, Decl->getName(), |
+ return Ctx->getConstantSym(Offset, Decl->getName(), |
Decl->getSuppressMangling()); |
} else if (const auto CI = dyn_cast<ConstantInt>(Const)) { |
Ice::Type Ty = convertToIceType(CI->getType()); |
- if (Ty == Ice::IceType_i64) { |
- return Ctx->getConstantInt64(Ty, CI->getSExtValue()); |
- } else { |
- return Ctx->getConstantInt32(Ty, CI->getSExtValue()); |
+ switch (Ty) { |
Karl
2014/11/19 18:45:28
Why not move this switch into IceGlobalcontext.{h,
Jim Stichnoth
2014/11/20 00:08:57
Done.
|
+ default: |
+ llvm_unreachable("Unhandled constant integer type"); |
+ return nullptr; |
+ case Ice::IceType_i1: |
+ return Ctx->getConstantInt1(CI->getSExtValue()); |
+ case Ice::IceType_i8: |
+ return Ctx->getConstantInt8(CI->getSExtValue()); |
+ case Ice::IceType_i16: |
+ return Ctx->getConstantInt16(CI->getSExtValue()); |
+ case Ice::IceType_i32: |
+ return Ctx->getConstantInt32(CI->getSExtValue()); |
+ case Ice::IceType_i64: |
+ return Ctx->getConstantInt64(CI->getSExtValue()); |
} |
} else if (const auto CFP = dyn_cast<ConstantFP>(Const)) { |
Ice::Type Type = convertToIceType(CFP->getType()); |