Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(45)

Unified Diff: src/IceConverter.cpp

Issue 737513008: Subzero: Simplify the constant pools. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: More cleanup Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/IceGlobalContext.h » ('j') | src/IceGlobalContext.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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());
« no previous file with comments | « no previous file | src/IceGlobalContext.h » ('j') | src/IceGlobalContext.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698