summaryrefslogtreecommitdiff
path: root/gcc/rtl.c
diff options
context:
space:
mode:
authorzack <zack@138bc75d-0d04-0410-961f-82ee72b054a4>2000-06-09 21:47:40 +0000
committerzack <zack@138bc75d-0d04-0410-961f-82ee72b054a4>2000-06-09 21:47:40 +0000
commit791ceafe7e7c0ca0640b64ede4b9cccda4b900e9 (patch)
treec3287938dc002562d04b768dfaa35a310e1a8fc3 /gcc/rtl.c
parent210aba332d443110f4f35d9c118f66571d97068d (diff)
downloadgcc-791ceafe7e7c0ca0640b64ede4b9cccda4b900e9.tar.gz
toplevel:
* ggc-none.c, ggc-simple.c, ggc-page.c (ggc_alloc_obj): Rename it ggc_alloc, drop second argument, never clear returned memory. * ggc-common.c (ggc_alloc_string): Use ggc_alloc. (ggc_alloc_cleared): New. * ggc.h: Prototype ggc_alloc and ggc_alloc_cleared, not ggc_alloc_obj. Remove ggc_alloc macro. (ggc_alloc_rtx, ggc_alloc_rtvec, ggc_alloc_tree): Use ggc_alloc. * rtl.c (rtvec_alloc): Clear the vector always. (rtx_alloc): Clear the first word always. Remove dirty obstack tricks (this routine is no longer a bottleneck). * tree.c (make_node): Clear the new node always. (make_tree_vec): Likewise. (tree_cons): Clear the common structure always. (build1): Likewise; also, clear TREE_COMPLEXITY. * gengenrtl.c: Use puts wherever possible. Remove extra newlines. (gendef): Clear the first word of an RTX in the generator function, irrespective of ggc_p. Initialize '0' slots to NULL. (genlegend): Don't generate obstack_alloc_rtx routine, just a thin wrapper macro around obstack_alloc. * stmt.c (expand_fixup): Use ggc_alloc. * c-typeck.c (add_pending_init): Use ggc_alloc. * emit-rtl.c (init_emit_once): Clear CONST_DOUBLE_CHAIN(tem). * varasm.c (immed_double_const): Set CONST_DOUBLE_MEM(r) to const0_rtx when it is created. (immed_real_const_1): Set CONST_DOUBLE_CHAIN(r) to NULL_RTX if we are not in a function. * tree.c (tree_class_check_failed): Make second arg an int. * tree.h: Update prototype. cp: * call.c (add_candidate): Use ggc_alloc_cleared. * decl.c (lookup_label): Likewise. * lex.c (retrofit_lang_decl): Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@34478 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/rtl.c')
-rw-r--r--gcc/rtl.c53
1 files changed, 14 insertions, 39 deletions
diff --git a/gcc/rtl.c b/gcc/rtl.c
index 84a2df0e20a..6c771f695e4 100644
--- a/gcc/rtl.c
+++ b/gcc/rtl.c
@@ -279,17 +279,11 @@ rtvec_alloc (n)
if (ggc_p)
rt = ggc_alloc_rtvec (n);
else
- {
- int i;
-
- rt = (rtvec) obstack_alloc (rtl_obstack,
- sizeof (struct rtvec_def)
- + (( n - 1) * sizeof (rtx)));
-
- /* clear out the vector */
- for (i = 0; i < n; i++)
- rt->elem[i] = 0;
- }
+ rt = (rtvec) obstack_alloc (rtl_obstack,
+ sizeof (struct rtvec_def)
+ + ((n - 1) * sizeof (rtx)));
+ /* clear out the vector */
+ memset (&rt->elem[0], 0, n * sizeof (rtx));
PUT_NUM_ELEM (rt, n);
return rt;
@@ -303,39 +297,20 @@ rtx_alloc (code)
RTX_CODE code;
{
rtx rt;
+ int n = GET_RTX_LENGTH (code);
if (ggc_p)
- rt = ggc_alloc_rtx (GET_RTX_LENGTH (code));
+ rt = ggc_alloc_rtx (n);
else
- {
- register struct obstack *ob = rtl_obstack;
- register int nelts = GET_RTX_LENGTH (code);
- register int length = sizeof (struct rtx_def)
- + (nelts - 1) * sizeof (rtunion);
-
- /* This function is called more than any other in GCC, so we
- manipulate the obstack directly.
+ rt = (rtx) obstack_alloc (rtl_obstack,
+ sizeof (struct rtx_def)
+ + ((n - 1) * sizeof (rtunion)));
- Even though rtx objects are word aligned, we may be sharing
- an obstack with tree nodes, which may have to be double-word
- aligned. So align our length to the alignment mask in the
- obstack. */
-
- length = (length + ob->alignment_mask) & ~ ob->alignment_mask;
-
- if (ob->chunk_limit - ob->next_free < length)
- _obstack_newchunk (ob, length);
- rt = (rtx)ob->object_base;
- ob->next_free += length;
- ob->object_base = ob->next_free;
-
- /* We want to clear everything up to the FLD array. Normally,
- this is one int, but we don't want to assume that and it
- isn't very portable anyway; this is. */
-
- memset (rt, 0, sizeof (struct rtx_def) - sizeof (rtunion));
- }
+ /* We want to clear everything up to the FLD array. Normally, this
+ is one int, but we don't want to assume that and it isn't very
+ portable anyway; this is. */
+ memset (rt, 0, sizeof (struct rtx_def) - sizeof (rtunion));
PUT_CODE (rt, code);
return rt;
}