Make get_insns and friends inline

Steven Bosscher stevenb.gcc@gmail.com
Tue Jun 1 14:43:00 GMT 2010


On Tue, Jun 1, 2010 at 4:24 PM, Richard Guenther <rguenther@suse.de> wrote:
> On Tue, 1 Jun 2010, Jan Hubicka wrote:
>
>> Hi,
>> enother most frequent crossmodule inline is get_insns and related functions.
>> Those are just simple accestor to global xrtl structure, so it makes a lot of
>> sense to inline them.
>>
>> This patch moves it to static inline as header. Doing so is however bit tricky.
>> They can not sit in rtl.h because crtl is defined in function.h. They can not
>> sit in function.h because NEXT_INSN is defined by rtl.h.

Solution is to move crtl.h to rtl.h where it belongs. I even started
working on that already, see attached. It shows that all RTL stuff in
function.h can easily be moved to another place, making function.h RTL
free (and tm.h free!) once more...

Can you add FIXMEs where you now include emit-rtl.h? Or better yet, if
you feel like going vintage and do some RTL work for a change -- you
could foster parent this patch :-)

Ciao!
Steven

Index: function.h
===================================================================
--- function.h  (revision 159759)
+++ function.h  (working copy)
@@ -25,8 +25,12 @@ along with GCC; see the file COPYING3.
 #include "tree.h"
 #include "hashtab.h"
 #include "vecprim.h"
+
+#ifdef RTX_CODE
 #include "tm.h"                /* For CUMULATIVE_ARGS.  */
+#endif

+#ifdef RTX_CODE
 /* Stack of pending (incomplete) sequences saved by `start_sequence'.
    Each element describes one pending sequence.
    The main insn-chain is saved in the last element of the chain,
@@ -163,6 +167,7 @@ struct GTY(()) rtl_eh {
 #define apply_args_value (crtl->expr.x_apply_args_value)
 #define forced_labels (crtl->expr.x_forced_labels)
 #define stack_pointer_delta (crtl->expr.x_stack_pointer_delta)
+#endif

 struct gimple_df;
 struct temp_slot;
@@ -177,6 +182,7 @@ typedef struct ipa_opt_pass_d *ipa_opt_p
 DEF_VEC_P(ipa_opt_pass);
 DEF_VEC_ALLOC_P(ipa_opt_pass,heap);

+#ifdef RTX_CODE
 struct GTY(()) varasm_status {
   /* If we're using a per-function constant pool, this is it.  */
   struct rtx_constant_pool *pool;
@@ -460,6 +466,7 @@ extern GTY(()) struct rtl_data x_rtl;
    we never keep multiple functions.  For threaded compiler we might however
    want to do differently.  */
 #define crtl (&x_rtl)
+#endif

 /* This structure can save all the important global and static variables
    describing the status of the current function.  */
@@ -663,6 +670,7 @@ extern void number_blocks (tree);
 extern void clear_block_marks (tree);
 extern tree blocks_nreverse (tree);

+#ifdef RTX_CODE
 /* Return size needed for stack frame based on slots so far allocated.
    This size counts from zero.  It is not rounded to STACK_BOUNDARY;
    the caller may have to do that.  */
@@ -676,6 +684,7 @@ extern bool frame_offset_overflow (HOST_
 /* A pointer to a function to create target specific, per-function
    data structures.  */
 extern struct machine_function * (*init_machine_status) (void);
+#endif

 /* Save and restore status information for a nested function.  */
 extern void free_after_parsing (struct function *);
@@ -695,10 +704,12 @@ extern const char *current_function_name

 extern void do_warn_unused_parameter (tree);

+#ifdef RTX_CODE
 extern bool pass_by_reference (CUMULATIVE_ARGS *, enum machine_mode,
                               tree, bool);
 extern bool reference_callee_copied (CUMULATIVE_ARGS *, enum machine_mode,
                                     tree, bool);
+#endif

 extern void used_types_insert (tree);

Index: tree-ssa-loop-ivopts.c
===================================================================
--- tree-ssa-loop-ivopts.c      (revision 159759)
+++ tree-ssa-loop-ivopts.c      (working copy)
@@ -68,6 +68,7 @@ along with GCC; see the file COPYING3.
 #include "tm.h"
 #include "tree.h"
 #include "tm_p.h"
+#include "expr.h" /* HACK STEVEN function.h after expr.h for RTX_CODE */
 #include "basic-block.h"
 #include "output.h"
 #include "diagnostic.h"
@@ -77,7 +78,6 @@ along with GCC; see the file COPYING3.
 #include "tree-dump.h"
 #include "timevar.h"
 #include "cfgloop.h"
-#include "expr.h"
 #include "tree-pass.h"
 #include "ggc.h"
 #include "insn-config.h"
Index: expr.h
===================================================================
--- expr.h      (revision 159759)
+++ expr.h      (working copy)
@@ -22,10 +22,10 @@ along with GCC; see the file COPYING3.
 #ifndef GCC_EXPR_H
 #define GCC_EXPR_H

-/* For inhibit_defer_pop */
-#include "function.h"
 /* For XEXP, GEN_INT, rtx_code */
 #include "rtl.h"
+/* For inhibit_defer_pop */
+#include "function.h" /* HACK STEVEN function.h after rtl.h for RTX_CODE */
 /* For optimize_size */
 #include "flags.h"
 /* For host_integerp, tree_low_cst, fold_convert, size_binop, ssize_int,



More information about the Gcc-patches mailing list