aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNate Begeman <natebegeman@mac.com>2008-04-18 23:10:10 +0000
committerNate Begeman <natebegeman@mac.com>2008-04-18 23:10:10 +0000
commit213541a68a3e137d11d2cefb612c6cdb410d7e8e (patch)
tree04300b07f5b4a07ac48ad429b2a0770b5b52a09c
parent2f0e89ea96292d2974eb1a7dddc0e9870aa86bb7 (diff)
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
-rw-r--r--include/clang/AST/ASTContext.h7
-rw-r--r--include/clang/AST/Expr.h14
-rw-r--r--include/clang/AST/StmtNodes.def2
-rw-r--r--include/clang/AST/Type.h30
-rw-r--r--include/clang/Basic/DiagnosticKinds.def10
-rw-r--r--include/clang/Parse/AttributeList.h2
-rw-r--r--lib/AST/ASTContext.cpp20
-rw-r--r--lib/AST/Expr.cpp28
-rw-r--r--lib/AST/StmtDumper.cpp4
-rw-r--r--lib/AST/StmtPrinter.cpp2
-rw-r--r--lib/AST/Type.cpp20
-rw-r--r--lib/CodeGen/CGExpr.cpp48
-rw-r--r--lib/CodeGen/CGExprScalar.cpp6
-rw-r--r--lib/CodeGen/CodeGenFunction.h27
-rw-r--r--lib/CodeGen/CodeGenTypes.cpp2
-rw-r--r--lib/Parse/AttributeList.cpp2
-rw-r--r--lib/Sema/Sema.h12
-rw-r--r--lib/Sema/SemaDecl.cpp14
-rw-r--r--lib/Sema/SemaExpr.cpp44
-rw-r--r--test/CodeGen/ocu-vector.c4
-rw-r--r--test/Parser/ocu_vector_components.c6
-rw-r--r--test/Sema/vector-init.c2
22 files changed, 155 insertions, 151 deletions
diff --git a/include/clang/AST/ASTContext.h b/include/clang/AST/ASTContext.h
index 1d9e0af730..dfe117053c 100644
--- a/include/clang/AST/ASTContext.h
+++ b/include/clang/AST/ASTContext.h
@@ -169,9 +169,10 @@ public:
/// the specified element type and size. VectorType must be a built-in type.
QualType getVectorType(QualType VectorType, unsigned NumElts);
- /// getOCUVectorType - Return the unique reference to an OCU vector type of
- /// the specified element type and size. VectorType must be a built-in type.
- QualType getOCUVectorType(QualType VectorType, unsigned NumElts);
+ /// getExtVectorType - Return the unique reference to an extended vector type
+ /// of the specified element type and size. VectorType must be a built-in
+ /// type.
+ QualType getExtVectorType(QualType VectorType, unsigned NumElts);
/// getFunctionTypeNoProto - Return a K&R style C function type like 'int()'.
///
diff --git a/include/clang/AST/Expr.h b/include/clang/AST/Expr.h
index 4819e218e7..6bd5bbcbd5 100644
--- a/include/clang/AST/Expr.h
+++ b/include/clang/AST/Expr.h
@@ -691,11 +691,11 @@ public:
static MemberExpr* CreateImpl(llvm::Deserializer& D, ASTContext& C);
};
-/// OCUVectorElementExpr - This represents access to specific elements of a
+/// ExtVectorElementExpr - This represents access to specific elements of a
/// vector, and may occur on the left hand side or right hand side. For example
-/// the following is legal: "V.xy = V.zw" if V is a 4 element ocu vector.
+/// the following is legal: "V.xy = V.zw" if V is a 4 element extended vector.
///
-class OCUVectorElementExpr : public Expr {
+class ExtVectorElementExpr : public Expr {
Expr *Base;
IdentifierInfo &Accessor;
SourceLocation AccessorLoc;
@@ -705,9 +705,9 @@ public:
Color, // rgba
Texture // stpq
};
- OCUVectorElementExpr(QualType ty, Expr *base, IdentifierInfo &accessor,
+ ExtVectorElementExpr(QualType ty, Expr *base, IdentifierInfo &accessor,
SourceLocation loc)
- : Expr(OCUVectorElementExprClass, ty),
+ : Expr(ExtVectorElementExprClass, ty),
Base(base), Accessor(accessor), AccessorLoc(loc) {}
const Expr *getBase() const { return Base; }
@@ -743,9 +743,9 @@ public:
}
static bool classof(const Stmt *T) {
- return T->getStmtClass() == OCUVectorElementExprClass;
+ return T->getStmtClass() == ExtVectorElementExprClass;
}
- static bool classof(const OCUVectorElementExpr *) { return true; }
+ static bool classof(const ExtVectorElementExpr *) { return true; }
// Iterators
virtual child_iterator child_begin();
diff --git a/include/clang/AST/StmtNodes.def b/include/clang/AST/StmtNodes.def
index e3f0273308..0df573b57b 100644
--- a/include/clang/AST/StmtNodes.def
+++ b/include/clang/AST/StmtNodes.def
@@ -77,7 +77,7 @@ STMT(47, CompoundAssignOperator, BinaryOperator)
STMT(48, ConditionalOperator , Expr)
STMT(49, ImplicitCastExpr , Expr)
STMT(50, CompoundLiteralExpr , Expr)
-STMT(51, OCUVectorElementExpr , Expr)
+STMT(51, ExtVectorElementExpr , Expr)
STMT(52, InitListExpr , Expr)
STMT(53, VAArgExpr , Expr)
diff --git a/include/clang/AST/Type.h b/include/clang/AST/Type.h
index 8b5ed4ce63..313c243c4f 100644
--- a/include/clang/AST/Type.h
+++ b/include/clang/AST/Type.h
@@ -50,7 +50,7 @@ namespace clang {
class ComplexType;
class TagType;
class FunctionType;
- class OCUVectorType;
+ class ExtVectorType;
class BuiltinType;
class ObjCInterfaceType;
class ObjCQualifiedIdType;
@@ -223,7 +223,7 @@ public:
enum TypeClass {
Builtin, Complex, Pointer, Reference,
ConstantArray, VariableArray, IncompleteArray,
- Vector, OCUVector,
+ Vector, ExtVector,
FunctionNoProto, FunctionProto,
TypeName, Tagged, ASQual,
ObjCInterface, ObjCQualifiedInterface,
@@ -320,7 +320,7 @@ public:
bool isUnionType() const;
bool isComplexIntegerType() const; // GCC _Complex integer type.
bool isVectorType() const; // GCC vector type.
- bool isOCUVectorType() const; // OCU vector type.
+ bool isExtVectorType() const; // Extended vector type.
bool isObjCInterfaceType() const; // NSString or NSString<foo>
bool isObjCQualifiedInterfaceType() const; // NSString<foo>
bool isObjCQualifiedIdType() const; // id<foo>
@@ -343,7 +343,7 @@ public:
const VectorType *getAsVectorType() const; // GCC vector type.
const ComplexType *getAsComplexType() const;
const ComplexType *getAsComplexIntegerType() const; // GCC complex int type.
- const OCUVectorType *getAsOCUVectorType() const; // OCU vector type.
+ const ExtVectorType *getAsExtVectorType() const; // Extended vector type.
const ObjCInterfaceType *getAsObjCInterfaceType() const;
const ObjCQualifiedInterfaceType *getAsObjCQualifiedInterfaceType() const;
const ObjCQualifiedIdType *getAsObjCQualifiedIdType() const;
@@ -758,19 +758,19 @@ public:
ID.AddInteger(TypeClass);
}
static bool classof(const Type *T) {
- return T->getTypeClass() == Vector || T->getTypeClass() == OCUVector;
+ return T->getTypeClass() == Vector || T->getTypeClass() == ExtVector;
}
static bool classof(const VectorType *) { return true; }
};
-/// OCUVectorType - Extended vector type. This type is created using
-/// __attribute__((ocu_vector_type(n)), where "n" is the number of elements.
-/// Unlike vector_size, ocu_vector_type is only allowed on typedef's. This
+/// ExtVectorType - Extended vector type. This type is created using
+/// __attribute__((ext_vector_type(n)), where "n" is the number of elements.
+/// Unlike vector_size, ext_vector_type is only allowed on typedef's. This
/// class enables syntactic extensions, like Vector Components for accessing
/// points, colors, and textures (modeled after OpenGL Shading Language).
-class OCUVectorType : public VectorType {
- OCUVectorType(QualType vecType, unsigned nElements, QualType canonType) :
- VectorType(OCUVector, vecType, nElements, canonType) {}
+class ExtVectorType : public VectorType {
+ ExtVectorType(QualType vecType, unsigned nElements, QualType canonType) :
+ VectorType(ExtVector, vecType, nElements, canonType) {}
friend class ASTContext; // ASTContext creates these.
public:
static int getPointAccessorIdx(char c) {
@@ -815,9 +815,9 @@ public:
virtual void getAsStringInternal(std::string &InnerString) const;
static bool classof(const Type *T) {
- return T->getTypeClass() == OCUVector;
+ return T->getTypeClass() == ExtVector;
}
- static bool classof(const OCUVectorType *) { return true; }
+ static bool classof(const ExtVectorType *) { return true; }
};
/// FunctionType - C99 6.7.5.3 - Function Declarators. This is the common base
@@ -1225,8 +1225,8 @@ inline bool Type::isAnyComplexType() const {
inline bool Type::isVectorType() const {
return isa<VectorType>(CanonicalType.getUnqualifiedType());
}
-inline bool Type::isOCUVectorType() const {
- return isa<OCUVectorType>(CanonicalType.getUnqualifiedType());
+inline bool Type::isExtVectorType() const {
+ return isa<ExtVectorType>(CanonicalType.getUnqualifiedType());
}
inline bool Type::isObjCInterfaceType() const {
return isa<ObjCInterfaceType>(CanonicalType);
diff --git a/include/clang/Basic/DiagnosticKinds.def b/include/clang/Basic/DiagnosticKinds.def
index f8dc4d1629..8fdf716aea 100644
--- a/include/clang/Basic/DiagnosticKinds.def
+++ b/include/clang/Basic/DiagnosticKinds.def
@@ -594,13 +594,13 @@ DIAG(err_attribute_zero_size, ERROR,
"zero vector size")
DIAG(err_typecheck_vector_not_convertable, ERROR,
"can't convert between vector values of different size ('%0' and '%1')")
-DIAG(err_typecheck_ocu_vector_not_typedef, ERROR,
- "ocu_vector_type only applies to types, not variables")
-DIAG(err_ocuvector_component_exceeds_length, ERROR,
+DIAG(err_typecheck_ext_vector_not_typedef, ERROR,
+ "ext_vector_type only applies to types, not variables")
+DIAG(err_ext_vector_component_exceeds_length, ERROR,
"vector component access exceeds type '%0'")
-DIAG(err_ocuvector_component_name_illegal, ERROR,
+DIAG(err_ext_vector_component_name_illegal, ERROR,
"illegal vector component name '%0'")
-DIAG(err_ocuvector_component_access, ERROR,
+DIAG(err_ext_vector_component_access, ERROR,
"vector component access limited to variables")
DIAG(err_attribute_address_space_not_int, ERROR,
"address space attribute requires an integer constant")
diff --git a/include/clang/Parse/AttributeList.h b/include/clang/Parse/AttributeList.h
index a8057d96d8..c71f8ff1f8 100644
--- a/include/clang/Parse/AttributeList.h
+++ b/include/clang/Parse/AttributeList.h
@@ -44,7 +44,7 @@ public:
enum Kind {
UnknownAttribute,
AT_vector_size,
- AT_ocu_vector_type,
+ AT_ext_vector_type,
AT_address_space,
AT_aligned,
AT_packed,
diff --git a/lib/AST/ASTContext.cpp b/lib/AST/ASTContext.cpp
index 7220ce4f9f..8fd088a305 100644
--- a/lib/AST/ASTContext.cpp
+++ b/lib/AST/ASTContext.cpp
@@ -200,7 +200,7 @@ ASTContext::getTypeInfo(QualType T) {
Align = EltInfo.second;
break;
}
- case Type::OCUVector:
+ case Type::ExtVector:
case Type::Vector: {
std::pair<uint64_t, unsigned> EltInfo =
getTypeInfo(cast<VectorType>(T)->getElementType());
@@ -678,17 +678,17 @@ QualType ASTContext::getVectorType(QualType vecType, unsigned NumElts) {
return QualType(New, 0);
}
-/// getOCUVectorType - Return the unique reference to an OCU vector type of
+/// getExtVectorType - Return the unique reference to an extended vector type of
/// the specified element type and size. VectorType must be a built-in type.
-QualType ASTContext::getOCUVectorType(QualType vecType, unsigned NumElts) {
+QualType ASTContext::getExtVectorType(QualType vecType, unsigned NumElts) {
BuiltinType *baseType;
baseType = dyn_cast<BuiltinType>(getCanonicalType(vecType).getTypePtr());
- assert(baseType != 0 && "getOCUVectorType(): Expecting a built-in type");
+ assert(baseType != 0 && "getExtVectorType(): Expecting a built-in type");
// Check if we've already instantiated a vector of this type.
llvm::FoldingSetNodeID ID;
- VectorType::Profile(ID, vecType, NumElts, Type::OCUVector);
+ VectorType::Profile(ID, vecType, NumElts, Type::ExtVector);
void *InsertPos = 0;
if (VectorType *VTP = VectorTypes.FindNodeOrInsertPos(ID, InsertPos))
return QualType(VTP, 0);
@@ -697,13 +697,13 @@ QualType ASTContext::getOCUVectorType(QualType vecType, unsigned NumElts) {
// so fill in the canonical type field.
QualType Canonical;
if (!vecType->isCanonical()) {
- Canonical = getOCUVectorType(getCanonicalType(vecType), NumElts);
+ Canonical = getExtVectorType(getCanonicalType(vecType), NumElts);
// Get the new insert position for the node we care about.
VectorType *NewIP = VectorTypes.FindNodeOrInsertPos(ID, InsertPos);
assert(NewIP == 0 && "Shouldn't be in the map!");
}
- OCUVectorType *New = new OCUVectorType(vecType, NumElts, Canonical);
+ ExtVectorType *New = new ExtVectorType(vecType, NumElts, Canonical);
VectorTypes.InsertNode(New, InsertPos);
Types.push_back(New);
return QualType(New, 0);
@@ -1646,9 +1646,9 @@ bool ASTContext::typesAreCompatible(QualType LHS_NC, QualType RHS_NC) {
if (RHSClass == Type::VariableArray || RHSClass == Type::IncompleteArray)
RHSClass = Type::ConstantArray;
- // Canonicalize OCUVector -> Vector.
- if (LHSClass == Type::OCUVector) LHSClass = Type::Vector;
- if (RHSClass == Type::OCUVector) RHSClass = Type::Vector;
+ // Canonicalize ExtVector -> Vector.
+ if (LHSClass == Type::ExtVector) LHSClass = Type::Vector;
+ if (RHSClass == Type::ExtVector) RHSClass = Type::Vector;
// Consider qualified interfaces and interfaces the same.
if (LHSClass == Type::ObjCQualifiedInterface) LHSClass = Type::ObjCInterface;
diff --git a/lib/AST/Expr.cpp b/lib/AST/Expr.cpp
index 35bea75045..264ef7b0e8 100644
--- a/lib/AST/Expr.cpp
+++ b/lib/AST/Expr.cpp
@@ -396,8 +396,8 @@ Expr::isLvalueResult Expr::isLvalue() const {
return cast<ParenExpr>(this)->getSubExpr()->isLvalue();
case CompoundLiteralExprClass: // C99 6.5.2.5p5
return LV_Valid;
- case OCUVectorElementExprClass:
- if (cast<OCUVectorElementExpr>(this)->containsDuplicateElements())
+ case ExtVectorElementExprClass:
+ if (cast<ExtVectorElementExpr>(this)->containsDuplicateElements())
return LV_DuplicateVectorComponents;
return LV_Valid;
case ObjCIvarRefExprClass: // ObjC instance variables are lvalues.
@@ -1037,29 +1037,29 @@ bool Expr::isNullPointerConstant(ASTContext &Ctx) const {
return isIntegerConstantExpr(Val, Ctx, 0, true) && Val == 0;
}
-unsigned OCUVectorElementExpr::getNumElements() const {
+unsigned ExtVectorElementExpr::getNumElements() const {
return strlen(Accessor.getName());
}
/// getComponentType - Determine whether the components of this access are
/// "point" "color" or "texture" elements.
-OCUVectorElementExpr::ElementType
-OCUVectorElementExpr::getElementType() const {
+ExtVectorElementExpr::ElementType
+ExtVectorElementExpr::getElementType() const {
// derive the component type, no need to waste space.
const char *compStr = Accessor.getName();
- if (OCUVectorType::getPointAccessorIdx(*compStr) != -1) return Point;
- if (OCUVectorType::getColorAccessorIdx(*compStr) != -1) return Color;
+ if (ExtVectorType::getPointAccessorIdx(*compStr) != -1) return Point;
+ if (ExtVectorType::getColorAccessorIdx(*compStr) != -1) return Color;
- assert(OCUVectorType::getTextureAccessorIdx(*compStr) != -1 &&
+ assert(ExtVectorType::getTextureAccessorIdx(*compStr) != -1 &&
"getComponentType(): Illegal accessor");
return Texture;
}
/// containsDuplicateElements - Return true if any element access is
/// repeated.
-bool OCUVectorElementExpr::containsDuplicateElements() const {
+bool ExtVectorElementExpr::containsDuplicateElements() const {
const char *compStr = Accessor.getName();
unsigned length = strlen(compStr);
@@ -1073,7 +1073,7 @@ bool OCUVectorElementExpr::containsDuplicateElements() const {
}
/// getEncodedElementAccess - We encode fields with two bits per component.
-unsigned OCUVectorElementExpr::getEncodedElementAccess() const {
+unsigned ExtVectorElementExpr::getEncodedElementAccess() const {
const char *compStr = Accessor.getName();
unsigned length = getNumElements();
@@ -1081,7 +1081,7 @@ unsigned OCUVectorElementExpr::getEncodedElementAccess() const {
while (length--) {
Result <<= 2;
- int Idx = OCUVectorType::getAccessorIdx(compStr[length]);
+ int Idx = ExtVectorType::getAccessorIdx(compStr[length]);
assert(Idx != -1 && "Invalid accessor letter");
Result |= Idx;
}
@@ -1268,11 +1268,11 @@ Stmt::child_iterator MemberExpr::child_end() {
return reinterpret_cast<Stmt**>(&Base)+1;
}
-// OCUVectorElementExpr
-Stmt::child_iterator OCUVectorElementExpr::child_begin() {
+// ExtVectorElementExpr
+Stmt::child_iterator ExtVectorElementExpr::child_begin() {
return reinterpret_cast<Stmt**>(&Base);
}
-Stmt::child_iterator OCUVectorElementExpr::child_end() {
+Stmt::child_iterator ExtVectorElementExpr::child_end() {
return reinterpret_cast<Stmt**>(&Base)+1;
}
diff --git a/lib/AST/StmtDumper.cpp b/lib/AST/StmtDumper.cpp
index 52eb91e4bf..798ea84677 100644
--- a/lib/AST/StmtDumper.cpp
+++ b/lib/AST/StmtDumper.cpp
@@ -124,7 +124,7 @@ namespace {
void VisitUnaryOperator(UnaryOperator *Node);
void VisitSizeOfAlignOfTypeExpr(SizeOfAlignOfTypeExpr *Node);
void VisitMemberExpr(MemberExpr *Node);
- void VisitOCUVectorElementExpr(OCUVectorElementExpr *Node);
+ void VisitExtVectorElementExpr(ExtVectorElementExpr *Node);
void VisitBinaryOperator(BinaryOperator *Node);
void VisitCompoundAssignOperator(CompoundAssignOperator *Node);
void VisitAddrLabelExpr(AddrLabelExpr *Node);
@@ -377,7 +377,7 @@ void StmtDumper::VisitMemberExpr(MemberExpr *Node) {
fprintf(F, " %s%s %p", Node->isArrow() ? "->" : ".",
Node->getMemberDecl()->getName(), (void*)Node->getMemberDecl());
}
-void StmtDumper::VisitOCUVectorElementExpr(OCUVectorElementExpr *Node) {
+void StmtDumper::VisitExtVectorElementExpr(ExtVectorElementExpr *Node) {
DumpExpr(Node);
fprintf(F, " %s", Node->getAccessor().getName());
}
diff --git a/lib/AST/StmtPrinter.cpp b/lib/AST/StmtPrinter.cpp
index 2ff7f79c2d..f838633171 100644
--- a/lib/AST/StmtPrinter.cpp
+++ b/lib/AST/StmtPrinter.cpp
@@ -676,7 +676,7 @@ void StmtPrinter::VisitMemberExpr(MemberExpr *Node) {
assert(Field && "MemberExpr should alway reference a field!");
OS << Field->getName();
}
-void StmtPrinter::VisitOCUVectorElementExpr(OCUVectorElementExpr *Node) {
+void StmtPrinter::VisitExtVectorElementExpr(ExtVectorElementExpr *Node) {
PrintExpr(Node->getBase());
OS << ".";
OS << Node->getAccessor().getName();
diff --git a/lib/AST/Type.cpp b/lib/AST/Type.cpp
index 5040b95e09..741d59bc76 100644
--- a/lib/AST/Type.cpp
+++ b/lib/AST/Type.cpp
@@ -416,22 +416,22 @@ const VectorType *Type::getAsVectorType() const {
return getDesugaredType()->getAsVectorType();
}
-const OCUVectorType *Type::getAsOCUVectorType() const {
+const ExtVectorType *Type::getAsExtVectorType() const {
// Are we directly an OpenCU vector type?
- if (const OCUVectorType *VTy = dyn_cast<OCUVectorType>(this))
+ if (const ExtVectorType *VTy = dyn_cast<ExtVectorType>(this))
return VTy;
// If the canonical form of this type isn't the right kind, reject it.
- if (!isa<OCUVectorType>(CanonicalType)) {
+ if (!isa<ExtVectorType>(CanonicalType)) {
// Look through type qualifiers
- if (isa<OCUVectorType>(CanonicalType.getUnqualifiedType()))
- return CanonicalType.getUnqualifiedType()->getAsOCUVectorType();
+ if (isa<ExtVectorType>(CanonicalType.getUnqualifiedType()))
+ return CanonicalType.getUnqualifiedType()->getAsExtVectorType();
return 0;
}
- // If this is a typedef for an ocuvector type, strip the typedef off without
- // losing all typedef information.
- return getDesugaredType()->getAsOCUVectorType();
+ // If this is a typedef for an extended vector type, strip the typedef off
+ // without losing all typedef information.
+ return getDesugaredType()->getAsExtVectorType();
}
const ObjCInterfaceType *Type::getAsObjCInterfaceType() const {
@@ -903,8 +903,8 @@ void VectorType::getAsStringInternal(std::string &S) const {
ElementType.getAsStringInternal(S);
}
-void OCUVectorType::getAsStringInternal(std::string &S) const {
- S += " __attribute__((ocu_vector_type(";
+void ExtVectorType::getAsStringInternal(std::string &S) const {
+ S += " __attribute__((ext_vector_type(";
S += llvm::utostr_32(NumElements);
S += ")))";
ElementType.getAsStringInternal(S);
diff --git a/lib/CodeGen/CGExpr.cpp b/lib/CodeGen/CGExpr.cpp
index 5714f3cde9..3c1ab740b2 100644
--- a/lib/CodeGen/CGExpr.cpp
+++ b/lib/CodeGen/CGExpr.cpp
@@ -103,8 +103,8 @@ LValue CodeGenFunction::EmitLValue(const Expr *E) {
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 @@ RValue CodeGenFunction::EmitLoadOfLValue(LValue LV, QualType ExprType) {
// 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 @@ RValue CodeGenFunction::EmitLoadOfBitfieldLValue(LValue LV,
// 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 @@ RValue CodeGenFunction::EmitLoadOfOCUElementLValue(LValue LV,
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 @@ RValue CodeGenFunction::EmitLoadOfOCUElementLValue(LValue LV,
// 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 @@ void CodeGenFunction::EmitStoreThroughLValue(RValue Src, LValue Dst,
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 @@ void CodeGenFunction::EmitStoreThroughBitfieldLValue(RValue Src, LValue Dst,
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 @@ void CodeGenFunction::EmitStoreThroughOCUComponentLValue(RValue Src, LValue Dst,
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::EmitArraySubscriptExpr(const ArraySubscriptExpr *E) {
}
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());
}
diff --git a/lib/CodeGen/CGExprScalar.cpp b/lib/CodeGen/CGExprScalar.cpp
index a6bd604bbc..8abccda9d7 100644
--- a/lib/CodeGen/CGExprScalar.cpp
+++ b/lib/CodeGen/CGExprScalar.cpp
@@ -128,7 +128,7 @@ public:
Value *VisitObjCIvarRefExpr(ObjCIvarRefExpr *E) { return EmitLoadOfLValue(E);}
Value *VisitArraySubscriptExpr(ArraySubscriptExpr *E);
Value *VisitMemberExpr(Expr *E) { return EmitLoadOfLValue(E); }
- Value *VisitOCUVectorElementExpr(Expr *E) { return EmitLoadOfLValue(E); }
+ Value *VisitExtVectorElementExpr(Expr *E) { return EmitLoadOfLValue(E); }
Value *VisitStringLiteral(Expr *E) { return EmitLValue(E).getAddress(); }
Value *VisitPreDefinedExpr(Expr *E) { return EmitLValue(E).getAddress(); }
@@ -379,8 +379,8 @@ Value *ScalarExprEmitter::EmitScalarConversion(Value *Src, QualType SrcType,
return Builder.CreatePtrToInt(Src, DstTy, "conv");
}
- // A scalar source can be splatted to an OCU vector of the same element type
- if (DstType->isOCUVectorType() && !isa<VectorType>(SrcType) &&
+ // A scalar can be splatted to an extended vector of the same element type
+ if (DstType->isExtVectorType() && !isa<VectorType>(SrcType) &&
cast<llvm::VectorType>(DstTy)->getElementType() == Src->getType())
return CGF.EmitVector(&Src, DstType->getAsVectorType()->getNumElements(),
true);
diff --git a/lib/CodeGen/CodeGenFunction.h b/lib/CodeGen/CodeGenFunction.h
index f40a0fad00..d9e2820e8e 100644
--- a/lib/CodeGen/CodeGenFunction.h
+++ b/lib/CodeGen/CodeGenFunction.h
@@ -62,7 +62,7 @@ namespace clang {
class BinaryOperator;
class CompoundAssignOperator;
class ArraySubscriptExpr;
- class OCUVectorElementExpr;
+ class ExtVectorElementExpr;
class ConditionalOperator;
class ChooseExpr;
class PreDefinedExpr;
@@ -155,14 +155,14 @@ class LValue {
Simple, // This is a normal l-value, use getAddress().
VectorElt, // This is a vector element l-value (V[i]), use getVector*
BitField, // This is a bitfield l-value, use getBitfield*.
- OCUVectorElt // This is an ocu vector subset, use getOCUVectorComp
+ ExtVectorElt // This is an extended vector subset, use getExtVectorComp
} LVType;
llvm::Value *V;
union {
llvm::Value *VectorIdx; // Index into a vector subscript: V[i]
- unsigned VectorElts; // Encoded OCUVector element subset: V.xyx
+ unsigned VectorElts; // Encoded ExtVector element subset: V.xyx
struct {
unsigned short StartBit;
unsigned short Size;
@@ -173,17 +173,17 @@ public:
bool isSimple() const { return LVType == Simple; }
bool isVectorElt() const { return LVType == VectorElt; }
bool isBitfield() const { return LVType == BitField; }
- bool isOCUVectorElt() const { return LVType == OCUVectorElt; }
+ bool isExtVectorElt() const { return LVType == ExtVectorElt; }
// simple lvalue
llvm::Value *getAddress() const { assert(isSimple()); return V; }
// vector elt lvalue
llvm::Value *getVectorAddr() const { assert(isVectorElt()); return V; }
llvm::Value *getVectorIdx() const { assert(isVectorElt()); return VectorIdx; }
- // ocu vector elements.
- llvm::Value *getOCUVectorAddr() const { assert(isOCUVectorElt()); return V; }
- unsigned getOCUVectorElts() const {
- assert(isOCUVectorElt());
+ // extended vector elements.
+ llvm::Value *getExtVectorAddr() const { assert(isExtVectorElt()); return V; }
+ unsigned getExtVectorElts() const {
+ assert(isExtVectorElt());
return VectorElts;
}
// bitfield lvalue
@@ -216,9 +216,9 @@ public:
return R;
}
- static LValue MakeOCUVectorElt(llvm::Value *Vec, unsigned Elements) {
+ static LValue MakeExtVectorElt(llvm::Value *Vec, unsigned Elements) {
LValue R;
- R.LVType = OCUVectorElt;
+ R.LVType = ExtVectorElt;
R.V = Vec;
R.VectorElts = Elements;
return R;
@@ -405,7 +405,7 @@ public:
/// this method emits the address of the lvalue, then loads the result as an
/// rvalue, returning the rvalue.
RValue EmitLoadOfLValue(LValue V, QualType LVType);
- RValue EmitLoadOfOCUElementLValue(LValue V, QualType LVType);
+ RValue EmitLoadOfExtVectorElementLValue(LValue V, QualType LVType);
RValue EmitLoadOfBitfieldLValue(LValue LV, QualType ExprType);
@@ -413,7 +413,8 @@ public:
/// lvalue, where both are guaranteed to the have the same type, and that type
/// is 'Ty'.
void EmitStoreThroughLValue(RValue Src, LValue Dst, QualType Ty);
- void EmitStoreThroughOCUComponentLValue(RValue Src, LValue Dst, QualType Ty);
+ void EmitStoreThroughExtVectorComponentLValue(RValue Src, LValue Dst,
+ QualType Ty);
void EmitStoreThroughBitfieldLValue(RValue Src, LValue Dst, QualType Ty);
// Note: only availabe for agg return types
@@ -424,7 +425,7 @@ public:
LValue EmitPreDefinedLValue(const PreDefinedExpr *E);
LValue EmitUnaryOpLValue(const UnaryOperator *E);
LValue EmitArraySubscriptExpr(const ArraySubscriptExpr *E);
- LValue EmitOCUVectorElementExpr(const OCUVectorElementExpr *E);
+ LValue EmitExtVectorElementExpr(const ExtVectorElementExpr *E);
LValue EmitMemberExpr(const MemberExpr *E);
LValue EmitLValueForField(llvm::Value* Base, FieldDecl* Field,
diff --git a/lib/CodeGen/CodeGenTypes.cpp b/lib/CodeGen/CodeGenTypes.cpp
index 2fcdb1530f..a7f6670cb6 100644
--- a/lib/CodeGen/CodeGenTypes.cpp
+++ b/lib/CodeGen/CodeGenTypes.cpp
@@ -258,7 +258,7 @@ const llvm::Type *CodeGenTypes::ConvertNewType(QualType T) {
const llvm::Type *EltTy = ConvertTypeRecursive(A.getElementType());
return llvm::ArrayType::get(EltTy, A.getSize().getZExtValue());
}
- case Type::OCUVector:
+ case Type::ExtVector:
case Type::Vector: {
const VectorType &VT = cast<VectorType>(Ty);
return llvm::VectorType::get(ConvertTypeRecursive(VT.getElementType()),
diff --git a/lib/Parse/AttributeList.cpp b/lib/Parse/AttributeList.cpp
index 0ff9447d2e..c764085caa 100644
--- a/lib/Parse/AttributeList.cpp
+++ b/lib/Parse/AttributeList.cpp
@@ -88,7 +88,7 @@ AttributeList::Kind AttributeList