[cfe-commits] r40785 - in /cfe/trunk: AST/Expr.cpp AST/StmtPrinter.cpp CodeGen/CGExpr.cpp CodeGen/CodeGenFunction.h Sema/SemaExpr.cpp include/clang/AST/Expr.h include/clang/AST/StmtNodes.def
Chris Lattner
sabre at nondot.org
Fri Aug 3 10:31:20 PDT 2007
Author: lattner
Date: Fri Aug 3 12:31:20 2007
New Revision: 40785
URL: http://llvm.org/viewvc/llvm-project?rev=40785&view=rev
Log:
Rename AddrLabel and OCUVectorComponent -> AddrLabelExpr and OCUVectorElementExpr respectively. This is for consistency with other expr nodes end with *Expr.
Modified:
cfe/trunk/AST/Expr.cpp
cfe/trunk/AST/StmtPrinter.cpp
cfe/trunk/CodeGen/CGExpr.cpp
cfe/trunk/CodeGen/CodeGenFunction.h
cfe/trunk/Sema/SemaExpr.cpp
cfe/trunk/include/clang/AST/Expr.h
cfe/trunk/include/clang/AST/StmtNodes.def
Modified: cfe/trunk/AST/Expr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/AST/Expr.cpp?rev=40785&r1=40784&r2=40785&view=diff
==============================================================================
--- cfe/trunk/AST/Expr.cpp (original)
+++ cfe/trunk/AST/Expr.cpp Fri Aug 3 12:31:20 2007
@@ -226,8 +226,8 @@
break;
case ParenExprClass: // C99 6.5.1p5
return cast<ParenExpr>(this)->getSubExpr()->isLvalue();
- case OCUVectorComponentClass:
- if (cast<OCUVectorComponent>(this)->containsDuplicateComponents())
+ case OCUVectorElementExprClass:
+ if (cast<OCUVectorElementExpr>(this)->containsDuplicateElements())
return LV_DuplicateVectorComponents;
return LV_Valid;
default:
@@ -583,14 +583,15 @@
return isIntegerConstantExpr(Val, Ctx, 0, true) && Val == 0;
}
-unsigned OCUVectorComponent::getNumComponents() const {
+unsigned OCUVectorElementExpr::getNumElements() const {
return strlen(Accessor.getName());
}
/// getComponentType - Determine whether the components of this access are
/// "point" "color" or "texture" elements.
-OCUVectorComponent::ComponentType OCUVectorComponent::getComponentType() const {
+OCUVectorElementExpr::ElementType
+OCUVectorElementExpr::getElementType() const {
// derive the component type, no need to waste space.
const char *compStr = Accessor.getName();
@@ -602,9 +603,9 @@
return Texture;
}
-/// containsDuplicateComponents - Return true if any element access is
+/// containsDuplicateElements - Return true if any element access is
/// repeated.
-bool OCUVectorComponent::containsDuplicateComponents() const {
+bool OCUVectorElementExpr::containsDuplicateElements() const {
const char *compStr = Accessor.getName();
unsigned length = strlen(compStr);
@@ -618,9 +619,9 @@
}
/// getEncodedElementAccess - We encode fields with two bits per component.
-unsigned OCUVectorComponent::getEncodedElementAccess() const {
+unsigned OCUVectorElementExpr::getEncodedElementAccess() const {
const char *compStr = Accessor.getName();
- unsigned length = getNumComponents();
+ unsigned length = getNumElements();
unsigned Result = 0;
Modified: cfe/trunk/AST/StmtPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/AST/StmtPrinter.cpp?rev=40785&r1=40784&r2=40785&view=diff
==============================================================================
--- cfe/trunk/AST/StmtPrinter.cpp (original)
+++ cfe/trunk/AST/StmtPrinter.cpp Fri Aug 3 12:31:20 2007
@@ -439,7 +439,7 @@
assert(Field && "MemberExpr should alway reference a field!");
OS << Field->getName();
}
-void StmtPrinter::VisitOCUVectorComponent(OCUVectorComponent *Node) {
+void StmtPrinter::VisitOCUVectorElementExpr(OCUVectorElementExpr *Node) {
PrintExpr(Node->getBase());
OS << ".";
OS << Node->getAccessor().getName();
@@ -471,7 +471,7 @@
// GNU extensions.
-void StmtPrinter::VisitAddrLabel(AddrLabel *Node) {
+void StmtPrinter::VisitAddrLabelExpr(AddrLabelExpr *Node) {
OS << "&&" << Node->getLabel()->getName();
}
Modified: cfe/trunk/CodeGen/CGExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/CodeGen/CGExpr.cpp?rev=40785&r1=40784&r2=40785&view=diff
==============================================================================
--- cfe/trunk/CodeGen/CGExpr.cpp (original)
+++ cfe/trunk/CodeGen/CGExpr.cpp Fri Aug 3 12:31:20 2007
@@ -253,8 +253,8 @@
return EmitUnaryOpLValue(cast<UnaryOperator>(E));
case Expr::ArraySubscriptExprClass:
return EmitArraySubscriptExpr(cast<ArraySubscriptExpr>(E));
- case Expr::OCUVectorComponentClass:
- return EmitOCUVectorComponentExpr(cast<OCUVectorComponent>(E));
+ case Expr::OCUVectorElementExprClass:
+ return EmitOCUVectorElementExpr(cast<OCUVectorElementExpr>(E));
}
}
@@ -285,24 +285,24 @@
// 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.isOCUVectorComp())
- return EmitLoadOfOCUComponentLValue(LV, ExprType);
+ if (LV.isOCUVectorElt())
+ return EmitLoadOfOCUElementLValue(LV, ExprType);
assert(0 && "Bitfield ref not impl!");
}
// 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::EmitLoadOfOCUComponentLValue(LValue LV,
+RValue CodeGenFunction::EmitLoadOfOCUElementLValue(LValue LV,
QualType ExprType) {
llvm::Value *Vec = Builder.CreateLoad(LV.getOCUVectorAddr(), "tmp");
- unsigned EncFields = LV.getOCUVectorComp();
+ unsigned EncFields = LV.getOCUVectorElts();
// If the result of the expression is a non-vector type, we must be
// extracting a single element. Just codegen as an extractelement.
if (!isa<VectorType>(ExprType)) {
- unsigned InIdx = OCUVectorComponent::getAccessedFieldNo(0, EncFields);
+ unsigned InIdx = OCUVectorElementExpr::getAccessedFieldNo(0, EncFields);
llvm::Value *Elt = llvm::ConstantInt::get(llvm::Type::Int32Ty, InIdx);
return RValue::get(Builder.CreateExtractElement(Vec, Elt, "tmp"));
}
@@ -316,7 +316,7 @@
if (NumResultElts == NumSourceElts) {
llvm::SmallVector<llvm::Constant*, 4> Mask;
for (unsigned i = 0; i != NumResultElts; ++i) {
- unsigned InIdx = OCUVectorComponent::getAccessedFieldNo(i, EncFields);
+ unsigned InIdx = OCUVectorElementExpr::getAccessedFieldNo(i, EncFields);
Mask.push_back(llvm::ConstantInt::get(llvm::Type::Int32Ty, InIdx));
}
@@ -332,7 +332,7 @@
// Extract/Insert each element of the result.
for (unsigned i = 0; i != NumResultElts; ++i) {
- unsigned InIdx = OCUVectorComponent::getAccessedFieldNo(i, EncFields);
+ unsigned InIdx = OCUVectorElementExpr::getAccessedFieldNo(i, EncFields);
llvm::Value *Elt = llvm::ConstantInt::get(llvm::Type::Int32Ty, InIdx);
Elt = Builder.CreateExtractElement(Vec, Elt, "tmp");
@@ -366,7 +366,7 @@
}
// If this is an update of elements of a vector, insert them as appropriate.
- if (Dst.isOCUVectorComp())
+ if (Dst.isOCUVectorElt())
return EmitStoreThroughOCUComponentLValue(Src, Dst, Ty);
assert(0 && "FIXME: Don't support store to bitfield yet");
@@ -423,7 +423,7 @@
// value now.
llvm::Value *Vec = Builder.CreateLoad(Dst.getOCUVectorAddr(), "tmp");
// FIXME: Volatility.
- unsigned EncFields = Dst.getOCUVectorComp();
+ unsigned EncFields = Dst.getOCUVectorElts();
llvm::Value *SrcVal = Src.getVal();
@@ -435,13 +435,13 @@
llvm::Value *Elt = llvm::ConstantInt::get(llvm::Type::Int32Ty, i);
Elt = Builder.CreateExtractElement(SrcVal, Elt, "tmp");
- unsigned Idx = OCUVectorComponent::getAccessedFieldNo(i, EncFields);
+ unsigned Idx = OCUVectorElementExpr::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 = OCUVectorComponent::getAccessedFieldNo(0, EncFields);
+ unsigned InIdx = OCUVectorElementExpr::getAccessedFieldNo(0, EncFields);
llvm::Value *Elt = llvm::ConstantInt::get(llvm::Type::Int32Ty, InIdx);
Vec = Builder.CreateInsertElement(Vec, SrcVal, Elt, "tmp");
}
@@ -570,13 +570,13 @@
}
LValue CodeGenFunction::
-EmitOCUVectorComponentExpr(const OCUVectorComponent *E) {
+EmitOCUVectorElementExpr(const OCUVectorElementExpr *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::MakeOCUVectorComp(Base.getAddress(),
- E->getEncodedElementAccess());
+ return LValue::MakeOCUVectorElt(Base.getAddress(),
+ E->getEncodedElementAccess());
}
//===--------------------------------------------------------------------===//
@@ -601,7 +601,7 @@
return EmitLoadOfLValue(E);
case Expr::ArraySubscriptExprClass:
return EmitArraySubscriptExprRV(cast<ArraySubscriptExpr>(E));
- case Expr::OCUVectorComponentClass:
+ case Expr::OCUVectorElementExprClass:
return EmitLoadOfLValue(E);
case Expr::PreDefinedExprClass:
case Expr::StringLiteralClass:
Modified: cfe/trunk/CodeGen/CodeGenFunction.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/CodeGen/CodeGenFunction.h?rev=40785&r1=40784&r2=40785&view=diff
==============================================================================
--- cfe/trunk/CodeGen/CodeGenFunction.h (original)
+++ cfe/trunk/CodeGen/CodeGenFunction.h Fri Aug 3 12:31:20 2007
@@ -54,7 +54,7 @@
class BinaryOperator;
class CompoundAssignOperator;
class ArraySubscriptExpr;
- class OCUVectorComponent;
+ class OCUVectorElementExpr;
class ConditionalOperator;
class PreDefinedExpr;
@@ -120,31 +120,31 @@
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*.
- OCUVectorComp // This is an ocu vector subset, use getOCUVectorComp
+ OCUVectorElt // This is an ocu vector subset, use getOCUVectorComp
} LVType;
llvm::Value *V;
union {
llvm::Value *VectorIdx; // Index into a vector subscript: V[i]
- unsigned VectorComp; // Encoded OCUVector element subset: V.xyx
+ unsigned VectorElts; // Encoded OCUVector element subset: V.xyx
};
public:
bool isSimple() const { return LVType == Simple; }
bool isVectorElt() const { return LVType == VectorElt; }
bool isBitfield() const { return LVType == BitField; }
- bool isOCUVectorComp() const { return LVType == OCUVectorComp; }
+ bool isOCUVectorElt() const { return LVType == OCUVectorElt; }
// 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 components.
- llvm::Value *getOCUVectorAddr() const { assert(isOCUVectorComp()); return V; }
- unsigned getOCUVectorComp() const {
- assert(isOCUVectorComp());
- return VectorComp;
+ // ocu vector elements.
+ llvm::Value *getOCUVectorAddr() const { assert(isOCUVectorElt()); return V; }
+ unsigned getOCUVectorElts() const {
+ assert(isOCUVectorElt());
+ return VectorElts;
}
@@ -163,11 +163,11 @@
return R;
}
- static LValue MakeOCUVectorComp(llvm::Value *Vec, unsigned Components) {
+ static LValue MakeOCUVectorElt(llvm::Value *Vec, unsigned Elements) {
LValue R;
- R.LVType = OCUVectorComp;
+ R.LVType = OCUVectorElt;
R.V = Vec;
- R.VectorComp = Components;
+ R.VectorElts = Elements;
return R;
}
};
@@ -316,7 +316,7 @@
/// rvalue, returning the rvalue.
RValue EmitLoadOfLValue(const Expr *E);
RValue EmitLoadOfLValue(LValue V, QualType LVType);
- RValue EmitLoadOfOCUComponentLValue(LValue V, QualType LVType);
+ RValue EmitLoadOfOCUElementLValue(LValue V, QualType LVType);
/// EmitStoreThroughLValue - Store the specified rvalue into the specified
@@ -330,7 +330,7 @@
LValue EmitPreDefinedLValue(const PreDefinedExpr *E);
LValue EmitUnaryOpLValue(const UnaryOperator *E);
LValue EmitArraySubscriptExpr(const ArraySubscriptExpr *E);
- LValue EmitOCUVectorComponentExpr(const OCUVectorComponent *E);
+ LValue EmitOCUVectorElementExpr(const OCUVectorElementExpr *E);
//===--------------------------------------------------------------------===//
// Expression Emission
Modified: cfe/trunk/Sema/SemaExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Sema/SemaExpr.cpp?rev=40785&r1=40784&r2=40785&view=diff
==============================================================================
--- cfe/trunk/Sema/SemaExpr.cpp (original)
+++ cfe/trunk/Sema/SemaExpr.cpp Fri Aug 3 12:31:20 2007
@@ -438,7 +438,7 @@
QualType ret = CheckOCUVectorComponent(BaseType, OpLoc, Member, MemberLoc);
if (ret.isNull())
return true;
- return new OCUVectorComponent(ret, BaseExpr, Member, MemberLoc);
+ return new OCUVectorElementExpr(ret, BaseExpr, Member, MemberLoc);
} else
return Diag(OpLoc, diag::err_typecheck_member_reference_structUnion,
SourceRange(MemberLoc));
@@ -1545,8 +1545,8 @@
LabelDecl = new LabelStmt(LabLoc, LabelII, 0);
// Create the AST node. The address of a label always has type 'void*'.
- return new AddrLabel(OpLoc, LabLoc, LabelDecl,
- Context.getPointerType(Context.VoidTy));
+ return new AddrLabelExpr(OpLoc, LabLoc, LabelDecl,
+ Context.getPointerType(Context.VoidTy));
}
Sema::ExprResult Sema::ParseStmtExpr(SourceLocation LPLoc, StmtTy *substmt,
Modified: cfe/trunk/include/clang/AST/Expr.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Expr.h?rev=40785&r1=40784&r2=40785&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/Expr.h (original)
+++ cfe/trunk/include/clang/AST/Expr.h Fri Aug 3 12:31:20 2007
@@ -463,39 +463,40 @@
static bool classof(const MemberExpr *) { return true; }
};
-/// OCUVectorComponent - This represents access to specific components of a
+/// OCUVectorElementExpr - 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.
///
-class OCUVectorComponent : public Expr {
+class OCUVectorElementExpr : public Expr {
Expr *Base;
IdentifierInfo &Accessor;
SourceLocation AccessorLoc;
public:
- enum ComponentType {
+ enum ElementType {
Point, // xywz
Color, // rgba
Texture // uv
};
- OCUVectorComponent(QualType ty, Expr *base, IdentifierInfo &accessor,
- SourceLocation loc) : Expr(OCUVectorComponentClass, ty),
- Base(base), Accessor(accessor), AccessorLoc(loc) {}
+ OCUVectorElementExpr(QualType ty, Expr *base, IdentifierInfo &accessor,
+ SourceLocation loc)
+ : Expr(OCUVectorElementExprClass, ty),
+ Base(base), Accessor(accessor), AccessorLoc(loc) {}
const Expr *getBase() const { return Base; }
Expr *getBase() { return Base; }
IdentifierInfo &getAccessor() const { return Accessor; }
- /// getNumComponents - Get the number of components being selected.
- unsigned getNumComponents() const;
+ /// getNumElements - Get the number of components being selected.
+ unsigned getNumElements() const;
- /// getComponentType - Determine whether the components of this access are
+ /// getElementType - Determine whether the components of this access are
/// "point" "color" or "texture" elements.
- ComponentType getComponentType() const;
+ ElementType getElementType() const;
- /// containsDuplicateComponents - Return true if any element access is
+ /// containsDuplicateElements - Return true if any element access is
/// repeated.
- bool containsDuplicateComponents() const;
+ bool containsDuplicateElements() const;
/// getEncodedElementAccess - Encode the elements accessed into a bit vector.
/// The encoding currently uses 2-bit bitfields, but clients should use the
@@ -514,9 +515,9 @@
}
virtual void visit(StmtVisitor &Visitor);
static bool classof(const Stmt *T) {
- return T->getStmtClass() == OCUVectorComponentClass;
+ return T->getStmtClass() == OCUVectorElementExprClass;
}
- static bool classof(const OCUVectorComponent *) { return true; }
+ static bool classof(const OCUVectorElementExpr *) { return true; }
};
/// CompoundLiteralExpr - [C99 6.5.2.5]
@@ -699,13 +700,14 @@
static bool classof(const ConditionalOperator *) { return true; }
};
-/// AddrLabel - The GNU address of label extension, representing &&label.
-class AddrLabel : public Expr {
+/// AddrLabelExpr - The GNU address of label extension, representing &&label.
+class AddrLabelExpr : public Expr {
SourceLocation AmpAmpLoc, LabelLoc;
LabelStmt *Label;
public:
- AddrLabel(SourceLocation AALoc, SourceLocation LLoc, LabelStmt *L, QualType t)
- : Expr(AddrLabelClass, t), AmpAmpLoc(AALoc), LabelLoc(LLoc), Label(L) {}
+ AddrLabelExpr(SourceLocation AALoc, SourceLocation LLoc, LabelStmt *L,
+ QualType t)
+ : Expr(AddrLabelExprClass, t), AmpAmpLoc(AALoc), LabelLoc(LLoc), Label(L) {}
virtual SourceRange getSourceRange() const {
return SourceRange(AmpAmpLoc, LabelLoc);
@@ -715,9 +717,9 @@
virtual void visit(StmtVisitor &Visitor);
static bool classof(const Stmt *T) {
- return T->getStmtClass() == AddrLabelClass;
+ return T->getStmtClass() == AddrLabelExprClass;
}
- static bool classof(const AddrLabel *) { return true; }
+ static bool classof(const AddrLabelExpr *) { return true; }
};
/// StmtExpr - This is the GNU Statement Expression extension: ({int X=4; X;}).
Modified: cfe/trunk/include/clang/AST/StmtNodes.def
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/StmtNodes.def?rev=40785&r1=40784&r2=40785&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/StmtNodes.def (original)
+++ cfe/trunk/include/clang/AST/StmtNodes.def Fri Aug 3 12:31:20 2007
@@ -62,10 +62,10 @@
STMT(46, ConditionalOperator , Expr)
STMT(47, ImplicitCastExpr , Expr)
STMT(48, CompoundLiteralExpr , Expr)
-STMT(49, OCUVectorComponent , Expr)
+STMT(49, OCUVectorElementExpr , Expr)
// GNU Extensions.
-STMT(50, AddrLabel , Expr)
+STMT(50, AddrLabelExpr , Expr)
STMT(51, StmtExpr , Expr)
STMT(52, TypesCompatibleExpr , Expr)
More information about the cfe-commits
mailing list