OSDN Git Service
(root)
/
pf3gnuchains
/
gcc-fork.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Daily bump.
[pf3gnuchains/gcc-fork.git]
/
gcc
/
tree-browser.c
diff --git
a/gcc/tree-browser.c
b/gcc/tree-browser.c
index
f7c6136
..
188bea6
100644
(file)
--- a/
gcc/tree-browser.c
+++ b/
gcc/tree-browser.c
@@
-1,12
+1,12
@@
/* Tree browser.
/* Tree browser.
- Copyright (C) 2002, 2003 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2003
, 2004, 2007, 2008
Free Software Foundation, Inc.
Contributed by Sebastian Pop <s.pop@laposte.net>
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Contributed by Sebastian Pop <s.pop@laposte.net>
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
-Software Foundation; either version
2
, or (at your option) any later
+Software Foundation; either version
3
, or (at your option) any later
version.
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
version.
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
@@
-15,15
+15,13
@@
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
-along with GCC; see the file COPYING. If not, write to the Free
-Software Foundation, 59 Temple Place - Suite 330, Boston, MA
-02111-1307, USA. */
+along with GCC; see the file COPYING3. If not see
+<http://www.gnu.org/licenses/>. */
#include "config.h"
#include "system.h"
#include "coretypes.h"
#include "tm.h"
#include "config.h"
#include "system.h"
#include "coretypes.h"
#include "tm.h"
-#include "errors.h"
#include "tree.h"
#include "tree-inline.h"
#include "diagnostic.h"
#include "tree.h"
#include "tree-inline.h"
#include "diagnostic.h"
@@
-53,11
+51,7
@@
struct tb_command {
};
#define DEFTBCODE(code, str, help) { help, str, sizeof(str) - 1, code },
};
#define DEFTBCODE(code, str, help) { help, str, sizeof(str) - 1, code },
-#ifdef HOST_EBCDIC
-static struct tb_command tb_commands[] =
-#else
static const struct tb_command tb_commands[] =
static const struct tb_command tb_commands[] =
-#endif
{
#include "tree-browser.def"
};
{
#include "tree-browser.def"
};
@@
-77,15
+71,14
@@
struct tb_tree_code {
};
#define DEFTREECODE(SYM, STRING, TYPE, NARGS) { SYM, STRING, sizeof (STRING) - 1 },
};
#define DEFTREECODE(SYM, STRING, TYPE, NARGS) { SYM, STRING, sizeof (STRING) - 1 },
-#ifdef HOST_EBCDIC
-static struct tb_tree_code tb_tree_codes[] =
-#else
+#define END_OF_BASE_TREE_CODES \
+ { LAST_AND_UNUSED_TREE_CODE, "@dummy", sizeof ("@dummy") - 1 },
static const struct tb_tree_code tb_tree_codes[] =
static const struct tb_tree_code tb_tree_codes[] =
-#endif
{
{
-#include "tree.def"
+#include "
all-
tree.def"
};
#undef DEFTREECODE
};
#undef DEFTREECODE
+#undef END_OF_BASE_TREE_CODES
#define TB_TREE_CODE(N) (tb_tree_codes[N].code)
#define TB_TREE_CODE_TEXT(N) (tb_tree_codes[N].code_string)
#define TB_TREE_CODE(N) (tb_tree_codes[N].code)
#define TB_TREE_CODE_TEXT(N) (tb_tree_codes[N].code_string)
@@
-172,7
+165,8
@@
browse_tree (tree begin)
case TB_MAX:
if (head && (INTEGRAL_TYPE_P (head)
case TB_MAX:
if (head && (INTEGRAL_TYPE_P (head)
- || TREE_CODE (head) == REAL_TYPE))
+ || TREE_CODE (head) == REAL_TYPE
+ || TREE_CODE (head) == FIXED_POINT_TYPE))
TB_SET_HEAD (TYPE_MAX_VALUE (head));
else
TB_WF;
TB_SET_HEAD (TYPE_MAX_VALUE (head));
else
TB_WF;
@@
-180,7
+174,8
@@
browse_tree (tree begin)
case TB_MIN:
if (head && (INTEGRAL_TYPE_P (head)
case TB_MIN:
if (head && (INTEGRAL_TYPE_P (head)
- || TREE_CODE (head) == REAL_TYPE))
+ || TREE_CODE (head) == REAL_TYPE
+ || TREE_CODE (head) == FIXED_POINT_TYPE))
TB_SET_HEAD (TYPE_MIN_VALUE (head));
else
TB_WF;
TB_SET_HEAD (TYPE_MIN_VALUE (head));
else
TB_WF;
@@
-239,21
+234,21
@@
browse_tree (tree begin)
break;
case TB_SUBBLOCKS:
break;
case TB_SUBBLOCKS:
- if (head && TREE_CODE
_CLASS (TREE_CODE (head)) == 'b'
)
+ if (head && TREE_CODE
(head) == BLOCK
)
TB_SET_HEAD (BLOCK_SUBBLOCKS (head));
else
TB_WF;
break;
case TB_SUPERCONTEXT:
TB_SET_HEAD (BLOCK_SUBBLOCKS (head));
else
TB_WF;
break;
case TB_SUPERCONTEXT:
- if (head && TREE_CODE
_CLASS (TREE_CODE (head)) == 'b'
)
+ if (head && TREE_CODE
(head) == BLOCK
)
TB_SET_HEAD (BLOCK_SUPERCONTEXT (head));
else
TB_WF;
break;
case TB_VARS:
TB_SET_HEAD (BLOCK_SUPERCONTEXT (head));
else
TB_WF;
break;
case TB_VARS:
- if (head && TREE_CODE
_CLASS (TREE_CODE (head)) == 'b'
)
+ if (head && TREE_CODE
(head) == BLOCK
)
TB_SET_HEAD (BLOCK_VARS (head));
else if (head && TREE_CODE (head) == BIND_EXPR)
TB_SET_HEAD (TREE_OPERAND (head, 0));
TB_SET_HEAD (BLOCK_VARS (head));
else if (head && TREE_CODE (head) == BIND_EXPR)
TB_SET_HEAD (TREE_OPERAND (head, 0));
@@
-262,14
+257,14
@@
browse_tree (tree begin)
break;
case TB_REFERENCE_TO_THIS:
break;
case TB_REFERENCE_TO_THIS:
- if (head && T
REE_CODE_CLASS (TREE_CODE (head)) == 't'
)
+ if (head && T
YPE_P (head)
)
TB_SET_HEAD (TYPE_REFERENCE_TO (head));
else
TB_WF;
break;
case TB_POINTER_TO_THIS:
TB_SET_HEAD (TYPE_REFERENCE_TO (head));
else
TB_WF;
break;
case TB_POINTER_TO_THIS:
- if (head && T
REE_CODE_CLASS (TREE_CODE (head)) == 't'
)
+ if (head && T
YPE_P (head)
)
TB_SET_HEAD (TYPE_POINTER_TO (head));
else
TB_WF;
TB_SET_HEAD (TYPE_POINTER_TO (head));
else
TB_WF;
@@
-309,8
+304,7
@@
browse_tree (tree begin)
break;
case TB_DOMAIN:
break;
case TB_DOMAIN:
- if (head && (TREE_CODE (head) == ARRAY_TYPE
- || TREE_CODE (head) == SET_TYPE))
+ if (head && TREE_CODE (head) == ARRAY_TYPE)
TB_SET_HEAD (TYPE_DOMAIN (head));
else
TB_WF;
TB_SET_HEAD (TYPE_DOMAIN (head));
else
TB_WF;
@@
-323,13
+317,6
@@
browse_tree (tree begin)
TB_WF;
break;
TB_WF;
break;
- case TB_ARG_TYPE_AS_WRITTEN:
- if (head && TREE_CODE (head) == PARM_DECL)
- TB_SET_HEAD (DECL_ARG_TYPE_AS_WRITTEN (head));
- else
- TB_WF;
- break;
-
case TB_ARG_TYPE:
if (head && TREE_CODE (head) == PARM_DECL)
TB_SET_HEAD (DECL_ARG_TYPE (head));
case TB_ARG_TYPE:
if (head && TREE_CODE (head) == PARM_DECL)
TB_SET_HEAD (DECL_ARG_TYPE (head));
@@
-338,48
+325,48
@@
browse_tree (tree begin)
break;
case TB_INITIAL:
break;
case TB_INITIAL:
- if (head &&
TREE_CODE_CLASS (TREE_CODE (head)) == 'd'
)
+ if (head &&
DECL_P (head)
)
TB_SET_HEAD (DECL_INITIAL (head));
else
TB_WF;
break;
case TB_RESULT:
TB_SET_HEAD (DECL_INITIAL (head));
else
TB_WF;
break;
case TB_RESULT:
- if (head &&
TREE_CODE_CLASS (TREE_CODE (head)) == 'd'
)
+ if (head &&
DECL_P (head)
)
TB_SET_HEAD (DECL_RESULT_FLD (head));
else
TB_WF;
break;
case TB_ARGUMENTS:
TB_SET_HEAD (DECL_RESULT_FLD (head));
else
TB_WF;
break;
case TB_ARGUMENTS:
- if (head &&
TREE_CODE_CLASS (TREE_CODE (head)) == 'd'
)
+ if (head &&
DECL_P (head)
)
TB_SET_HEAD (DECL_ARGUMENTS (head));
else
TB_WF;
break;
case TB_ABSTRACT_ORIGIN:
TB_SET_HEAD (DECL_ARGUMENTS (head));
else
TB_WF;
break;
case TB_ABSTRACT_ORIGIN:
- if (head &&
TREE_CODE_CLASS (TREE_CODE (head)) == 'd'
)
+ if (head &&
DECL_P (head)
)
TB_SET_HEAD (DECL_ABSTRACT_ORIGIN (head));
TB_SET_HEAD (DECL_ABSTRACT_ORIGIN (head));
- else if (head && TREE_CODE
_CLASS (TREE_CODE (head)) == 'b'
)
+ else if (head && TREE_CODE
(head) == BLOCK
)
TB_SET_HEAD (BLOCK_ABSTRACT_ORIGIN (head));
else
TB_WF;
break;
case TB_ATTRIBUTES:
TB_SET_HEAD (BLOCK_ABSTRACT_ORIGIN (head));
else
TB_WF;
break;
case TB_ATTRIBUTES:
- if (head &&
TREE_CODE_CLASS (TREE_CODE (head)) == 'd'
)
+ if (head &&
DECL_P (head)
)
TB_SET_HEAD (DECL_ATTRIBUTES (head));
TB_SET_HEAD (DECL_ATTRIBUTES (head));
- else if (head && T
REE_CODE_CLASS (TREE_CODE (head)) == 't'
)
+ else if (head && T
YPE_P (head)
)
TB_SET_HEAD (TYPE_ATTRIBUTES (head));
else
TB_WF;
break;
case TB_CONTEXT:
TB_SET_HEAD (TYPE_ATTRIBUTES (head));
else
TB_WF;
break;
case TB_CONTEXT:
- if (head &&
TREE_CODE_CLASS (TREE_CODE (head)) == 'd'
)
+ if (head &&
DECL_P (head)
)
TB_SET_HEAD (DECL_CONTEXT (head));
TB_SET_HEAD (DECL_CONTEXT (head));
- else if (head && T
REE_CODE_CLASS (TREE_CODE (head)) == 't'
+ else if (head && T
YPE_P (head)
&& TYPE_CONTEXT (head))
TB_SET_HEAD (TYPE_CONTEXT (head));
else
&& TYPE_CONTEXT (head))
TB_SET_HEAD (TYPE_CONTEXT (head));
else
@@
-401,18
+388,18
@@
browse_tree (tree begin)
break;
case TB_UNIT_SIZE:
break;
case TB_UNIT_SIZE:
- if (head &&
TREE_CODE_CLASS (TREE_CODE (head)) == 'd'
)
+ if (head &&
DECL_P (head)
)
TB_SET_HEAD (DECL_SIZE_UNIT (head));
TB_SET_HEAD (DECL_SIZE_UNIT (head));
- else if (head && T
REE_CODE_CLASS (TREE_CODE (head)) == 't'
)
+ else if (head && T
YPE_P (head)
)
TB_SET_HEAD (TYPE_SIZE_UNIT (head));
else
TB_WF;
break;
case TB_SIZE:
TB_SET_HEAD (TYPE_SIZE_UNIT (head));
else
TB_WF;
break;
case TB_SIZE:
- if (head &&
TREE_CODE_CLASS (TREE_CODE (head)) == 'd'
)
+ if (head &&
DECL_P (head)
)
TB_SET_HEAD (DECL_SIZE (head));
TB_SET_HEAD (DECL_SIZE (head));
- else if (head && T
REE_CODE_CLASS (TREE_CODE (head)) == 't'
)
+ else if (head && T
YPE_P (head)
)
TB_SET_HEAD (TYPE_SIZE (head));
else
TB_WF;
TB_SET_HEAD (TYPE_SIZE (head));
else
TB_WF;
@@
-441,32
+428,28
@@
browse_tree (tree begin)
break;
case TB_CHILD_0:
break;
case TB_CHILD_0:
- if (head && IS_EXPR_CODE_CLASS (TREE_CODE_CLASS (TREE_CODE (head)))
- && TREE_OPERAND (head, 0))
+ if (head && EXPR_P (head) && TREE_OPERAND (head, 0))
TB_SET_HEAD (TREE_OPERAND (head, 0));
else
TB_WF;
break;
case TB_CHILD_1:
TB_SET_HEAD (TREE_OPERAND (head, 0));
else
TB_WF;
break;
case TB_CHILD_1:
- if (head && IS_EXPR_CODE_CLASS (TREE_CODE_CLASS (TREE_CODE (head)))
- && TREE_OPERAND (head, 1))
+ if (head && EXPR_P (head) && TREE_OPERAND (head, 1))
TB_SET_HEAD (TREE_OPERAND (head, 1));
else
TB_WF;
break;
case TB_CHILD_2:
TB_SET_HEAD (TREE_OPERAND (head, 1));
else
TB_WF;
break;
case TB_CHILD_2:
- if (head && IS_EXPR_CODE_CLASS (TREE_CODE_CLASS (TREE_CODE (head)))
- && TREE_OPERAND (head, 2))
+ if (head && EXPR_P (head) && TREE_OPERAND (head, 2))
TB_SET_HEAD (TREE_OPERAND (head, 2));
else
TB_WF;
break;
case TB_CHILD_3:
TB_SET_HEAD (TREE_OPERAND (head, 2));
else
TB_WF;
break;
case TB_CHILD_3:
- if (head && IS_EXPR_CODE_CLASS (TREE_CODE_CLASS (TREE_CODE (head)))
- && TREE_OPERAND (head, 3))
+ if (head && EXPR_P (head) && TREE_OPERAND (head, 3))
TB_SET_HEAD (TREE_OPERAND (head, 3));
else
TB_WF;
TB_SET_HEAD (TREE_OPERAND (head, 3));
else
TB_WF;
@@
-584,7
+567,7
@@
browse_tree (tree begin)
case TB_CHAIN:
/* Don't go further if it's the last node in this chain. */
case TB_CHAIN:
/* Don't go further if it's the last node in this chain. */
- if (head && TREE_CODE
_CLASS (TREE_CODE (head)) == 'b'
)
+ if (head && TREE_CODE
(head) == BLOCK
)
TB_SET_HEAD (BLOCK_CHAIN (head));
else if (head && TREE_CHAIN (head))
TB_SET_HEAD (TREE_CHAIN (head));
TB_SET_HEAD (BLOCK_CHAIN (head));
else if (head && TREE_CHAIN (head))
TB_SET_HEAD (TREE_CHAIN (head));
@@
-751,45
+734,16
@@
store_child_info (tree *tp, int *walk_subtrees ATTRIBUTE_UNUSED,
node = *tp;
/* 'node' is the parent of 'TREE_OPERAND (node, *)'. */
node = *tp;
/* 'node' is the parent of 'TREE_OPERAND (node, *)'. */
- if (
TREE_CODE_CLASS (TREE_CODE (node)) == 'e'
)
+ if (
EXPR_P (node)
)
{
{
-
-#define STORE_CHILD(N) do { \
- tree op = TREE_OPERAND (node, N); \
- slot = htab_find_slot (TB_up_ht, op, INSERT); \
- *slot = (void *) node; \
-} while (0)
-
- switch (TREE_CODE_LENGTH (TREE_CODE (node)))
+ int n = TREE_OPERAND_LENGTH (node);
+ int i;
+ for (i = 0; i < n; i++)
{
{
- case 4:
- STORE_CHILD (0);
- STORE_CHILD (1);
- STORE_CHILD (2);
- STORE_CHILD (3);
- break;
-
- case 3:
- STORE_CHILD (0);
- STORE_CHILD (1);
- STORE_CHILD (2);
- break;
-
- case 2:
- STORE_CHILD (0);
- STORE_CHILD (1);
- break;
-
- case 1:
- STORE_CHILD (0);
- break;
-
- case 0:
- default:
- /* No children: nothing to do. */
- break;
+ tree op = TREE_OPERAND (node, i);
+ slot = htab_find_slot (TB_up_ht, op, INSERT);
+ *slot = (void *) node;
}
}
-#undef STORE_CHILD
}
/* Never stop walk_tree. */
}
/* Never stop walk_tree. */
@@
-801,53
+755,20
@@
store_child_info (tree *tp, int *walk_subtrees ATTRIBUTE_UNUSED,
static int
TB_parent_eq (const void *p1, const void *p2)
{
static int
TB_parent_eq (const void *p1, const void *p2)
{
- tree node, parent;
- node = (tree) p2;
- parent = (tree) p1;
+ const_tree const node = (const_tree)p2;
+ const_tree const parent = (const_tree) p1;
if (p1 == NULL || p2 == NULL)
return 0;
if (p1 == NULL || p2 == NULL)
return 0;
- if (
TREE_CODE_CLASS(TREE_CODE(parent)) == 'e'
)
+ if (
EXPR_P (parent)
)
{
{
-
-#define TEST_CHILD(N) do { \
- if (node == TREE_OPERAND (parent, N)) \
- return 1; \
-} while (0)
-
- switch (TREE_CODE_LENGTH (TREE_CODE (parent)))
- {
- case 4:
- TEST_CHILD (0);
- TEST_CHILD (1);
- TEST_CHILD (2);
- TEST_CHILD (3);
- break;
-
- case 3:
- TEST_CHILD (0);
- TEST_CHILD (1);
- TEST_CHILD (2);
- break;
-
- case 2:
- TEST_CHILD (0);
- TEST_CHILD (1);
- break;
-
- case 1:
- TEST_CHILD (0);
- break;
-
- case 0:
- default:
- /* No children: nothing to do. */
- break;
- }
-#undef TEST_CHILD
+ int n = TREE_OPERAND_LENGTH (parent);
+ int i;
+ for (i = 0; i < n; i++)
+ if (node == TREE_OPERAND (parent, i))
+ return 1;
}
}
-
return 0;
}
return 0;
}