summaryrefslogtreecommitdiff
path: root/gcc/rtl.c
diff options
context:
space:
mode:
authormmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4>1999-09-05 16:08:20 +0000
committermmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4>1999-09-05 16:08:20 +0000
commit1bfd55c5832c63621f3f1eac29139cd28f3d17e5 (patch)
tree53f583f3f8569b93ca268331c1f771e401b63045 /gcc/rtl.c
parent68e99b40dd8701fe7d675acb9cdff108e5ad630a (diff)
downloadgcc-1bfd55c5832c63621f3f1eac29139cd28f3d17e5.tar.gz
* Makefile.in (ggc-simple.o): Depend on varray.h.
(rtl.o): Depend on ggc.h. (genattrtab.o): Depend on ggc.h. (print-tree.o): Likewise. (fold-const.o): Likewise. * emit-rtl.c (sequence_element_free_list): Remove, and all references. (make_insn_raw): Don't cache insns when GC'ing. (emit_insn_before): Likewise. (emit_insn_after): Likewise. (emit_insn): Likewise. (start_sequence): Use xmalloc to allocate the sequence_stack. (end_sequence): Add free to free it. (gen_sequence): Don't cache insns when GC'ing. (clear_emit_caches): Don't use sequence_element_free_list. (init_emit): Use xcalloc, not xmalloc+bzero. * fold-const.c (size_int_wide): Kill the cache, when GC'ing. * function.c (pop_function_context_from): Use free to free the fixup_var_refs_queue. (put_reg_into_stack): Allocate it with xmalloc. * genattrtab.c: Include ggc.h. (operate_exp): Don't use obstack_free when GC'ing. (simplify_cond): Likewise. (simplify_text_exp): Likewise. (optimize_attrs): Likewise. * gengentrtl.c (gendef): Use ggc_alloc_rtx to allocate RTL, when GC'ing. (gencode): Generate a #include for ggc.h. * ggc-callbacks.c (ggc_p): Define it to zero. * ggc-none.c (ggc_p): Likewise. * ggc-simple.c: Include varray.h. (ggc_mark_tree_varray): New function. (ggc_add_tree_varray_root): Likewise. (ggc_mark_tree_varray_ptr): Likewise. * ggc.h (ggc_p): Declare. (varray_head_tag): Likewise. (ggc_add_tree_varray_root): Declare. * print-tree.c (print_node): Don't check for TREE_PERMANENT inconsistencies when GC'ing. * rtl.c: Include ggc.h. (rtvec_alloc): Use ggc_alloc_rtvec when GC'ing. (rtx_alloc): Use ggc_alloc_rtx when GC'ing. (rtx_free): Don't call obstack_free when GC'ing. * toplev.c (rest_of_compilation): Call ggc_collect after every pass, if GC'ing. * tree.c (push_obstacks): Do nothing, if GC'ing. (pop_obstacks_nochange): Likewise. (pop_obstacks): Likewise. (make_node): Use ggc_alloc_tree when GC'ing. (copy_node): Likewise. (get_identifier): Use ggc_alloc_string when GC'ing. (build_string): Likewise. (make_tree_vec): Use ggc_alloc_tree when GC'ing. (tree_cons): Likewise. (build1): Likewise. (type_hash_canon): Don't call obstack_free when GC'ing. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@29125 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/rtl.c')
-rw-r--r--gcc/rtl.c84
1 files changed, 48 insertions, 36 deletions
diff --git a/gcc/rtl.c b/gcc/rtl.c
index 4b14dabf5cc..db28096ac65 100644
--- a/gcc/rtl.c
+++ b/gcc/rtl.c
@@ -24,7 +24,7 @@ Boston, MA 02111-1307, USA. */
#include "rtl.h"
#include "real.h"
#include "bitmap.h"
-
+#include "ggc.h"
#include "obstack.h"
#define obstack_chunk_alloc xmalloc
#define obstack_chunk_free free
@@ -244,18 +244,23 @@ rtvec_alloc (n)
int n;
{
rtvec rt;
- int i;
-
- rt = (rtvec) obstack_alloc (rtl_obstack,
- sizeof (struct rtvec_def)
- + (( n - 1) * sizeof (rtx)));
+
+ if (ggc_p)
+ rt = ggc_alloc_rtvec (n);
+ else
+ {
+ int i;
- /* clear out the vector */
- PUT_NUM_ELEM (rt, n);
+ rt = (rtvec) obstack_alloc (rtl_obstack,
+ sizeof (struct rtvec_def)
+ + (( n - 1) * sizeof (rtx)));
- for (i = 0; i < n; i++)
- rt->elem[i] = 0;
+ /* clear out the vector */
+ for (i = 0; i < n; i++)
+ rt->elem[i] = 0;
+ }
+ PUT_NUM_ELEM (rt, n);
return rt;
}
@@ -267,34 +272,40 @@ rtx_alloc (code)
RTX_CODE code;
{
rtx rt;
- 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.
- 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));
+ if (ggc_p)
+ rt = ggc_alloc_rtx (GET_RTX_LENGTH (code));
+ 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.
+
+ 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));
+ }
PUT_CODE (rt, code);
-
return rt;
}
@@ -304,7 +315,8 @@ void
rtx_free (x)
rtx x;
{
- obstack_free (rtl_obstack, x);
+ if (!ggc_p)
+ obstack_free (rtl_obstack, x);
}
/* Create a new copy of an rtx.