aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/CodeGen/CGValue.h
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib/CodeGen/CGValue.h')
-rw-r--r--clang/lib/CodeGen/CGValue.h38
1 files changed, 35 insertions, 3 deletions
diff --git a/clang/lib/CodeGen/CGValue.h b/clang/lib/CodeGen/CGValue.h
index 9fd07bdb187d..70e6fed3f4f6 100644
--- a/clang/lib/CodeGen/CGValue.h
+++ b/clang/lib/CodeGen/CGValue.h
@@ -170,7 +170,8 @@ class LValue {
VectorElt, // This is a vector element l-value (V[i]), use getVector*
BitField, // This is a bitfield l-value, use getBitfield*.
ExtVectorElt, // This is an extended vector subset, use getExtVectorComp
- GlobalReg // This is a register l-value, use getGlobalReg()
+ GlobalReg, // This is a register l-value, use getGlobalReg()
+ MatrixElt // This is a matrix element, use getVector*
} LVType;
llvm::Value *V;
@@ -254,6 +255,7 @@ public:
bool isBitField() const { return LVType == BitField; }
bool isExtVectorElt() const { return LVType == ExtVectorElt; }
bool isGlobalReg() const { return LVType == GlobalReg; }
+ bool isMatrixElt() const { return LVType == MatrixElt; }
bool isVolatileQualified() const { return Quals.hasVolatile(); }
bool isRestrictQualified() const { return Quals.hasRestrict(); }
@@ -337,8 +339,26 @@ public:
Address getVectorAddress() const {
return Address(getVectorPointer(), getAlignment());
}
- llvm::Value *getVectorPointer() const { assert(isVectorElt()); return V; }
- llvm::Value *getVectorIdx() const { assert(isVectorElt()); return VectorIdx; }
+ llvm::Value *getVectorPointer() const {
+ assert(isVectorElt());
+ return V;
+ }
+ llvm::Value *getVectorIdx() const {
+ assert(isVectorElt());
+ return VectorIdx;
+ }
+
+ Address getMatrixAddress() const {
+ return Address(getMatrixPointer(), getAlignment());
+ }
+ llvm::Value *getMatrixPointer() const {
+ assert(isMatrixElt());
+ return V;
+ }
+ llvm::Value *getMatrixIdx() const {
+ assert(isMatrixElt());
+ return VectorIdx;
+ }
// extended vector elements.
Address getExtVectorAddress() const {
@@ -430,6 +450,18 @@ public:
return R;
}
+ static LValue MakeMatrixElt(Address matAddress, llvm::Value *Idx,
+ QualType type, LValueBaseInfo BaseInfo,
+ TBAAAccessInfo TBAAInfo) {
+ LValue R;
+ R.LVType = MatrixElt;
+ R.V = matAddress.getPointer();
+ R.VectorIdx = Idx;
+ R.Initialize(type, type.getQualifiers(), matAddress.getAlignment(),
+ BaseInfo, TBAAInfo);
+ return R;
+ }
+
RValue asAggregateRValue(CodeGenFunction &CGF) const {
return RValue::getAggregate(getAddress(CGF), isVolatileQualified());
}