OCUVector -> ExtVector, shorthand for extended vector, per feedback from Chris.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49942 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/CodeGen/CGExpr.cpp b/lib/CodeGen/CGExpr.cpp
index 5714f3c..3c1ab74 100644
--- a/lib/CodeGen/CGExpr.cpp
+++ b/lib/CodeGen/CGExpr.cpp
@@ -103,8 +103,8 @@
return EmitUnaryOpLValue(cast<UnaryOperator>(E));
case Expr::ArraySubscriptExprClass:
return EmitArraySubscriptExpr(cast<ArraySubscriptExpr>(E));
- case Expr::OCUVectorElementExprClass:
- return EmitOCUVectorElementExpr(cast<OCUVectorElementExpr>(E));
+ case Expr::ExtVectorElementExprClass:
+ return EmitExtVectorElementExpr(cast<ExtVectorElementExpr>(E));
case Expr::MemberExprClass: return EmitMemberExpr(cast<MemberExpr>(E));
}
}
@@ -143,8 +143,8 @@
// If this is a reference to a subset of the elements of a vector, either
// shuffle the input or extract/insert them as appropriate.
- if (LV.isOCUVectorElt())
- return EmitLoadOfOCUElementLValue(LV, ExprType);
+ if (LV.isExtVectorElt())
+ return EmitLoadOfExtVectorElementLValue(LV, ExprType);
if (LV.isBitfield())
return EmitLoadOfBitfieldLValue(LV, ExprType);
@@ -178,17 +178,17 @@
// If this is a reference to a subset of the elements of a vector, either
// shuffle the input or extract/insert them as appropriate.
-RValue CodeGenFunction::EmitLoadOfOCUElementLValue(LValue LV,
- QualType ExprType) {
- llvm::Value *Vec = Builder.CreateLoad(LV.getOCUVectorAddr(), "tmp");
+RValue CodeGenFunction::EmitLoadOfExtVectorElementLValue(LValue LV,
+ QualType ExprType) {
+ llvm::Value *Vec = Builder.CreateLoad(LV.getExtVectorAddr(), "tmp");
- unsigned EncFields = LV.getOCUVectorElts();
+ unsigned EncFields = LV.getExtVectorElts();
// If the result of the expression is a non-vector type, we must be
// extracting a single element. Just codegen as an extractelement.
const VectorType *ExprVT = ExprType->getAsVectorType();
if (!ExprVT) {
- unsigned InIdx = OCUVectorElementExpr::getAccessedFieldNo(0, EncFields);
+ unsigned InIdx = ExtVectorElementExpr::getAccessedFieldNo(0, EncFields);
llvm::Value *Elt = llvm::ConstantInt::get(llvm::Type::Int32Ty, InIdx);
return RValue::get(Builder.CreateExtractElement(Vec, Elt, "tmp"));
}
@@ -202,7 +202,7 @@
if (NumResultElts == NumSourceElts) {
llvm::SmallVector<llvm::Constant*, 4> Mask;
for (unsigned i = 0; i != NumResultElts; ++i) {
- unsigned InIdx = OCUVectorElementExpr::getAccessedFieldNo(i, EncFields);
+ unsigned InIdx = ExtVectorElementExpr::getAccessedFieldNo(i, EncFields);
Mask.push_back(llvm::ConstantInt::get(llvm::Type::Int32Ty, InIdx));
}
@@ -218,7 +218,7 @@
// Extract/Insert each element of the result.
for (unsigned i = 0; i != NumResultElts; ++i) {
- unsigned InIdx = OCUVectorElementExpr::getAccessedFieldNo(i, EncFields);
+ unsigned InIdx = ExtVectorElementExpr::getAccessedFieldNo(i, EncFields);
llvm::Value *Elt = llvm::ConstantInt::get(llvm::Type::Int32Ty, InIdx);
Elt = Builder.CreateExtractElement(Vec, Elt, "tmp");
@@ -247,9 +247,10 @@
return;
}
- // If this is an update of elements of a vector, insert them as appropriate.
- if (Dst.isOCUVectorElt())
- return EmitStoreThroughOCUComponentLValue(Src, Dst, Ty);
+ // If this is an update of extended vector elements, insert them as
+ // appropriate.
+ if (Dst.isExtVectorElt())
+ return EmitStoreThroughExtVectorComponentLValue(Src, Dst, Ty);
if (Dst.isBitfield())
return EmitStoreThroughBitfieldLValue(Src, Dst, Ty);
@@ -304,13 +305,14 @@
Builder.CreateStore(NewVal, Ptr);
}
-void CodeGenFunction::EmitStoreThroughOCUComponentLValue(RValue Src, LValue Dst,
- QualType Ty) {
+void CodeGenFunction::EmitStoreThroughExtVectorComponentLValue(RValue Src,
+ LValue Dst,
+ QualType Ty) {
// This access turns into a read/modify/write of the vector. Load the input
// value now.
- llvm::Value *Vec = Builder.CreateLoad(Dst.getOCUVectorAddr(), "tmp");
+ llvm::Value *Vec = Builder.CreateLoad(Dst.getExtVectorAddr(), "tmp");
// FIXME: Volatility.
- unsigned EncFields = Dst.getOCUVectorElts();
+ unsigned EncFields = Dst.getExtVectorElts();
llvm::Value *SrcVal = Src.getScalarVal();
@@ -322,18 +324,18 @@
llvm::Value *Elt = llvm::ConstantInt::get(llvm::Type::Int32Ty, i);
Elt = Builder.CreateExtractElement(SrcVal, Elt, "tmp");
- unsigned Idx = OCUVectorElementExpr::getAccessedFieldNo(i, EncFields);
+ unsigned Idx = ExtVectorElementExpr::getAccessedFieldNo(i, EncFields);
llvm::Value *OutIdx = llvm::ConstantInt::get(llvm::Type::Int32Ty, Idx);
Vec = Builder.CreateInsertElement(Vec, Elt, OutIdx, "tmp");
}
} else {
// If the Src is a scalar (not a vector) it must be updating one element.
- unsigned InIdx = OCUVectorElementExpr::getAccessedFieldNo(0, EncFields);
+ unsigned InIdx = ExtVectorElementExpr::getAccessedFieldNo(0, EncFields);
llvm::Value *Elt = llvm::ConstantInt::get(llvm::Type::Int32Ty, InIdx);
Vec = Builder.CreateInsertElement(Vec, SrcVal, Elt, "tmp");
}
- Builder.CreateStore(Vec, Dst.getOCUVectorAddr());
+ Builder.CreateStore(Vec, Dst.getExtVectorAddr());
}
@@ -455,12 +457,12 @@
}
LValue CodeGenFunction::
-EmitOCUVectorElementExpr(const OCUVectorElementExpr *E) {
+EmitExtVectorElementExpr(const ExtVectorElementExpr *E) {
// Emit the base vector as an l-value.
LValue Base = EmitLValue(E->getBase());
assert(Base.isSimple() && "Can only subscript lvalue vectors here!");
- return LValue::MakeOCUVectorElt(Base.getAddress(),
+ return LValue::MakeExtVectorElt(Base.getAddress(),
E->getEncodedElementAccess());
}