Chromium Code Reviews| 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); |
| +} |
| + |
| 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); |
|
Jim Stichnoth
2014/06/27 18:30:16
I don't understand why Zeros is defined with 16 el
wala
2014/06/27 21:09:19
A BitVect, unlike a Vect128, can have a differing
|
| + 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(); |
| + case IceType_v16i8: |
| + case IceType_v8i16: |
| + case IceType_v4i32: |
| + case IceType_v4f32: |
| + return ConstPool->Vectors.getConstantPool(); |
| case IceType_void: |
| case IceType_NUM: |
| break; |