This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [LTO]: Use 'enum LTO_tags' where appropriate
"Andrew Pinski" <pinskia@gmail.com> writes:
> On 8/15/07, Jim Blandy <jimb@codesourcery.com> wrote:
>> static tree
>> -input_expr_operand (struct input_block *, struct fun_in *, struct function *, unsigned int);
>> +input_expr_operand (struct input_block *, struct fun_in *, struct function *, enum LTO_tags);
>
> This line seems too long and seems like it needs a wrapping.
Good point.
2007-08-15 Jim Blandy <jimb@codesourcery.com>
Use enum LTO_tags where appropriate, instead of 'unsigned int'.
* lto-read.c (input_record_start): Fix return type, type of 'tag'.
(input_list): Fix type of 'tag'.
(input_expr_operand): Fix type of 'tag' argument. Update
declaration. Fix type of 'ctag'. Add default case to switch,
since the type of the switched value is now an enum.
(input_local_vars): Fix type of 'tag'.
(input_bb): Fix type of 'tag' argument.
(input_function): Fix type of 'tag' argument.
Index: lto/lto-read.c
===================================================================
--- lto/lto-read.c (revision 127524)
+++ lto/lto-read.c (working copy)
@@ -89,7 +89,8 @@
#endif
static tree
-input_expr_operand (struct input_block *, struct fun_in *, struct function *, unsigned int);
+input_expr_operand (struct input_block *, struct fun_in *, struct function *,
+ enum LTO_tags);
/* Return the next character of input from IB. Abort if you
@@ -256,10 +257,10 @@
/* Return the next tag in the input block IB. */
-static unsigned int
+static enum LTO_tags
input_record_start (struct input_block *ib)
{
- unsigned int tag = input_1_unsigned (ib);
+ enum LTO_tags tag = input_1_unsigned (ib);
#ifdef LTO_STREAM_DEBUGGING
if (tag)
@@ -276,7 +277,7 @@
static tree
input_list (struct input_block *ib, struct fun_in *fun_in, struct function *fn)
{
- unsigned int tag = input_record_start (ib);
+ enum LTO_tags tag = input_record_start (ib);
tree first = NULL_TREE;
if (tag)
{
@@ -407,7 +408,7 @@
static tree
input_expr_operand (struct input_block *ib, struct fun_in *fun_in,
- struct function *fn, unsigned int tag)
+ struct function *fn, enum LTO_tags tag)
{
enum tree_code code = tag_to_expr[tag];
tree type = NULL_TREE;
@@ -541,7 +542,7 @@
vec = VEC_alloc (constructor_elt, gc, len);
while (i < len)
{
- unsigned int ctag = input_record_start (ib);
+ enum LTO_tags ctag = input_record_start (ib);
if (ctag == LTO_constructor_range)
{
tree op0 = input_integer (ib, get_type_ref (fun_in, ib));
@@ -766,6 +767,9 @@
build2 (MODIFY_EXPR, NULL_TREE, op0, op1));
}
break;
+
+ default:
+ gcc_unreachable ();
}
break;
@@ -963,7 +967,7 @@
fun_in->local_decls = xcalloc (count, sizeof (tree*));
for (i = 0; i < count; i++)
{
- unsigned int tag = input_record_start (ib);
+ enum LTO_tags tag = input_record_start (ib);
unsigned int variant = tag & 0xF;
bool is_var = ((tag & 0xFFF0) == LTO_local_var_decl_body0);
@@ -1246,7 +1250,7 @@
/* Read in the next basic block. */
static void
-input_bb (struct input_block *ib, unsigned int tag,
+input_bb (struct input_block *ib, enum LTO_tags tag,
struct fun_in *fun_in, struct function *fn)
{
unsigned int index;
@@ -1296,7 +1300,7 @@
struct input_block *ib)
{
struct function *fn = DECL_STRUCT_FUNCTION (fn_decl);
- unsigned int tag = input_record_start (ib);
+ enum LTO_tags tag = input_record_start (ib);
tree_register_cfg_hooks ();
gcc_assert (tag == LTO_function);