summaryrefslogtreecommitdiff
path: root/gcc/genattrtab.c
diff options
context:
space:
mode:
authorKaveh R. Ghazi <ghazi@caip.rutgers.edu>2008-06-26 00:22:12 +0000
committerKaveh Ghazi <ghazi@gcc.gnu.org>2008-06-26 00:22:12 +0000
commit7cbb2a85e7bb2f135308812d2847fc16a44dbe0a (patch)
treefb71542f91c1a9dcc70d28cb64513626a2cdcfb8 /gcc/genattrtab.c
parentd3bfe4decc2bbbce0585df7814c7923488cb1cb5 (diff)
downloadgcc-7cbb2a85e7bb2f135308812d2847fc16a44dbe0a.tar.gz
cse.c (approx_reg_cost_1, cse_insn): Fix -Wc++-compat and/or -Wcast-qual warnings.
* cse.c (approx_reg_cost_1, cse_insn): Fix -Wc++-compat and/or -Wcast-qual warnings. * gcc.c (process_command): Likewise. * genattrtab.c (oballoc): Use XOBNEW. (oballocvec): Define. (attr_hash_add_rtx, attr_hash_add_string, attr_string, get_attr_value, fill_attr, make_length_attrs, gen_attr, gen_insn, gen_delay, find_attr, gen_insn_reserv, gen_bypass_1): Fix -Wc++-compat and/or -Wcast-qual warnings. * genautomata.c (XCREATENODE, XCREATENODEVEC, XCREATENODEVAR, XCOPYNODE, XCOPYNODEVEC, XCOPYNODEVAR): New. (gen_cpu_unit, gen_query_cpu_unit, gen_bypass, gen_excl_set, gen_presence_absence_set, gen_automaton, gen_regexp_el, gen_regexp_repeat, gen_regexp_allof, gen_regexp_oneof, gen_regexp_sequence, gen_reserv, gen_insn_reserv, process_excls, add_excls, process_presence_absence_names, process_presence_absence_patterns, add_presence_absence, process_regexp, add_advance_cycle_insn_decl, get_free_alt_state, get_free_state, add_arc, get_free_automata_list_el, form_reserv_sets_list, copy_insn_regexp, transform_1, transform_2, transform_3, cache_presence, create_ainsns, create_automata, create_state_ainsn_table, dfa_insn_code_enlarge, output_trans_func, output_min_issue_delay_func, output_dead_lock_func, output_reset_func, output_get_cpu_unit_code_func, output_dfa_start_func, expand_automata): Likewise. * genextract.c (gen_insn): Likewise. * gengtype-lex.l: Likewise. * gengtype.c (read_input_list, adjust_field_type, process_gc_options): Likewise. * genoutput.c (note_constraint): Likewise. * genpreds.c (mangle, add_constraint): Likewise. * genrecog.c (process_define_predicate, new_decision, add_to_sequence): Likewise. * gensupport.c (record_insn_name): Likewise. From-SVN: r137135
Diffstat (limited to 'gcc/genattrtab.c')
-rw-r--r--gcc/genattrtab.c31
1 files changed, 16 insertions, 15 deletions
diff --git a/gcc/genattrtab.c b/gcc/genattrtab.c
index 47b6ec13c9f..079c81f9552 100644
--- a/gcc/genattrtab.c
+++ b/gcc/genattrtab.c
@@ -286,7 +286,8 @@ static rtx one_fn (rtx);
static rtx max_fn (rtx);
static rtx min_fn (rtx);
-#define oballoc(size) obstack_alloc (hash_obstack, size)
+#define oballoc(T) XOBNEW (hash_obstack, T)
+#define oballocvec(T, N) XOBNEWVEC (hash_obstack, T, (N))
/* Hash table for sharing RTL and strings. */
@@ -326,7 +327,7 @@ attr_hash_add_rtx (int hashcode, rtx rtl)
{
struct attr_hash *h;
- h = obstack_alloc (hash_obstack, sizeof (struct attr_hash));
+ h = XOBNEW (hash_obstack, struct attr_hash);
h->hashcode = hashcode;
h->u.rtl = rtl;
h->next = attr_hash_table[hashcode % RTL_HASH_SIZE];
@@ -340,7 +341,7 @@ attr_hash_add_string (int hashcode, char *str)
{
struct attr_hash *h;
- h = obstack_alloc (hash_obstack, sizeof (struct attr_hash));
+ h = XOBNEW (hash_obstack, struct attr_hash);
h->hashcode = -hashcode;
h->u.str = str;
h->next = attr_hash_table[hashcode % RTL_HASH_SIZE];
@@ -601,7 +602,7 @@ attr_string (const char *str, int len)
return h->u.str; /* <-- return if found. */
/* Not found; create a permanent copy and add it to the hash table. */
- new_str = obstack_alloc (hash_obstack, len + 1);
+ new_str = XOBNEWVAR (hash_obstack, char, len + 1);
memcpy (new_str, str, len);
new_str[len] = '\0';
attr_hash_add_string (hashcode, new_str);
@@ -1297,7 +1298,7 @@ get_attr_value (rtx value, struct attr_desc *attr, int insn_code)
|| insn_alternatives[av->first_insn->def->insn_code]))
return av;
- av = oballoc (sizeof (struct attr_value));
+ av = oballoc (struct attr_value);
av->value = value;
av->next = attr->first_value;
attr->first_value = av;
@@ -1440,7 +1441,7 @@ fill_attr (struct attr_desc *attr)
else
av = get_attr_value (value, attr, id->insn_code);
- ie = oballoc (sizeof (struct insn_ent));
+ ie = oballoc (struct insn_ent);
ie->def = id;
insert_insn_ent (av, ie);
}
@@ -1571,7 +1572,7 @@ make_length_attrs (void)
no_address_fn[i],
address_fn[i]),
new_attr, ie->def->insn_code);
- new_ie = oballoc (sizeof (struct insn_ent));
+ new_ie = oballoc (struct insn_ent);
new_ie->def = ie->def;
insert_insn_ent (new_av, new_ie);
}
@@ -2949,7 +2950,7 @@ gen_attr (rtx exp, int lineno)
name_ptr = XSTR (exp, 1);
while ((p = next_comma_elt (&name_ptr)) != NULL)
{
- av = oballoc (sizeof (struct attr_value));
+ av = oballoc (struct attr_value);
av->value = attr_rtx (CONST_STRING, p);
av->next = attr->first_value;
attr->first_value = av;
@@ -3062,7 +3063,7 @@ gen_insn (rtx exp, int lineno)
{
struct insn_def *id;
- id = oballoc (sizeof (struct insn_def));
+ id = oballoc (struct insn_def);
id->next = defs;
defs = id;
id->def = exp;
@@ -3126,7 +3127,7 @@ gen_delay (rtx def, int lineno)
have_annul_false = 1;
}
- delay = oballoc (sizeof (struct delay_desc));
+ delay = oballoc (struct delay_desc);
delay->def = def;
delay->num = ++num_delays;
delay->next = delays;
@@ -4158,7 +4159,7 @@ find_attr (const char **name_p, int create)
if (! create)
return NULL;
- attr = oballoc (sizeof (struct attr_desc));
+ attr = oballoc (struct attr_desc);
attr->name = DEF_ATTR_STRING (name);
attr->first_value = attr->default_val = NULL;
attr->is_numeric = attr->is_const = attr->is_special = 0;
@@ -4297,7 +4298,7 @@ static size_t n_insn_reservs;
static void
gen_insn_reserv (rtx def)
{
- struct insn_reserv *decl = oballoc (sizeof (struct insn_reserv));
+ struct insn_reserv *decl = oballoc (struct insn_reserv);
decl->name = DEF_ATTR_STRING (XSTR (def, 0));
decl->default_latency = XINT (def, 1);
@@ -4338,7 +4339,7 @@ gen_bypass_1 (const char *s, size_t len)
if (s == b->insn)
return; /* already got that one */
- b = oballoc (sizeof (struct bypass_list));
+ b = oballoc (struct bypass_list);
b->insn = s;
b->next = all_bypasses;
all_bypasses = b;
@@ -4544,13 +4545,13 @@ from the machine description file `md'. */\n\n");
printf ("#define operands recog_data.operand\n\n");
/* Make `insn_alternatives'. */
- insn_alternatives = oballoc (insn_code_number * sizeof (int));
+ insn_alternatives = oballocvec (int, insn_code_number);
for (id = defs; id; id = id->next)
if (id->insn_code >= 0)
insn_alternatives[id->insn_code] = (1 << id->num_alternatives) - 1;
/* Make `insn_n_alternatives'. */
- insn_n_alternatives = oballoc (insn_code_number * sizeof (int));
+ insn_n_alternatives = oballocvec (int, insn_code_number);
for (id = defs; id; id = id->next)
if (id->insn_code >= 0)
insn_n_alternatives[id->insn_code] = id->num_alternatives;