summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/AST/ASTContext.cpp20
-rw-r--r--clang/lib/AST/Expr.cpp28
-rw-r--r--clang/lib/AST/StmtDumper.cpp4
-rw-r--r--clang/lib/AST/StmtPrinter.cpp2
-rw-r--r--clang/lib/AST/Type.cpp20
-rw-r--r--clang/lib/CodeGen/CGExpr.cpp48
-rw-r--r--clang/lib/CodeGen/CGExprScalar.cpp6
-rw-r--r--clang/lib/CodeGen/CodeGenFunction.h27
-rw-r--r--clang/lib/CodeGen/CodeGenTypes.cpp2
-rw-r--r--clang/lib/Parse/AttributeList.cpp2
-rw-r--r--clang/lib/Sema/Sema.h12
-rw-r--r--clang/lib/Sema/SemaDecl.cpp14
-rw-r--r--clang/lib/Sema/SemaExpr.cpp44
13 files changed, 116 insertions, 113 deletions
diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp
index 7220ce4f9f0..8fd088a305f 100644
--- a/clang/lib/AST/ASTContext.cpp
+++ b/clang/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/clang/lib/AST/Expr.cpp b/clang/lib/AST/Expr.cpp
index 35bea75045f..264ef7b0e8c 100644
--- a/clang/lib/AST/Expr.cpp
+++ b/clang/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/clang/lib/AST/StmtDumper.cpp b/clang/lib/AST/StmtDumper.cpp
index 52eb91e4bf7..798ea84677e 100644
--- a/clang/lib/AST/StmtDumper.cpp
+++ b/clang/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/clang/lib/AST/StmtPrinter.cpp b/clang/lib/AST/StmtPrinter.cpp
index 2ff7f79c2de..f838633171c 100644
--- a/clang/lib/AST/StmtPrinter.cpp
+++ b/clang/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/clang/lib/AST/Type.cpp b/clang/lib/AST/Type.cpp
index 5040b95e09c..741d59bc766 100644
--- a/clang/lib/AST/Type.cpp
+++ b/clang/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/clang/lib/CodeGen/CGExpr.cpp b/clang/lib/CodeGen/CGExpr.cpp
index 5714f3cde93..3c1ab740b23 100644
--- a/clang/lib/CodeGen/CGExpr.cpp
+++ b/clang/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/clang/lib/CodeGen/CGExprScalar.cpp b/clang/lib/CodeGen/CGExprScalar.cpp
index a6bd604bbc2..8abccda9d7e 100644
--- a/clang/lib/CodeGen/CGExprScalar.cpp
+++ b/clang/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/clang/lib/CodeGen/CodeGenFunction.h b/clang/lib/CodeGen/CodeGenFunction.h
index f40a0fad00b..d9e2820e8ef 100644
--- a/clang/lib/CodeGen/CodeGenFunction.h
+++ b/clang/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/clang/lib/CodeGen/CodeGenTypes.cpp b/clang/lib/CodeGen/CodeGenTypes.cpp
index 2fcdb1530f8..a7f6670cb6e 100644
--- a/clang/lib/CodeGen/CodeGenTypes.cpp
+++ b/clang/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/clang/lib/Parse/AttributeList.cpp b/clang/lib/Parse/AttributeList.cpp
index 0ff9447d2e6..c764085caad 100644
--- a/clang/lib/Parse/AttributeList.cpp
+++ b/clang/lib/Parse/AttributeList.cpp
@@ -88,7 +88,7 @@ AttributeList::Kind AttributeList::getKind(const IdentifierInfo *Name) {
if (!memcmp(Str, "address_space", 13)) return AT_address_space;
break;
case 15:
- if (!memcmp(Str, "ocu_vector_type", 15)) return AT_ocu_vector_type;
+ if (!memcmp(Str, "ext_vector_type", 15)) return AT_ext_vector_type;
break;
case 18:
if (!memcmp(Str, "warn_unused_result", 18)) return AT_warn_unused_result;
diff --git a/clang/lib/Sema/Sema.h b/clang/lib/Sema/Sema.h
index 9d60093ca9c..6d6a26d95d3 100644
--- a/clang/lib/Sema/Sema.h
+++ b/clang/lib/Sema/Sema.h
@@ -51,7 +51,7 @@ namespace clang {
class ArrayType;
class LabelStmt;
class SwitchStmt;
- class OCUVectorType;
+ class ExtVectorType;
class TypedefDecl;
class ObjCInterfaceDecl;
class ObjCCompatibleAliasDecl;
@@ -85,10 +85,10 @@ class Sema : public Action {
llvm::SmallVector<SwitchStmt*, 8> SwitchStack;
- /// OCUVectorDecls - This is a list all the OCU vector types. This allows
- /// us to associate a raw vector type with one of the OCU type names.
+ /// ExtVectorDecls - This is a list all the extended vector types. This allows
+ /// us to associate a raw vector type with one of the ext_vector type names.
/// This is only necessary for issuing pretty diagnostics.
- llvm::SmallVector<TypedefDecl*, 24> OCUVectorDecls;
+ llvm::SmallVector<TypedefDecl*, 24> ExtVectorDecls;
/// ObjCImplementations - Keep track of all of the classes with
/// @implementation's, so that we can emit errors on duplicates.
@@ -307,7 +307,7 @@ private:
// for the variable, measured in bytes. If curType and rawAttr are well
// formed, this routine will return a new vector type.
QualType HandleVectorTypeAttribute(QualType curType, AttributeList *rawAttr);
- void HandleOCUVectorTypeAttribute(TypedefDecl *d, AttributeList *rawAttr);
+ void HandleExtVectorTypeAttribute(TypedefDecl *d, AttributeList *rawAttr);
void HandleAlignedAttribute(Decl *d, AttributeList *rawAttr);
void HandlePackedAttribute(Decl *d, AttributeList *rawAttr);
@@ -821,7 +821,7 @@ private:
QualType CheckRealImagOperand(Expr *&Op, SourceLocation OpLoc);
/// type checking primary expressions.
- QualType CheckOCUVectorComponent(QualType baseType, SourceLocation OpLoc,
+ QualType CheckExtVectorComponent(QualType baseType, SourceLocation OpLoc,
IdentifierInfo &Comp, SourceLocation CmpLoc);
/// type checking declaration initializers (C99 6.7.8)
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index e51b7974aec..eec8ce5d0a0 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/lib/Sema/SemaDecl.cpp
@@ -1928,12 +1928,12 @@ void Sema::HandleDeclAttribute(Decl *New, AttributeList *Attr) {
tDecl->setUnderlyingType(newType);
}
break;
- case AttributeList::AT_ocu_vector_type:
+ case AttributeList::AT_ext_vector_type:
if (TypedefDecl *tDecl = dyn_cast<TypedefDecl>(New))
- HandleOCUVectorTypeAttribute(tDecl, Attr);
+ HandleExtVectorTypeAttribute(tDecl, Attr);
else
Diag(Attr->getLoc(),
- diag::err_typecheck_ocu_vector_not_typedef);
+ diag::err_typecheck_ext_vector_not_typedef);
break;
case AttributeList::AT_address_space:
if (TypedefDecl *tDecl = dyn_cast<TypedefDecl>(New)) {
@@ -2009,7 +2009,7 @@ void Sema::HandleDeclAttributes(Decl *New, AttributeList *declspec_prefix,
}
}
-void Sema::HandleOCUVectorTypeAttribute(TypedefDecl *tDecl,
+void Sema::HandleExtVectorTypeAttribute(TypedefDecl *tDecl,
AttributeList *rawAttr) {
QualType curType = tDecl->getUnderlyingType();
// check the attribute arguments.
@@ -2022,7 +2022,7 @@ void Sema::HandleOCUVectorTypeAttribute(TypedefDecl *tDecl,
llvm::APSInt vecSize(32);
if (!sizeExpr->isIntegerConstantExpr(vecSize, Context)) {
Diag(rawAttr->getLoc(), diag::err_attribute_argument_not_int,
- "ocu_vector_type", sizeExpr->getSourceRange());
+ "ext_vector_type", sizeExpr->getSourceRange());
return;
}
// unlike gcc's vector_size attribute, we do not allow vectors to be defined
@@ -2043,9 +2043,9 @@ void Sema::HandleOCUVectorTypeAttribute(TypedefDecl *tDecl,
return;
}
// Instantiate/Install the vector type, the number of elements is > 0.
- tDecl->setUnderlyingType(Context.getOCUVectorType(curType, vectorSize));
+ tDecl->setUnderlyingType(Context.getExtVectorType(curType, vectorSize));
// Remember this typedef decl, we will need it later for diagnostics.
- OCUVectorDecls.push_back(tDecl);
+ ExtVectorDecls.push_back(tDecl);
}
QualType Sema::HandleVectorTypeAttribute(QualType curType,
diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp
index fa3a1883328..fd02443d80f 100644
--- a/clang/lib/Sema/SemaExpr.cpp
+++ b/clang/lib/Sema/SemaExpr.cpp
@@ -429,7 +429,7 @@ ActOnArraySubscriptExpr(ExprTy *Base, SourceLocation LLoc,
// Component access limited to variables (reject vec4.rg[1]).
if (!isa<DeclRefExpr>(BaseExpr) && !isa<ArraySubscriptExpr>(BaseExpr))
- return Diag(LLoc, diag::err_ocuvector_component_access,
+ return Diag(LLoc, diag::err_ext_vector_component_access,
SourceRange(LLoc, RLoc));
// FIXME: need to deal with const...
ResultType = VTy->getElementType();
@@ -455,14 +455,14 @@ ActOnArraySubscriptExpr(ExprTy *Base, SourceLocation LLoc,
}
QualType Sema::
-CheckOCUVectorComponent(QualType baseType, SourceLocation OpLoc,
+CheckExtVectorComponent(QualType baseType, SourceLocation OpLoc,
IdentifierInfo &CompName, SourceLocation CompLoc) {
- const OCUVectorType *vecType = baseType->getAsOCUVectorType();
+ const ExtVectorType *vecType = baseType->getAsExtVectorType();
// The vector accessor can't exceed the number of elements.
const char *compStr = CompName.getName();
if (strlen(compStr) > vecType->getNumElements()) {
- Diag(OpLoc, diag::err_ocuvector_component_exceeds_length,
+ Diag(OpLoc, diag::err_ext_vector_component_exceeds_length,
baseType.getAsString(), SourceRange(CompLoc));
return QualType();
}
@@ -484,7 +484,7 @@ CheckOCUVectorComponent(QualType baseType, SourceLocation OpLoc,
if (*compStr) {
// We didn't get to the end of the string. This means the component names
// didn't come from the same set *or* we encountered an illegal name.
- Diag(OpLoc, diag::err_ocuvector_component_name_illegal,
+ Diag(OpLoc, diag::err_ext_vector_component_name_illegal,
std::string(compStr,compStr+1), SourceRange(CompLoc));
return QualType();
}
@@ -499,7 +499,7 @@ CheckOCUVectorComponent(QualType baseType, SourceLocation OpLoc,
if (*compStr) {
// We didn't get to the end of the string. This means a component accessor
// exceeds the number of elements in the vector.
- Diag(OpLoc, diag::err_ocuvector_component_exceeds_length,
+ Diag(OpLoc, diag::err_ext_vector_component_exceeds_length,
baseType.getAsString(), SourceRange(CompLoc));
return QualType();
}
@@ -510,12 +510,12 @@ CheckOCUVectorComponent(QualType baseType, SourceLocation OpLoc,
if (CompSize == 1)
return vecType->getElementType();
- QualType VT = Context.getOCUVectorType(vecType->getElementType(), CompSize);
+ QualType VT = Context.getExtVectorType(vecType->getElementType(), CompSize);
// Now look up the TypeDefDecl from the vector type. Without this,
- // diagostics look bad. We want OCU vector types to appear built-in.
- for (unsigned i = 0, E = OCUVectorDecls.size(); i != E; ++i) {
- if (OCUVectorDecls[i]->getUnderlyingType() == VT)
- return Context.getTypedefType(OCUVectorDecls[i]);
+ // diagostics look bad. We want extended vector types to appear built-in.
+ for (unsigned i = 0, E = ExtVectorDecls.size(); i != E; ++i) {
+ if (ExtVectorDecls[i]->getUnderlyingType() == VT)
+ return Context.getTypedefType(ExtVectorDecls[i]);
}
return VT; // should never get here (a typedef type should always be found).
}
@@ -540,7 +540,7 @@ ActOnMemberReferenceExpr(ExprTy *Base, SourceLocation OpLoc,
return Diag(OpLoc, diag::err_typecheck_member_reference_arrow,
SourceRange(MemberLoc));
}
- // The base type is either a record or an OCUVectorType.
+ // The base type is either a record or an ExtVectorType.
if (const RecordType *RTy = BaseType->getAsRecordType()) {
RecordDecl *RDecl = RTy->getDecl();
if (RTy->isIncompleteType())
@@ -561,15 +561,15 @@ ActOnMemberReferenceExpr(ExprTy *Base, SourceLocation OpLoc,
return new MemberExpr(BaseExpr, OpKind==tok::arrow, MemberDecl,
MemberLoc, MemberType);
- } else if (BaseType->isOCUVectorType() && OpKind == tok::period) {
+ } else if (BaseType->isExtVectorType() && OpKind == tok::period) {
// Component access limited to variables (reject vec4.rg.g).
if (!isa<DeclRefExpr>(BaseExpr) && !isa<ArraySubscriptExpr>(BaseExpr))
- return Diag(OpLoc, diag::err_ocuvector_component_access,
+ return Diag(OpLoc, diag::err_ext_vector_component_access,
SourceRange(MemberLoc));
- QualType ret = CheckOCUVectorComponent(BaseType, OpLoc, Member, MemberLoc);
+ QualType ret = CheckExtVectorComponent(BaseType, OpLoc, Member, MemberLoc);
if (ret.isNull())
return true;
- return new OCUVectorElementExpr(ret, BaseExpr, Member, MemberLoc);
+ return new ExtVectorElementExpr(ret, BaseExpr, Member, MemberLoc);
} else if (BaseType->isObjCInterfaceType()) {
ObjCInterfaceDecl *IFace;
if (isa<ObjCInterfaceType>(BaseType.getCanonicalType()))
@@ -1208,8 +1208,8 @@ Sema::CheckAssignmentConstraints(QualType lhsType, QualType rhsType) {
}
if (isa<VectorType>(lhsType) || isa<VectorType>(rhsType)) {
- // For OCUVector, allow vector splats; float -> <n x float>
- if (const OCUVectorType *LV = dyn_cast<OCUVectorType>(lhsType)) {
+ // For ExtVector, allow vector splats; float -> <n x float>
+ if (const ExtVectorType *LV = dyn_cast<ExtVectorType>(lhsType)) {
if (LV->getElementType().getTypePtr() == rhsType.getTypePtr())
return Compatible;
}
@@ -1310,9 +1310,9 @@ inline QualType Sema::CheckVectorOperands(SourceLocation loc, Expr *&lex,
if (lhsType == rhsType)
return lhsType;
- // if the lhs is an ocu vector and the rhs is a scalar of the same type,
+ // if the lhs is an extended vector and the rhs is a scalar of the same type,
// promote the rhs to the vector type.
- if (const OCUVectorType *V = lhsType->getAsOCUVectorType()) {
+ if (const ExtVectorType *V = lhsType->getAsExtVectorType()) {
if (V->getElementType().getCanonicalType().getTypePtr()
== rhsType.getCanonicalType().getTypePtr()) {
ImpCastExprToType(rex, lhsType);
@@ -1320,9 +1320,9 @@ inline QualType Sema::CheckVectorOperands(SourceLocation loc, Expr *&lex,
}
}
- // if the rhs is an ocu vector and the lhs is a scalar of the same type,
+ // if the rhs is an extended vector and the lhs is a scalar of the same type,
// promote the lhs to the vector type.
- if (const OCUVectorType *V = rhsType->getAsOCUVectorType()) {
+ if (const ExtVectorType *V = rhsType->getAsExtVectorType()) {
if (V->getElementType().getCanonicalType().getTypePtr()
== lhsType.getCanonicalType().getTypePtr()) {
ImpCastExprToType(lex, rhsType);
OpenPOWER on IntegriCloud