[llvm-commits] [dragonegg] r154742 - in /dragonegg/trunk: include/dragonegg/Trees.h include/x86/dragonegg/Target.h src/Backend.cpp src/Constants.cpp src/Convert.cpp src/Debug.cpp src/DefaultABI.cpp src/Types.cpp src/arm/Target.cpp
Duncan Sands
baldrick at free.fr
Sat Apr 14 04:23:55 PDT 2012
Author: baldrick
Date: Sat Apr 14 06:23:54 2012
New Revision: 154742
URL: http://llvm.org/viewvc/llvm-project?rev=154742&view=rev
Log:
Use the "isa" pattern instead of GCC predicates, for example
AGGREGATE_TYPE_P -> isa<AGGREGATE_TYPE>. This doesn't bring
much added value, it is just more uniform stylistically.
Modified:
dragonegg/trunk/include/dragonegg/Trees.h
dragonegg/trunk/include/x86/dragonegg/Target.h
dragonegg/trunk/src/Backend.cpp
dragonegg/trunk/src/Constants.cpp
dragonegg/trunk/src/Convert.cpp
dragonegg/trunk/src/Debug.cpp
dragonegg/trunk/src/DefaultABI.cpp
dragonegg/trunk/src/Types.cpp
dragonegg/trunk/src/arm/Target.cpp
Modified: dragonegg/trunk/include/dragonegg/Trees.h
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/include/dragonegg/Trees.h?rev=154742&r1=154741&r2=154742&view=diff
==============================================================================
--- dragonegg/trunk/include/dragonegg/Trees.h (original)
+++ dragonegg/trunk/include/dragonegg/Trees.h Sat Apr 14 06:23:54 2012
@@ -38,7 +38,11 @@
/// dragonegg_tree_code - Fake helper tree codes.
enum dragonegg_tree_code {
- STRUCT_TYPE, // A record, union or qualified union type.
+ ACCESS_TYPE, // A pointer or reference type.
+ AGGREGATE_TYPE, // A record, union, qualified union or array type.
+ FLOAT_TYPE, // A scalar, complex or vector floating point type.
+ INTEGRAL_TYPE, // A enumeral, boolean or integer type.
+ RECORD_OR_UNION_TYPE, // A record, union or qualified union type.
};
/// isa - Return true if the given tree has the specified code.
@@ -47,8 +51,16 @@
}
template<enum dragonegg_tree_code code> bool isa(const_tree t) {
switch (code) {
- case STRUCT_TYPE:
- return isa<RECORD_TYPE>(t) || isa<UNION_TYPE>(t) || isa<QUAL_UNION_TYPE>(t);
+ case ACCESS_TYPE:
+ return POINTER_TYPE_P(t);
+ case AGGREGATE_TYPE:
+ return AGGREGATE_TYPE_P(t);
+ case FLOAT_TYPE:
+ return FLOAT_TYPE_P(t);
+ case INTEGRAL_TYPE:
+ return INTEGRAL_TYPE_P(t);
+ case RECORD_OR_UNION_TYPE:
+ return RECORD_OR_UNION_TYPE_P(t);
}
}
Modified: dragonegg/trunk/include/x86/dragonegg/Target.h
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/include/x86/dragonegg/Target.h?rev=154742&r1=154741&r2=154742&view=diff
==============================================================================
--- dragonegg/trunk/include/x86/dragonegg/Target.h (original)
+++ dragonegg/trunk/include/x86/dragonegg/Target.h Sat Apr 14 06:23:54 2012
@@ -78,8 +78,8 @@
PAttribute |= Attribute::InReg; \
else \
local_fp_regparm = 0; \
- } else if (INTEGRAL_TYPE_P(Type) || \
- POINTER_TYPE_P(Type)) { \
+ } else if (isa<INTEGRAL_TYPE>(Type) || \
+ isa<ACCESS_TYPE>(Type)) { \
int words = \
(Size + BITS_PER_WORD - 1) / BITS_PER_WORD; \
local_regparm -= words; \
Modified: dragonegg/trunk/src/Backend.cpp
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/src/Backend.cpp?rev=154742&r1=154741&r2=154742&view=diff
==============================================================================
--- dragonegg/trunk/src/Backend.cpp (original)
+++ dragonegg/trunk/src/Backend.cpp Sat Apr 14 06:23:54 2012
@@ -1031,7 +1031,7 @@
#endif
else if (DECL_INITIAL(decl) != 0 && TREE_STATIC(decl))
error("global register variable has initial value");
- else if (AGGREGATE_TYPE_P(TREE_TYPE(decl)))
+ else if (isa<AGGREGATE_TYPE>(TREE_TYPE(decl)))
sorry("LLVM cannot handle register variable %<%s%>, report a bug",
RegName);
else {
Modified: dragonegg/trunk/src/Constants.cpp
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/src/Constants.cpp?rev=154742&r1=154741&r2=154742&view=diff
==============================================================================
--- dragonegg/trunk/src/Constants.cpp (original)
+++ dragonegg/trunk/src/Constants.cpp Sat Apr 14 06:23:54 2012
@@ -690,7 +690,7 @@
// If the types differ then this is probably something like a struct ending in
// a flexible array being initialized with a struct ending in an array of some
// definite size.
- if (AGGREGATE_TYPE_P(type) || AGGREGATE_TYPE_P(TREE_TYPE(exp)))
+ if (isa<AGGREGATE_TYPE>(type) || isa<AGGREGATE_TYPE>(TREE_TYPE(exp)))
return C;
// Scalar to scalar cast. This is where the implicit scalar casts that GCC
@@ -1426,7 +1426,7 @@
// Make the IR easier to read by returning a constant of the expected type if
// it is safe and efficient to do so.
- if (!AGGREGATE_TYPE_P(TREE_TYPE(exp)))
+ if (!isa<AGGREGATE_TYPE>(TREE_TYPE(exp)))
Init = InterpretAsType(Init, ConvertType(TREE_TYPE(exp)), 0, Folder);
#ifndef NDEBUG
@@ -1651,7 +1651,7 @@
// Ensure that the address has the expected type. It is simpler to do this
// once here rather than in every AddressOf helper.
Type *Ty;
- if (VOID_TYPE_P(TREE_TYPE(exp)))
+ if (isa<VOID_TYPE>(TREE_TYPE(exp)))
Ty = GetUnitPointerType(Context); // void* -> i8*.
else
Ty = ConvertType(TREE_TYPE(exp))->getPointerTo();
Modified: dragonegg/trunk/src/Convert.cpp
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/src/Convert.cpp?rev=154742&r1=154741&r2=154742&view=diff
==============================================================================
--- dragonegg/trunk/src/Convert.cpp (original)
+++ dragonegg/trunk/src/Convert.cpp Sat Apr 14 06:23:54 2012
@@ -86,7 +86,7 @@
/// getPointerAlignment - Return the alignment in bytes of exp, a pointer valued
/// expression, or 1 if the alignment is not known.
static unsigned int getPointerAlignment(tree exp) {
- assert(POINTER_TYPE_P (TREE_TYPE (exp)) && "Expected a pointer type!");
+ assert(isa<ACCESS_TYPE>(TREE_TYPE (exp)) && "Expected a pointer type!");
unsigned int align =
#if (GCC_MINOR < 7)
get_pointer_alignment(exp, BIGGEST_ALIGNMENT);
@@ -133,7 +133,7 @@
/// other types, such as the x86 128 bit floating point type.
static StringRef SelectFPName(tree type, StringRef FloatName,
StringRef DoubleName, StringRef LongDoubleName) {
- assert(SCALAR_FLOAT_TYPE_P(type) && "Expected a floating point type!");
+ assert(isa<REAL_TYPE>(type) && "Expected a floating point type!");
if (TYPE_MODE(type) == TYPE_MODE(float_type_node))
return FloatName;
if (TYPE_MODE(type) == TYPE_MODE(double_type_node))
@@ -294,7 +294,7 @@
/// describeTypeRange - Return metadata describing the set of possible values
/// that an in-memory variable of the given GCC type can take on.
static MDNode *describeTypeRange(tree type) {
- if (!INTEGRAL_TYPE_P(type)) return 0; // Only discrete types have ranges.
+ if (!isa<INTEGRAL_TYPE>(type)) return 0; // Only discrete types have ranges.
// The range of possible values is TYPE_MIN_VALUE .. TYPE_MAX_VALUE.
tree min = TYPE_MIN_VALUE(type);
@@ -1130,7 +1130,7 @@
EmitAnnotateIntrinsic(Tmp, Args);
// Emit gcroot intrinsic if arg has attribute
- if (POINTER_TYPE_P(TREE_TYPE(Args))
+ if (isa<ACCESS_TYPE>(TREE_TYPE(Args))
&& lookup_attribute ("gcroot", TYPE_ATTRIBUTES(TREE_TYPE(Args))))
EmitTypeGcroot(Tmp);
@@ -1323,7 +1323,7 @@
// If the function returns a value, get it into a register and return it now.
if (!Fn->getReturnType()->isVoidTy()) {
tree TreeRetVal = DECL_RESULT(FnDecl);
- if (!AGGREGATE_TYPE_P(TREE_TYPE(TreeRetVal)) &&
+ if (!isa<AGGREGATE_TYPE>(TREE_TYPE(TreeRetVal)) &&
!isa<COMPLEX_TYPE>(TREE_TYPE(TreeRetVal))) {
// If the DECL_RESULT is a scalar type, just load out the return value
// and return it.
@@ -1618,7 +1618,7 @@
/// EmitAggregate - Store the specified tree node into the location given by
/// DestLoc.
void TreeToLLVM::EmitAggregate(tree exp, const MemRef &DestLoc) {
- assert(AGGREGATE_TYPE_P(TREE_TYPE(exp)) && "Expected an aggregate type!");
+ assert(isa<AGGREGATE_TYPE>(TREE_TYPE(exp)) && "Expected an aggregate type!");
if (isa<CONSTRUCTOR>(exp)) {
EmitCONSTRUCTOR(exp, &DestLoc);
return;
@@ -1724,7 +1724,7 @@
// node. This may not hold for bitfields because the type of a bitfield need
// not match the type of the value being loaded out of it. Since LLVM has no
// void* type, don't insist that void* be converted to a specific LLVM type.
- assert((LV.isBitfield() || VOID_TYPE_P(TREE_TYPE(exp)) ||
+ assert((LV.isBitfield() || isa<VOID_TYPE>(TREE_TYPE(exp)) ||
LV.Ptr->getType() == ConvertType(TREE_TYPE(exp))->getPointerTo()) &&
"LValue has wrong type!");
@@ -1788,7 +1788,7 @@
/// CreateAnyAdd - Add two LLVM scalar values with the given GCC type. Does not
/// support complex numbers. The type is used to set overflow flags.
Value *TreeToLLVM::CreateAnyAdd(Value *LHS, Value *RHS, tree type) {
- if (FLOAT_TYPE_P(type))
+ if (isa<FLOAT_TYPE>(type))
return Builder.CreateFAdd(LHS, RHS);
return Builder.CreateAdd(LHS, RHS, "", hasNUW(type), hasNSW(type));
}
@@ -1796,7 +1796,7 @@
/// CreateAnyMul - Multiply two LLVM scalar values with the given GCC type.
/// Does not support complex numbers. The type is used to set overflow flags.
Value *TreeToLLVM::CreateAnyMul(Value *LHS, Value *RHS, tree type) {
- if (FLOAT_TYPE_P(type))
+ if (isa<FLOAT_TYPE>(type))
return Builder.CreateFMul(LHS, RHS);
return Builder.CreateMul(LHS, RHS, "", hasNUW(type), hasNSW(type));
}
@@ -1804,7 +1804,7 @@
/// CreateAnyNeg - Negate an LLVM scalar value with the given GCC type. Does
/// not support complex numbers. The type is used to set overflow flags.
Value *TreeToLLVM::CreateAnyNeg(Value *V, tree type) {
- if (FLOAT_TYPE_P(type))
+ if (isa<FLOAT_TYPE>(type))
return Builder.CreateFNeg(V);
return Builder.CreateNeg(V, "", hasNUW(type), hasNSW(type));
}
@@ -1812,7 +1812,7 @@
/// CreateAnySub - Subtract two LLVM scalar values with the given GCC type.
/// Does not support complex numbers. The type is used to set overflow flags.
Value *TreeToLLVM::CreateAnySub(Value *LHS, Value *RHS, tree type) {
- if (FLOAT_TYPE_P(type))
+ if (isa<FLOAT_TYPE>(type))
return Builder.CreateFSub(LHS, RHS);
return Builder.CreateSub(LHS, RHS, "", hasNUW(type), hasNSW(type));
}
@@ -1878,7 +1878,7 @@
return TooCostly;
// A scalar copy has a cost of 1.
- if (!AGGREGATE_TYPE_P(type))
+ if (!isa<AGGREGATE_TYPE>(type))
return 1;
// The cost of a record type is the sum of the costs of its fields.
@@ -1931,7 +1931,7 @@
/// src/dest ptrs, copying all of the elements. Helper for EmitAggregateCopy.
void TreeToLLVM::CopyElementByElement(MemRef DestLoc, MemRef SrcLoc,
tree type) {
- if (!AGGREGATE_TYPE_P(type)) {
+ if (!isa<AGGREGATE_TYPE>(type)) {
// Copy scalar.
MDNode *AliasTag = describeAliasSet(type);
StoreRegisterToMemory(LoadRegisterFromMemory(SrcLoc, type, AliasTag,
@@ -2031,7 +2031,7 @@
/// ZeroElementByElement - Recursively traverse the potentially aggregate
/// DestLoc, zero'ing all of the elements. Helper for EmitAggregateZero.
void TreeToLLVM::ZeroElementByElement(MemRef DestLoc, tree type) {
- if (!AGGREGATE_TYPE_P(type)) {
+ if (!isa<AGGREGATE_TYPE>(type)) {
// Zero scalar.
StoreRegisterToMemory(Constant::getNullValue(getRegType(type)), DestLoc,
type, describeAliasSet(type), Builder);
@@ -2297,7 +2297,7 @@
EmitAnnotateIntrinsic(AI, decl);
// Handle gcroot attribute
- if (POINTER_TYPE_P(TREE_TYPE (decl))
+ if (isa<ACCESS_TYPE>(TREE_TYPE (decl))
&& lookup_attribute("gcroot", TYPE_ATTRIBUTES(TREE_TYPE (decl))))
{
// We should null out local variables so that a stack crawl
@@ -2832,7 +2832,7 @@
return BuildVector(BuildVecOps);
}
- assert(AGGREGATE_TYPE_P(type) && "Constructor for scalar type??");
+ assert(isa<AGGREGATE_TYPE>(type) && "Constructor for scalar type??");
// Start out with the value zero'd out.
EmitAggregateZero(*DestLoc, type);
@@ -2858,7 +2858,7 @@
if (!tree_purpose)
return 0; // Not actually initialized?
- if (AGGREGATE_TYPE_P(TREE_TYPE(tree_purpose))) {
+ if (isa<AGGREGATE_TYPE>(TREE_TYPE(tree_purpose))) {
EmitAggregate(tree_value, *DestLoc);
} else {
// Scalar value. Evaluate to a register, then do the store.
@@ -3221,7 +3221,7 @@
// A scalar - push the value.
Client.pushValue(EmitMemory(arg));
} else if (LLVM_SHOULD_PASS_AGGREGATE_AS_FCA(type, ArgTy)) {
- if (AGGREGATE_TYPE_P(type)) {
+ if (isa<AGGREGATE_TYPE>(type)) {
// Pass the aggregate as a first class value.
LValue ArgVal = EmitLV(arg);
Client.pushValue(Builder.CreateLoad(ArgVal.Ptr));
@@ -3230,7 +3230,7 @@
Client.pushValue(EmitMemory(arg));
}
} else {
- if (AGGREGATE_TYPE_P(type)) {
+ if (isa<AGGREGATE_TYPE>(type)) {
// An aggregate - push the address.
LValue ArgVal = EmitLV(arg);
assert(!ArgVal.isBitfield() && "Bitfields are first-class types!");
@@ -4026,7 +4026,7 @@
std::vector<Value*> Operands;
for (unsigned i = 0, e = gimple_call_num_args(stmt); i != e; ++i) {
tree OpVal = gimple_call_arg(stmt, i);
- if (AGGREGATE_TYPE_P(TREE_TYPE(OpVal))) {
+ if (isa<AGGREGATE_TYPE>(TREE_TYPE(OpVal))) {
MemRef OpLoc = CreateTempLoc(ConvertType(TREE_TYPE(OpVal)));
EmitAggregate(OpVal, OpLoc);
Operands.push_back(Builder.CreateLoad(OpLoc.Ptr));
@@ -5735,7 +5735,7 @@
Value *Arg1 = EmitMemory(Arg1T); // Emit the address of the destination.
// The second arg of llvm.va_copy is a pointer to a valist.
Value *Arg2;
- if (!AGGREGATE_TYPE_P(va_list_type_node)) {
+ if (!isa<AGGREGATE_TYPE>(va_list_type_node)) {
// Emit it as a value, then store it to a temporary slot.
Value *V2 = EmitMemory(Arg2T);
Arg2 = CreateTemporary(V2->getType());
@@ -5929,7 +5929,7 @@
// much nicer in cases like:
// float foo(int w, float A[][w], int g) { return A[g][0]; }
- if (VOID_TYPE_P(TREE_TYPE(ArrayTreeType))) {
+ if (isa<VOID_TYPE>(TREE_TYPE(ArrayTreeType))) {
ArrayAddr = Builder.CreateBitCast(ArrayAddr, Type::getInt8PtrTy(Context));
ArrayAddr = POINTER_TYPE_OVERFLOW_UNDEFINED ?
Builder.CreateInBoundsGEP(ArrayAddr, IndexVal) :
@@ -6003,7 +6003,7 @@
tree FieldDecl = TREE_OPERAND(exp, 1);
unsigned LVAlign = StructAddrLV.getAlignment();
- assert(isa<STRUCT_TYPE>(DECL_CONTEXT(FieldDecl)));
+ assert(isa<RECORD_OR_UNION_TYPE>(DECL_CONTEXT(FieldDecl)));
Type *StructTy = ConvertType(DECL_CONTEXT(FieldDecl));
@@ -6605,7 +6605,7 @@
// Unary expressions.
Value *TreeToLLVM::EmitReg_ABS_EXPR(tree op) {
- if (!FLOAT_TYPE_P(TREE_TYPE(op))) {
+ if (!isa<FLOAT_TYPE>(TREE_TYPE(op))) {
Value *Op = EmitRegister(op);
Value *OpN = Builder.CreateNeg(Op, Op->getName()+"neg");
ICmpInst::Predicate pred = TYPE_UNSIGNED(TREE_TYPE(op)) ?
@@ -6808,7 +6808,7 @@
Value *RHS = EmitRegister(op1);
Value *Compare;
- if (FLOAT_TYPE_P(TREE_TYPE(op0)))
+ if (isa<FLOAT_TYPE>(TREE_TYPE(op0)))
Compare = Builder.CreateFCmp(FCmpInst::Predicate(FPPred), LHS, RHS);
else if (TYPE_UNSIGNED(TREE_TYPE(op0)))
Compare = Builder.CreateICmp(ICmpInst::Predicate(UIPred), LHS, RHS);
@@ -6833,7 +6833,7 @@
Type *Ty = Val->getType();
CmpInst::Predicate Pred =
- CmpInst::Predicate(FLOAT_TYPE_P(TREE_TYPE(op)) ?
+ CmpInst::Predicate(isa<FLOAT_TYPE>(TREE_TYPE(op)) ?
FPPred : TYPE_UNSIGNED(TREE_TYPE(op)) ? UIPred : SIPred);
unsigned Length = (unsigned)TYPE_VECTOR_SUBPARTS(TREE_TYPE(op));
@@ -6856,7 +6856,7 @@
ConstantVector::get(Mask));
// Replace Val with the max/min of the extracted elements.
- Value *Compare = FLOAT_TYPE_P(TREE_TYPE(op)) ?
+ Value *Compare = isa<FLOAT_TYPE>(TREE_TYPE(op)) ?
Builder.CreateFCmp(Pred, LHS, RHS) : Builder.CreateICmp(Pred, LHS, RHS);
Val = Builder.CreateSelect(Compare, LHS, RHS);
@@ -7235,7 +7235,7 @@
Value *DSTr, *DSTi;
// (a+ib) * (c+id) = (ac-bd) + i(ad+cb)
- if (SCALAR_FLOAT_TYPE_P(elt_type)) {
+ if (isa<REAL_TYPE>(elt_type)) {
Value *Tmp1 = Builder.CreateFMul(LHSr, RHSr); // a*c
Value *Tmp2 = Builder.CreateFMul(LHSi, RHSi); // b*d
DSTr = Builder.CreateFSub(Tmp1, Tmp2); // ac-bd
@@ -7304,7 +7304,7 @@
Value *DSTr, *DSTi;
// (a+ib) / (c+id) = ((ac+bd)/(cc+dd)) + i((bc-ad)/(cc+dd))
- assert (SCALAR_FLOAT_TYPE_P(TREE_TYPE(type)) &&
+ assert (isa<REAL_TYPE>(TREE_TYPE(type)) &&
"RDIV_EXPR not floating point!");
Value *Tmp1 = Builder.CreateFMul(LHSr, RHSr); // a*c
Value *Tmp2 = Builder.CreateFMul(LHSi, RHSi); // b*d
@@ -7323,7 +7323,7 @@
return CreateComplex(DSTr, DSTi);
}
- assert(FLOAT_TYPE_P(type) && "RDIV_EXPR not floating point!");
+ assert(isa<FLOAT_TYPE>(type) && "RDIV_EXPR not floating point!");
return Builder.CreateFDiv(LHS, RHS);
}
@@ -8137,7 +8137,7 @@
void TreeToLLVM::RenderGIMPLE_ASSIGN(gimple stmt) {
tree lhs = gimple_assign_lhs(stmt);
- if (AGGREGATE_TYPE_P(TREE_TYPE(lhs))) {
+ if (isa<AGGREGATE_TYPE>(TREE_TYPE(lhs))) {
assert(get_gimple_rhs_class(gimple_expr_code(stmt)) == GIMPLE_SINGLE_RHS &&
"Aggregate type but rhs not simple!");
LValue LV = EmitLV(lhs);
@@ -8152,7 +8152,7 @@
tree lhs = gimple_call_lhs(stmt);
if (!lhs) {
// The returned value is not used.
- if (!AGGREGATE_TYPE_P(gimple_call_return_type(stmt))) {
+ if (!isa<AGGREGATE_TYPE>(gimple_call_return_type(stmt))) {
OutputCallRHS(stmt, 0);
return;
}
@@ -8164,7 +8164,7 @@
return;
}
- if (AGGREGATE_TYPE_P(TREE_TYPE(lhs))) {
+ if (isa<AGGREGATE_TYPE>(TREE_TYPE(lhs))) {
LValue LV = EmitLV(lhs);
MemRef NewLoc(LV.Ptr, LV.getAlignment(), TREE_THIS_VOLATILE(lhs));
OutputCallRHS(stmt, &NewLoc);
@@ -8348,7 +8348,7 @@
if (retval && retval != error_mark_node && retval != result) {
// Store the return value to the function's DECL_RESULT.
MemRef DestLoc(DECL_LOCAL(result), 1, false); // FIXME: What alignment?
- if (AGGREGATE_TYPE_P(TREE_TYPE(result))) {
+ if (isa<AGGREGATE_TYPE>(TREE_TYPE(result))) {
EmitAggregate(retval, DestLoc);
} else {
Value *Val = Builder.CreateBitCast(EmitRegister(retval),
@@ -8600,7 +8600,7 @@
/// EmitAssignSingleRHS - Helper for EmitAssignRHS. Handles those RHS that are
/// not register expressions.
Value *TreeToLLVM::EmitAssignSingleRHS(tree rhs) {
- assert(!AGGREGATE_TYPE_P(TREE_TYPE(rhs)) && "Expected a scalar type!");
+ assert(!isa<AGGREGATE_TYPE>(TREE_TYPE(rhs)) && "Expected a scalar type!");
switch (TREE_CODE(rhs)) {
// Catch-all for SSA names, constants etc.
Modified: dragonegg/trunk/src/Debug.cpp
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/src/Debug.cpp?rev=154742&r1=154741&r2=154742&view=diff
==============================================================================
--- dragonegg/trunk/src/Debug.cpp (original)
+++ dragonegg/trunk/src/Debug.cpp Sat Apr 14 06:23:54 2012
@@ -828,7 +828,8 @@
continue;
/* Ignore nameless fields. */
- if (DECL_NAME (Member) == NULL_TREE && !isa<STRUCT_TYPE>(TREE_TYPE(Member)))
+ if (DECL_NAME (Member) == NULL_TREE &&
+ !isa<RECORD_OR_UNION_TYPE>(TREE_TYPE(Member)))
continue;
// Field type is the declared type of the field.
Modified: dragonegg/trunk/src/DefaultABI.cpp
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/src/DefaultABI.cpp?rev=154742&r1=154741&r2=154742&view=diff
==============================================================================
--- dragonegg/trunk/src/DefaultABI.cpp (original)
+++ dragonegg/trunk/src/DefaultABI.cpp Sat Apr 14 06:23:54 2012
@@ -71,7 +71,7 @@
// Complex numbers have two fields.
if (isa<COMPLEX_TYPE>(type)) return 0;
// All other scalars are good.
- if (!AGGREGATE_TYPE_P(type)) return type;
+ if (!isa<AGGREGATE_TYPE>(type)) return type;
tree FoundField = 0;
switch (TREE_CODE(type)) {
@@ -117,7 +117,7 @@
/// isZeroSizedStructOrUnion - Returns true if this is a struct or union
/// which is zero bits wide.
bool isZeroSizedStructOrUnion(tree type) {
- if (!isa<STRUCT_TYPE>(type))
+ if (!isa<RECORD_OR_UNION_TYPE>(type))
return false;
return int_size_in_bytes(type) == 0;
}
@@ -173,7 +173,7 @@
// FIXME: should return the hidden first argument for some targets
// (e.g. ELF i386).
- if (AGGREGATE_TYPE_P(type))
+ if (isa<AGGREGATE_TYPE>(type))
C.HandleAggregateShadowResult(Ty->getPointerTo(), false);
else
C.HandleScalarShadowResult(Ty->getPointerTo(), false);
Modified: dragonegg/trunk/src/Types.cpp
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/src/Types.cpp?rev=154742&r1=154741&r2=154742&view=diff
==============================================================================
--- dragonegg/trunk/src/Types.cpp (original)
+++ dragonegg/trunk/src/Types.cpp Sat Apr 14 06:23:54 2012
@@ -284,7 +284,7 @@
/// getPointerToType - Returns the LLVM register type to use for a pointer to
/// the given GCC type.
Type *getPointerToType(tree type) {
- if (VOID_TYPE_P(type))
+ if (isa<VOID_TYPE>(type))
// void* -> byte*
return GetUnitPointerType(Context);
// FIXME: Handle address spaces.
@@ -425,7 +425,7 @@
// NOTE: Any changes made here need to be reflected in LoadRegisterFromMemory,
// StoreRegisterToMemory and ExtractRegisterFromConstant.
- assert(!AGGREGATE_TYPE_P(type) && "Registers must have a scalar type!");
+ assert(!isa<AGGREGATE_TYPE>(type) && "Registers must have a scalar type!");
assert(!isa<VOID_TYPE>(type) && "Registers cannot have void type!");
switch (TREE_CODE(type)) {
@@ -453,7 +453,7 @@
case POINTER_TYPE:
case REFERENCE_TYPE:
// void* -> byte*
- return VOID_TYPE_P(TREE_TYPE(type)) ? GetUnitPointerType(Context) :
+ return isa<VOID_TYPE>(TREE_TYPE(type)) ? GetUnitPointerType(Context) :
ConvertType(TREE_TYPE(type))->getPointerTo();
case REAL_TYPE:
@@ -476,7 +476,7 @@
case VECTOR_TYPE: {
// LLVM does not support vectors of pointers, so turn any pointers into
// integers.
- Type *EltTy = POINTER_TYPE_P(TREE_TYPE(type)) ?
+ Type *EltTy = isa<ACCESS_TYPE>(TREE_TYPE(type)) ?
getTargetData().getIntPtrType(Context) : getRegType(TREE_TYPE(type));
return VectorType::get(EltTy, TYPE_VECTOR_SUBPARTS(type));
}
@@ -710,7 +710,7 @@
PAttributes |= HandleArgumentExtension(ArgTy);
// Compute noalias attributes.
- if (POINTER_TYPE_P(ArgTy) && TYPE_RESTRICT(ArgTy))
+ if (isa<ACCESS_TYPE>(ArgTy) && TYPE_RESTRICT(ArgTy))
PAttributes |= Attribute::NoAlias;
if (PAttributes != Attribute::None)
@@ -852,13 +852,13 @@
// inspect it for restrict qualifiers, otherwise try the argument
// types.
tree RestrictArgTy = (DeclArgs) ? TREE_TYPE(DeclArgs) : ArgTy;
- if (POINTER_TYPE_P(RestrictArgTy) && TYPE_RESTRICT(RestrictArgTy))
+ if (isa<ACCESS_TYPE>(RestrictArgTy) && TYPE_RESTRICT(RestrictArgTy))
PAttributes |= Attribute::NoAlias;
#ifdef LLVM_TARGET_ENABLE_REGPARM
// Allow the target to mark this as inreg.
- if (INTEGRAL_TYPE_P(ArgTy) || POINTER_TYPE_P(ArgTy) ||
- SCALAR_FLOAT_TYPE_P(ArgTy))
+ if (isa<INTEGRAL_TYPE>(ArgTy) || isa<ACCESS_TYPE>(ArgTy) ||
+ isa<REAL_TYPE>(ArgTy))
LLVM_ADJUST_REGPARM_ATTRIBUTE(PAttributes, ArgTy,
TREE_INT_CST_LOW(TYPE_SIZE(ArgTy)),
local_regparam, local_fp_regparam);
@@ -939,7 +939,7 @@
// If the pointee is a record or union type then return a pointer to its
// placeholder type. Otherwise return {}*.
- if (isa<STRUCT_TYPE>(pointee))
+ if (isa<RECORD_OR_UNION_TYPE>(pointee))
PointeeTy = getCachedType(pointee);
else
PointeeTy = StructType::get(Context);
@@ -1423,7 +1423,7 @@
Type *Ty;
// LLVM does not support vectors of pointers, so turn any pointers into
// integers.
- if (POINTER_TYPE_P(TREE_TYPE(type)))
+ if (isa<ACCESS_TYPE>(TREE_TYPE(type)))
Ty = getTargetData().getIntPtrType(Context);
else
Ty = ConvertTypeNonRecursive(main_type(type));
@@ -1565,7 +1565,7 @@
// the nasty {}* type we are obliged to return in general.
for (size_t i = 0, e = SCC.size(); i != e; ++i) {
tree some_type = SCC[i];
- if (!isa<STRUCT_TYPE>(some_type)) {
+ if (!isa<RECORD_OR_UNION_TYPE>(some_type)) {
assert(!getCachedType(some_type) && "Type already converted!");
continue;
}
@@ -1606,11 +1606,11 @@
if (SCC.size() > 1)
for (size_t i = 0, e = SCC.size(); i != e; ++i) {
tree some_type = SCC[i];
- if (POINTER_TYPE_P(some_type)) {
+ if (isa<ACCESS_TYPE>(some_type)) {
tree pointee = main_type(some_type);
// The pointee cannot have void type since the SCC contains more than
// one type.
- assert(!VOID_TYPE_P(pointee) && "Self-recursive void*!");
+ assert(!isa<VOID_TYPE>(pointee) && "Self-recursive void*!");
// The pointee must have been converted since it has to be in the same
// SCC as the pointer (since the SCC contains more than one type).
Type *PointeeTy = getCachedType(pointee);
Modified: dragonegg/trunk/src/arm/Target.cpp
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/src/arm/Target.cpp?rev=154742&r1=154741&r2=154742&view=diff
==============================================================================
--- dragonegg/trunk/src/arm/Target.cpp (original)
+++ dragonegg/trunk/src/arm/Target.cpp Sat Apr 14 06:23:54 2012
@@ -77,7 +77,7 @@
HOST_WIDE_INT bytes =
(mode == BLKmode) ? int_size_in_bytes (type) : (int) GET_MODE_SIZE (mode);
- if (type && AGGREGATE_TYPE_P (type))
+ if (type && isa<AGGREGATE_TYPE>(type))
{
int i;
int cnt = 0;
More information about the llvm-commits
mailing list