[llvm-commits] [dragonegg] r155119 - in /dragonegg/trunk: include/dragonegg/Trees.h src/Aliasing.cpp src/Convert.cpp src/Debug.cpp src/Trees.cpp src/Types.cpp
Duncan Sands
baldrick at free.fr
Thu Apr 19 04:29:14 PDT 2012
Author: baldrick
Date: Thu Apr 19 06:29:13 2012
New Revision: 155119
URL: http://llvm.org/viewvc/llvm-project?rev=155119&view=rev
Log:
TYPE_STUB_DECL can only be applied to types. Add a helper for testing
whether trees are types and use it here and elsewhere. Fixes a few more
existing testcases when using gcc-4.7.
Modified:
dragonegg/trunk/include/dragonegg/Trees.h
dragonegg/trunk/src/Aliasing.cpp
dragonegg/trunk/src/Convert.cpp
dragonegg/trunk/src/Debug.cpp
dragonegg/trunk/src/Trees.cpp
dragonegg/trunk/src/Types.cpp
Modified: dragonegg/trunk/include/dragonegg/Trees.h
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/include/dragonegg/Trees.h?rev=155119&r1=155118&r2=155119&view=diff
==============================================================================
--- dragonegg/trunk/include/dragonegg/Trees.h (original)
+++ dragonegg/trunk/include/dragonegg/Trees.h Thu Apr 19 06:29:13 2012
@@ -43,6 +43,7 @@
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.
+ TYPE, // Any type.
};
/// isa - Return true if the given tree has the specified code.
@@ -61,6 +62,8 @@
return INTEGRAL_TYPE_P(t);
case RECORD_OR_UNION_TYPE:
return RECORD_OR_UNION_TYPE_P(t);
+ case TYPE:
+ return TYPE_P(t);
}
}
Modified: dragonegg/trunk/src/Aliasing.cpp
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/src/Aliasing.cpp?rev=155119&r1=155118&r2=155119&view=diff
==============================================================================
--- dragonegg/trunk/src/Aliasing.cpp (original)
+++ dragonegg/trunk/src/Aliasing.cpp Thu Apr 19 06:29:13 2012
@@ -141,7 +141,8 @@
// Create metadata describing the new node hanging off root. The name doesn't
// matter much but needs to be unique for the compilation unit.
- tree type = TYPE_CANONICAL(TYPE_MAIN_VARIANT(TYPE_P(t) ? t : TREE_TYPE(t)));
+ tree type =
+ TYPE_CANONICAL(TYPE_MAIN_VARIANT(isa<TYPE>(t) ? t : TREE_TYPE(t)));
std::string TreeName = ("alias set " + Twine(alias_set) + ": " +
getDescriptiveName(type)).str();
MDBuilder MDHelper(Context);
Modified: dragonegg/trunk/src/Convert.cpp
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/src/Convert.cpp?rev=155119&r1=155118&r2=155119&view=diff
==============================================================================
--- dragonegg/trunk/src/Convert.cpp (original)
+++ dragonegg/trunk/src/Convert.cpp Thu Apr 19 06:29:13 2012
@@ -2336,7 +2336,7 @@
static Constant *ConvertTypeInfo(tree type) {
// TODO: Once pass_ipa_free_lang is made a default pass, remove the call to
// lookup_type_for_runtime below.
- if (TYPE_P (type))
+ if (isa<TYPE>(type))
type = lookup_type_for_runtime (type);
STRIP_NOPS(type);
if (isa<ADDR_EXPR>(type))
Modified: dragonegg/trunk/src/Debug.cpp
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/src/Debug.cpp?rev=155119&r1=155118&r2=155119&view=diff
==============================================================================
--- dragonegg/trunk/src/Debug.cpp (original)
+++ dragonegg/trunk/src/Debug.cpp Thu Apr 19 06:29:13 2012
@@ -92,7 +92,7 @@
static uint64_t NodeSizeInBits(tree Node) {
if (isa<ERROR_MARK>(Node)) {
return BITS_PER_WORD;
- } else if (TYPE_P(Node)) {
+ } else if (isa<TYPE>(Node)) {
if (TYPE_SIZE(Node) == NULL_TREE)
return 0;
else if (isInt64(TYPE_SIZE(Node), true))
@@ -115,7 +115,7 @@
/// regardless of whether the node is a TYPE or DECL.
static uint64_t NodeAlignInBits(tree Node) {
if (isa<ERROR_MARK>(Node)) return BITS_PER_WORD;
- if (TYPE_P(Node)) return TYPE_ALIGN(Node);
+ if (isa<TYPE>(Node)) return TYPE_ALIGN(Node);
if (DECL_P(Node)) return DECL_ALIGN(Node);
return BITS_PER_WORD;
}
@@ -135,7 +135,7 @@
if (DECL_P(Node)) {
Name = DECL_NAME(Node);
- } else if (TYPE_P(Node)) {
+ } else if (isa<TYPE>(Node)) {
Name = TYPE_NAME(Node);
}
@@ -164,12 +164,12 @@
if (DECL_P(Node)) {
Name = DECL_NAME(Node);
- } else if (TYPE_P(Node)) {
+ } else if (isa<TYPE>(Node)) {
Name = TYPE_NAME(Node);
}
if (Name) {
- if (TYPE_STUB_DECL(Name)) {
+ if (isa<TYPE>(Name) && TYPE_STUB_DECL(Name)) {
tree Stub = TYPE_STUB_DECL(Name);
Location = expand_location(DECL_SOURCE_LOCATION(Stub));
} else if (DECL_P(Name)) {
@@ -178,7 +178,7 @@
}
if (!Location.line) {
- if (UseStub && TYPE_STUB_DECL(Node)) {
+ if (UseStub && isa<TYPE>(Name) && TYPE_STUB_DECL(Node)) {
tree Stub = TYPE_STUB_DECL(Node);
Location = expand_location(DECL_SOURCE_LOCATION(Stub));
} else if (DECL_P(Node)) {
@@ -291,7 +291,7 @@
unsigned VIndex = 0;
DIType ContainingType;
if (DECL_VINDEX (FnDecl) &&
- DECL_CONTEXT (FnDecl) && TYPE_P((DECL_CONTEXT (FnDecl)))) { // Workaround GCC PR42653
+ DECL_CONTEXT (FnDecl) && isa<TYPE>((DECL_CONTEXT (FnDecl)))) { // Workaround GCC PR42653
if (host_integerp (DECL_VINDEX (FnDecl), 0))
VIndex = tree_low_cst (DECL_VINDEX (FnDecl), 0);
Virtuality = dwarf::DW_VIRTUALITY_virtual;
@@ -344,7 +344,7 @@
if (MDNode *R = dyn_cast_or_null<MDNode>(&*I->second))
return DIDescriptor(R);
- if (TYPE_P (Node)) {
+ if (isa<TYPE>(Node)) {
DIType Ty = getOrCreateType(Node);
return DIDescriptor(Ty);
} else if (DECL_P (Node)) {
Modified: dragonegg/trunk/src/Trees.cpp
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/src/Trees.cpp?rev=155119&r1=155118&r2=155119&view=diff
==============================================================================
--- dragonegg/trunk/src/Trees.cpp (original)
+++ dragonegg/trunk/src/Trees.cpp Thu Apr 19 06:29:13 2012
@@ -91,7 +91,7 @@
}
// Handle types of all kinds.
- if (TYPE_P(t)) {
+ if (isa<TYPE>(t)) {
// If the type comes with a name then use it.
const std::string &TypeName = getDescriptiveName(TYPE_NAME(t));
if (!TypeName.empty()) {
Modified: dragonegg/trunk/src/Types.cpp
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/src/Types.cpp?rev=155119&r1=155118&r2=155119&view=diff
==============================================================================
--- dragonegg/trunk/src/Types.cpp (original)
+++ dragonegg/trunk/src/Types.cpp Thu Apr 19 06:29:13 2012
@@ -1525,7 +1525,7 @@
typedef tree_node NodeType;
typedef RecursiveTypeIterator ChildIteratorType;
static inline NodeType *getEntryNode(tree t) {
- assert(TYPE_P(t) && "Expected a type!");
+ assert(isa<TYPE>(t) && "Expected a type!");
return t;
}
static inline ChildIteratorType child_begin(tree type) {
More information about the llvm-commits
mailing list