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

Unified Diff: src/IceGlobalContext.cpp

Issue 476323004: Start adding an integrated assembler. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: make fixups part of address Created 6 years, 3 months 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 | « src/IceGlobalContext.h ('k') | src/IceInst.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/IceGlobalContext.cpp
diff --git a/src/IceGlobalContext.cpp b/src/IceGlobalContext.cpp
index f3982554bdd9902c28c45a016022a7dfaae185b9..805a342dfb74ecd4c5c33ef34c7437eda35de5b4 100644
--- a/src/IceGlobalContext.cpp
+++ b/src/IceGlobalContext.cpp
@@ -109,7 +109,8 @@ public:
ConstantPool() {}
TypePool<float, ConstantFloat, true> Floats;
TypePool<double, ConstantDouble, true> Doubles;
- TypePool<uint64_t, ConstantInteger> Integers;
+ TypePool<uint32_t, ConstantInteger32> Integers32;
+ TypePool<uint64_t, ConstantInteger64> Integers64;
TypePool<RelocatableTuple, ConstantRelocatable> Relocatables;
UndefPool Undefs;
};
@@ -289,10 +290,15 @@ IceString GlobalContext::mangleName(const IceString &Name) const {
GlobalContext::~GlobalContext() {}
-Constant *GlobalContext::getConstantInt(Type Ty, uint64_t ConstantInt64) {
+Constant *GlobalContext::getConstantInt64(Type Ty, uint64_t ConstantInt64) {
+ assert(Ty == IceType_i64);
+ return ConstPool->Integers64.getOrAdd(this, Ty, ConstantInt64);
+}
+
+Constant *GlobalContext::getConstantInt32(Type Ty, uint32_t ConstantInt32) {
if (Ty == IceType_i1)
- ConstantInt64 &= UINT64_C(1);
- return ConstPool->Integers.getOrAdd(this, Ty, ConstantInt64);
+ ConstantInt32 &= UINT32_C(1);
+ return ConstPool->Integers32.getOrAdd(this, Ty, ConstantInt32);
}
Constant *GlobalContext::getConstantFloat(float ConstantFloat) {
@@ -320,8 +326,9 @@ Constant *GlobalContext::getConstantZero(Type Ty) {
case IceType_i8:
case IceType_i16:
case IceType_i32:
+ return getConstantInt32(Ty, 0);
case IceType_i64:
- return getConstantInt(Ty, 0);
+ return getConstantInt64(Ty, 0);
case IceType_f32:
return getConstantFloat(0);
case IceType_f64:
@@ -351,8 +358,9 @@ ConstantList GlobalContext::getConstantPool(Type Ty) const {
case IceType_i8:
case IceType_i16:
case IceType_i32:
+ return ConstPool->Integers32.getConstantPool();
case IceType_i64:
- return ConstPool->Integers.getConstantPool();
+ return ConstPool->Integers64.getConstantPool();
case IceType_f32:
return ConstPool->Floats.getConstantPool();
case IceType_f64:
« no previous file with comments | « src/IceGlobalContext.h ('k') | src/IceInst.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698