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

Unified Diff: src/IceGlobalContext.cpp

Issue 353553004: Add support for vector types and vector constants. (Closed) Base URL: https://gerrit.chromium.org/gerrit/p/native_client/pnacl-subzero.git@master
Patch Set: 1) Remove StringList. 2) Assign redundant assign TODO to stichnot. 3) Fix RUN line. Created 6 years, 6 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
Index: src/IceGlobalContext.cpp
diff --git a/src/IceGlobalContext.cpp b/src/IceGlobalContext.cpp
index 7e89a41dad133960ff7cacc24735b61fc25f6e28..e6af0d00de8d3dca5d933bc044a391e71bf2bf37 100644
--- a/src/IceGlobalContext.cpp
+++ b/src/IceGlobalContext.cpp
@@ -108,6 +108,8 @@ public:
TypePool<float, ConstantFloat, true> Floats;
TypePool<double, ConstantDouble, true> Doubles;
TypePool<uint64_t, ConstantInteger> Integers;
+ TypePool<Vect128, ConstantVector> Vectors;
+ TypePool<BitVect, ConstantBitVector> BitVectors;
TypePool<RelocatableTuple, ConstantRelocatable> Relocatables;
UndefPool Undefs;
};
@@ -209,6 +211,14 @@ Constant *GlobalContext::getConstantDouble(double ConstantDouble) {
return ConstPool->Doubles.getOrAdd(this, IceType_f64, ConstantDouble);
}
+Constant *GlobalContext::getConstantVector(Type Ty, const Vect128 &Vector) {
+ return ConstPool->Vectors.getOrAdd(this, Ty, Vector);
+}
+
+Constant *GlobalContext::getConstantBitVector(Type Ty, const BitVect &Vector) {
+ return ConstPool->BitVectors.getOrAdd(this, Ty, Vector);
+}
JF 2014/06/30 17:48:50 You should never have constant <? x i1> bit vector
wala 2014/06/30 22:13:24 See comment in llvm2ice.cpp. In addition, undefs
+
Constant *GlobalContext::getConstantSym(Type Ty, int64_t Offset,
const IceString &Name,
bool SuppressMangling) {
@@ -232,6 +242,19 @@ Constant *GlobalContext::getConstantZero(Type Ty) {
return getConstantFloat(0);
case IceType_f64:
return getConstantDouble(0);
+ case IceType_v4i1:
+ case IceType_v8i1:
+ case IceType_v16i1: {
+ BitVect Zeros(typeNumElements(Ty));
+ return getConstantBitVector(Ty, Zeros);
+ }
+ case IceType_v16i8:
+ case IceType_v8i16:
+ case IceType_v4i32:
+ case IceType_v4f32: {
+ Vect128 Zeros(16);
+ return getConstantVector(Ty, Zeros);
+ }
case IceType_void:
case IceType_NUM:
break;
@@ -251,6 +274,15 @@ ConstantList GlobalContext::getConstantPool(Type Ty) const {
return ConstPool->Floats.getConstantPool();
case IceType_f64:
return ConstPool->Doubles.getConstantPool();
+ case IceType_v4i1:
+ case IceType_v8i1:
+ case IceType_v16i1:
+ return ConstPool->BitVectors.getConstantPool();
JF 2014/06/30 17:48:50 Same comment, this shouldn't happen.
wala 2014/06/30 22:13:24 Done.
+ case IceType_v16i8:
+ case IceType_v8i16:
+ case IceType_v4i32:
+ case IceType_v4f32:
+ return ConstPool->Vectors.getConstantPool();
case IceType_void:
case IceType_NUM:
break;

Powered by Google App Engine
This is Rietveld 408576698