From 01d939e8fb624ea88487fd41ce93c238a5eb870a Mon Sep 17 00:00:00 2001 From: Bernd Schmidt Date: Mon, 20 Dec 1999 13:18:17 +0000 Subject: [PATCH] current_function -> cfun From-SVN: r31033 --- gcc/ChangeLog | 4 ++ gcc/config/alpha/alpha.c | 8 +-- gcc/config/alpha/alpha.md | 2 +- gcc/config/i386/i386.c | 2 +- gcc/config/sparc/sparc.c | 3 +- gcc/cp/cp-tree.h | 8 +-- gcc/cp/decl.c | 31 ++++----- gcc/cp/method.c | 2 +- gcc/cp/semantics.c | 10 +-- gcc/cp/typeck.c | 2 +- gcc/emit-rtl.c | 16 ++--- gcc/except.c | 3 +- gcc/except.h | 18 ++--- gcc/expr.c | 10 ++- gcc/function.c | 58 ++++++++-------- gcc/function.h | 141 +++++++++++++++++++------------------- gcc/integrate.c | 22 +++--- gcc/stmt.c | 54 +++++++-------- gcc/stor-layout.c | 4 +- gcc/toplev.c | 8 +-- gcc/unroll.c | 4 +- gcc/varasm.c | 24 +++---- 22 files changed, 215 insertions(+), 219 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 74d0201b8e1f..19ce9063e876 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,9 @@ 1999-12-20 Bernd Schmidt + * function.c (cfun): Renamed from current_function. All users + changed. + * function.h (cfun): Rename declaration as well. + * reload.h (struct insn_chain): Change live_throughout and dead_or_set to be of type regset_head, not regset. All users changed by adding address operator. diff --git a/gcc/config/alpha/alpha.c b/gcc/config/alpha/alpha.c index 9dc2f733fbc2..282ffe9d5bd9 100644 --- a/gcc/config/alpha/alpha.c +++ b/gcc/config/alpha/alpha.c @@ -2739,13 +2739,13 @@ alpha_return_addr (count, frame) if (count != 0) return const0_rtx; - reg = current_function->machine->ra_rtx; + reg = cfun->machine->ra_rtx; if (reg == NULL) { /* No rtx yet. Invent one, and initialize it from $26 in the prologue. */ reg = gen_reg_rtx (Pmode); - current_function->machine->ra_rtx = reg; + cfun->machine->ra_rtx = reg; init = gen_rtx_SET (VOIDmode, reg, gen_rtx_REG (Pmode, REG_RA)); /* Emit the insn to the prologue with the other argument copies. */ @@ -2766,7 +2766,7 @@ alpha_ra_ever_killed () if (current_function_is_thunk) return 0; #endif - if (!current_function->machine->ra_rtx) + if (!cfun->machine->ra_rtx) return regs_ever_live[REG_RA]; push_topmost_sequence (); @@ -4090,7 +4090,7 @@ alpha_expand_epilogue () fp_is_frame_pointer = ((TARGET_OPEN_VMS && vms_is_stack_procedure) || (!TARGET_OPEN_VMS && frame_pointer_needed)); - eh_ofs = current_function->machine->eh_epilogue_sp_ofs; + eh_ofs = cfun->machine->eh_epilogue_sp_ofs; if (sa_size) { /* If we have a frame pointer, restore SP from it. */ diff --git a/gcc/config/alpha/alpha.md b/gcc/config/alpha/alpha.md index 5d5b8d2de9aa..31c3555eb5fa 100644 --- a/gcc/config/alpha/alpha.md +++ b/gcc/config/alpha/alpha.md @@ -5153,7 +5153,7 @@ "! TARGET_OPEN_VMS" " { - current_function->machine->eh_epilogue_sp_ofs = operands[1]; + cfun->machine->eh_epilogue_sp_ofs = operands[1]; if (GET_CODE (operands[2]) != REG || REGNO (operands[2]) != 26) { rtx ra = gen_rtx_REG (Pmode, 26); diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index 74d67c200093..18124b4f12dc 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -245,7 +245,7 @@ struct machine_function rtx stack_locals[(int) MAX_MACHINE_MODE][MAX_386_STACK_LOCALS]; }; -#define ix86_stack_locals (current_function->machine->stack_locals) +#define ix86_stack_locals (cfun->machine->stack_locals) /* which cpu are we scheduling for */ enum processor_type ix86_cpu; diff --git a/gcc/config/sparc/sparc.c b/gcc/config/sparc/sparc.c index ee2c974b5bc1..5af17e2c232e 100644 --- a/gcc/config/sparc/sparc.c +++ b/gcc/config/sparc/sparc.c @@ -2763,8 +2763,7 @@ mem_min_alignment (mem, desired) /* Check if the compiler has recorded some information about the alignment of the base REG. If reload has completed, we already matched with proper alignments. */ - if (((current_function != 0 - && REGNO_POINTER_ALIGN (regno) >= desired) + if (((cfun != 0 && REGNO_POINTER_ALIGN (regno) >= desired) || reload_completed) && ((INTVAL (offset) & (desired - 1)) == 0)) return 1; diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h index 6b22ee9e573f..8fd7bf39f0fe 100644 --- a/gcc/cp/cp-tree.h +++ b/gcc/cp/cp-tree.h @@ -707,7 +707,7 @@ struct language_function /* The current C++-specific per-function global variables. */ -#define cp_function_chain (current_function->language) +#define cp_function_chain (cfun->language) /* In a destructor, the point at which all derived class destroying has been done, just before any base class destroying will be done. */ @@ -737,14 +737,14 @@ struct language_function expression for `*this'. */ #define current_class_ptr \ - (current_function ? cp_function_chain->x_current_class_ptr : NULL_TREE) + (cfun ? cp_function_chain->x_current_class_ptr : NULL_TREE) #define current_class_ref \ - (current_function ? cp_function_chain->x_current_class_ref : NULL_TREE) + (cfun ? cp_function_chain->x_current_class_ref : NULL_TREE) /* Information about the current statement tree. */ #define current_stmt_tree \ - (current_function \ + (cfun \ ? &cp_function_chain->x_stmt_tree \ : &scope_chain->x_stmt_tree) diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 6b240f9e246a..8ef1d4f68cda 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -491,7 +491,7 @@ struct binding_level /* The binding level currently in effect. */ #define current_binding_level \ - (current_function \ + (cfun \ ? cp_function_chain->bindings \ : scope_chain->bindings) @@ -776,7 +776,7 @@ pushlevel (tag_transparent) { struct binding_level *newlevel; - if (current_function && !doing_semantic_analysis_p ()) + if (cfun && !doing_semantic_analysis_p ()) return; /* Reuse or create a struct for this binding level. */ @@ -1135,7 +1135,7 @@ poplevel (keep, reverse, functionbody) int block_previously_created; int leaving_for_scope; - if (current_function && !doing_semantic_analysis_p ()) + if (cfun && !doing_semantic_analysis_p ()) return NULL_TREE; my_friendly_assert (current_binding_level->parm_flag != 2, @@ -1379,7 +1379,7 @@ poplevel (keep, reverse, functionbody) /* Any uses of undefined labels now operate under constraints of next binding contour. */ - if (current_function) + if (cfun) { struct binding_level *level_chain; level_chain = current_binding_level->level_chain; @@ -2335,7 +2335,7 @@ maybe_push_to_top_level (pseudo) b = scope_chain ? current_binding_level : 0; /* If we're in the middle of some function, save our state. */ - if (current_function) + if (cfun) { need_pop = 1; push_function_context_to (NULL_TREE); @@ -3605,7 +3605,7 @@ pushdecl (x) /* We shouldn't be calling pushdecl when we're generating RTL for a function that we already did semantic analysis on previously. */ - my_friendly_assert (!current_function || doing_semantic_analysis_p (), + my_friendly_assert (!cfun || doing_semantic_analysis_p (), 19990913); name = DECL_ASSEMBLER_NAME (x); @@ -7616,7 +7616,7 @@ cp_finish_decl (decl, init, asmspec_tree, flags) /* Handling __FUNCTION__ and its ilk in a template-function requires some special processing because we are called from language-independent code. */ - if (current_function && processing_template_decl + if (cfun && processing_template_decl && current_function_name_declared == 2) { /* Since we're in a template function, we need to @@ -13068,8 +13068,7 @@ start_function (declspecs, declarator, attrs, flags) /* Initialize RTL machinery. We cannot do this until CURRENT_FUNCTION_DECL and DECL_RESULT are set up. We do this even when processing a template; this is how we get - CURRENT_FUNCTION set up, and our per-function variables - initialized. */ + CFUN set up, and our per-function variables initialized. */ bl = current_binding_level; init_function_start (decl1, input_filename, lineno); current_binding_level = bl; @@ -13080,7 +13079,7 @@ start_function (declspecs, declarator, attrs, flags) We haven't necessarily assigned RTL to all variables yet, so it's not safe to try to expand expressions involving them. */ immediate_size_expand = 0; - current_function->x_dont_save_pending_sizes_p = 1; + cfun->x_dont_save_pending_sizes_p = 1; /* If we're building a statement-tree, start the tree now. */ if (processing_template_decl || !expanding_p) @@ -13114,7 +13113,7 @@ start_function (declspecs, declarator, attrs, flags) /* Reset these in case the call to pushdecl changed them. */ current_function_decl = decl1; - current_function->decl = decl1; + cfun->decl = decl1; /* Initialize the per-function data. */ if (!DECL_PENDING_INLINE_P (decl1) && DECL_SAVED_FUNCTION_DATA (decl1)) @@ -13127,7 +13126,7 @@ start_function (declspecs, declarator, attrs, flags) /* This function is being processed in whole-function mode; we already did semantic analysis. */ - current_function->x_whole_function_mode_p = 1; + cfun->x_whole_function_mode_p = 1; /* If we decided that we didn't want to inline this function, make sure the back-end knows that. */ @@ -13957,11 +13956,11 @@ finish_function (lineno, flags) else { /* Clear out memory we no longer need. */ - free_after_parsing (current_function); + free_after_parsing (cfun); /* Since we never call rest_of_compilation, we never clear - CURRENT_FUNCTION. Do so explicitly. */ - free_after_compilation (current_function); - current_function = NULL; + CFUN. Do so explicitly. */ + free_after_compilation (cfun); + cfun = NULL; } /* If this is a in-class inline definition, we may have to pop the diff --git a/gcc/cp/method.c b/gcc/cp/method.c index 48732850a953..3e4cf2b36b28 100644 --- a/gcc/cp/method.c +++ b/gcc/cp/method.c @@ -2150,7 +2150,7 @@ emit_thunk (thunk_fndecl) ASM_OUTPUT_MI_THUNK (asm_out_file, thunk_fndecl, delta, function); assemble_end_function (thunk_fndecl, fnname); current_function_decl = 0; - current_function = 0; + cfun = 0; } #else /* ASM_OUTPUT_MI_THUNK */ { diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c index 5ac7bdb83f70..1790ef4c3ec4 100644 --- a/gcc/cp/semantics.c +++ b/gcc/cp/semantics.c @@ -976,7 +976,7 @@ begin_compound_stmt (has_no_scope) /* If this is the outermost block of the function, declare the variables __FUNCTION__, __PRETTY_FUNCTION__, and so forth. */ - if (current_function + if (cfun && !current_function_name_declared && !has_no_scope) { @@ -1351,7 +1351,7 @@ do_pushlevel () { pushlevel (0); if (!building_stmt_tree () - && !current_function->x_whole_function_mode_p) + && !cfun->x_whole_function_mode_p) my_friendly_abort (19991129); if (building_stmt_tree () && !processing_template_decl) @@ -1408,7 +1408,7 @@ begin_stmt_expr () /* If we're outside a function, we won't have a statement-tree to work with. But, if we see a statement-expression we need to create one. */ - if (!current_function && !last_tree) + if (! cfun && !last_tree) begin_stmt_tree (&scope_chain->x_saved_tree); keep_next_level (1); @@ -1452,7 +1452,7 @@ finish_stmt_expr (rtl_expr) /* If we created a statement-tree for this statement-expression, remove it now. */ - if (!current_function + if (! cfun && TREE_CHAIN (scope_chain->x_saved_tree) == NULL_TREE) finish_stmt_tree (&scope_chain->x_saved_tree); @@ -2259,7 +2259,7 @@ finish_stmt_tree (t) *t = stmt; SET_LAST_STMT (NULL_TREE); - if (current_function) + if (cfun) { /* The line-number recorded in the outermost statement in a function is the line number of the end of the function. */ diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c index c99d153a9532..8fb5179dc78c 100644 --- a/gcc/cp/typeck.c +++ b/gcc/cp/typeck.c @@ -5003,7 +5003,7 @@ mark_addressable (exp) x); TREE_ADDRESSABLE (x) = 1; TREE_USED (x) = 1; - if (current_function && expanding_p) + if (cfun && expanding_p) put_var_into_stack (x); return 1; diff --git a/gcc/emit-rtl.c b/gcc/emit-rtl.c index 84adb3c80d99..4d407c42ffaf 100644 --- a/gcc/emit-rtl.c +++ b/gcc/emit-rtl.c @@ -156,12 +156,12 @@ static rtx sequence_result[SEQUENCE_RESULT_SIZE]; /* During RTL generation, we also keep a list of free INSN rtl codes. */ static rtx free_insn; -#define first_insn (current_function->emit->x_first_insn) -#define last_insn (current_function->emit->x_last_insn) -#define cur_insn_uid (current_function->emit->x_cur_insn_uid) -#define last_linenum (current_function->emit->x_last_linenum) -#define last_filename (current_function->emit->x_last_filename) -#define first_label_num (current_function->emit->x_first_label_num) +#define first_insn (cfun->emit->x_first_insn) +#define last_insn (cfun->emit->x_last_insn) +#define cur_insn_uid (cfun->emit->x_cur_insn_uid) +#define last_linenum (cfun->emit->x_last_linenum) +#define last_filename (cfun->emit->x_last_filename) +#define first_label_num (cfun->emit->x_first_label_num) /* This is where the pointer to the obstack being used for RTL is stored. */ extern struct obstack *rtl_obstack; @@ -453,7 +453,7 @@ rtx gen_reg_rtx (mode) enum machine_mode mode; { - struct function *f = current_function; + struct function *f = cfun; register rtx val; /* Don't let anything called after initial flow analysis create new @@ -3643,7 +3643,7 @@ copy_insn (insn) void init_emit () { - struct function *f = current_function; + struct function *f = cfun; f->emit = (struct emit_status *) xmalloc (sizeof (struct emit_status)); first_insn = NULL; diff --git a/gcc/except.c b/gcc/except.c index 4b25b10199e6..f90fdc93d8b3 100644 --- a/gcc/except.c +++ b/gcc/except.c @@ -2598,8 +2598,7 @@ init_eh () void init_eh_for_function () { - current_function->eh - = (struct eh_status *) xcalloc (1, sizeof (struct eh_status)); + cfun->eh = (struct eh_status *) xcalloc (1, sizeof (struct eh_status)); ehqueue = (struct eh_queue *) xcalloc (1, sizeof (struct eh_queue)); eh_return_context = NULL_RTX; eh_return_stack_adjust = NULL_RTX; diff --git a/gcc/except.h b/gcc/except.h index befbccc94e6d..6120af4b30c7 100644 --- a/gcc/except.h +++ b/gcc/except.h @@ -138,15 +138,15 @@ struct eh_status rtx x_eh_return_stub_label; }; -#define ehstack (current_function->eh->x_ehstack) -#define catchstack (current_function->eh->x_catchstack) -#define ehqueue (current_function->eh->x_ehqueue) -#define catch_clauses (current_function->eh->x_catch_clauses) -#define false_label_stack (current_function->eh->x_false_label_stack) -#define caught_return_label_stack (current_function->eh->x_caught_return_label_stack) -#define protect_list (current_function->eh->x_protect_list) -#define current_function_ehc (current_function->eh->ehc) -#define eh_return_stub_label (current_function->eh->x_eh_return_stub_label) +#define ehstack (cfun->eh->x_ehstack) +#define catchstack (cfun->eh->x_catchstack) +#define ehqueue (cfun->eh->x_ehqueue) +#define catch_clauses (cfun->eh->x_catch_clauses) +#define false_label_stack (cfun->eh->x_false_label_stack) +#define caught_return_label_stack (cfun->eh->x_caught_return_label_stack) +#define protect_list (cfun->eh->x_protect_list) +#define current_function_ehc (cfun->eh->ehc) +#define eh_return_stub_label (cfun->eh->x_eh_return_stub_label) #ifdef TREE_CODE /* Start an exception handling region. All instructions emitted after diff --git a/gcc/expr.c b/gcc/expr.c index ac01d280a081..71210c01050d 100644 --- a/gcc/expr.c +++ b/gcc/expr.c @@ -285,8 +285,7 @@ init_expr_once () void init_expr () { - current_function->expr - = (struct expr_status *) xmalloc (sizeof (struct expr_status)); + cfun->expr = (struct expr_status *) xmalloc (sizeof (struct expr_status)); pending_chain = 0; pending_stack_adjust = 0; @@ -2671,8 +2670,7 @@ emit_move_insn_1 (x, y) rtx cmem = change_address (mem, mode, NULL_RTX); - current_function->cannot_inline - = "function uses short complex types"; + cfun->cannot_inline = "function uses short complex types"; if (packed_dest_p) { @@ -5873,7 +5871,7 @@ expand_expr (exp, target, tmode, modifier) memory protection). Aggregates are not checked here; they're handled elsewhere. */ - if (current_function && current_function_check_memory_usage + if (cfun && current_function_check_memory_usage && code == VAR_DECL && GET_CODE (DECL_RTL (exp)) == MEM && ! AGGREGATE_TYPE_P (TREE_TYPE (exp))) @@ -6391,7 +6389,7 @@ expand_expr (exp, target, tmode, modifier) op0 = expand_expr (exp1, NULL_RTX, VOIDmode, EXPAND_SUM); op0 = memory_address (mode, op0); - if (current_function && current_function_check_memory_usage + if (cfun && current_function_check_memory_usage && ! AGGREGATE_TYPE_P (TREE_TYPE (exp))) { enum memory_use_mode memory_usage; diff --git a/gcc/function.c b/gcc/function.c index 02ee9fb14eb0..9a73e1286a0b 100644 --- a/gcc/function.c +++ b/gcc/function.c @@ -140,7 +140,7 @@ void (*free_lang_status) PROTO((struct function *)); tree inline_function_decl; /* The currently compiled function. */ -struct function *current_function = 0; +struct function *cfun = 0; /* Global list of all compiled functions. */ struct function *all_functions = 0; @@ -322,14 +322,14 @@ push_function_context_to (context) if (context) { context_data = (context == current_function_decl - ? current_function + ? cfun : find_function_data (context)); context_data->contains_functions = 1; } - if (current_function == 0) + if (cfun == 0) init_dummy_function_start (); - p = current_function; + p = cfun; p->next = outer_function_chain; outer_function_chain = p; @@ -341,7 +341,7 @@ push_function_context_to (context) if (save_machine_status) (*save_machine_status) (p); - current_function = 0; + cfun = 0; } void @@ -361,7 +361,7 @@ pop_function_context_from (context) struct var_refs_queue *queue; struct var_refs_queue *next; - current_function = p; + cfun = p; outer_function_chain = p->next; current_function_decl = p->decl; @@ -487,7 +487,7 @@ get_func_frame_size (f) HOST_WIDE_INT get_frame_size () { - return get_func_frame_size (current_function); + return get_func_frame_size (cfun); } /* Allocate a stack slot of SIZE bytes and return a MEM rtx for it @@ -515,7 +515,7 @@ assign_stack_local_1 (mode, size, align, function) /* Allocate in the memory associated with the function in whose frame we are assigning. */ - if (function != current_function) + if (function != cfun) push_obstacks (function->function_obstack, function->function_maybepermanent_obstack); @@ -572,7 +572,7 @@ assign_stack_local_1 (mode, size, align, function) /* If we have already instantiated virtual registers, return the actual address relative to the frame pointer. */ - if (function == current_function && virtuals_instantiated) + if (function == cfun && virtuals_instantiated) addr = plus_constant (frame_pointer_rtx, (frame_offset + bigend_correction + STARTING_FRAME_OFFSET)); @@ -589,7 +589,7 @@ assign_stack_local_1 (mode, size, align, function) function->x_stack_slot_list = gen_rtx_EXPR_LIST (VOIDmode, x, function->x_stack_slot_list); - if (function != current_function) + if (function != cfun) pop_obstacks (); return x; @@ -603,7 +603,7 @@ assign_stack_local (mode, size, align) HOST_WIDE_INT size; int align; { - return assign_stack_local_1 (mode, size, align, current_function); + return assign_stack_local_1 (mode, size, align, cfun); } /* Allocate a temporary stack slot and record it for possible later @@ -1410,7 +1410,7 @@ put_reg_into_stack (function, reg, type, promoted_mode, decl_mode, volatile_p, int used_p; struct hash_table *ht; { - struct function *func = function ? function : current_function; + struct function *func = function ? function : cfun; rtx new = 0; int regno = original_regno; @@ -5442,7 +5442,7 @@ trampoline_address (function) #define TRAMPOLINE_REAL_SIZE (TRAMPOLINE_SIZE) #endif tramp = assign_stack_local_1 (BLKmode, TRAMPOLINE_REAL_SIZE, 0, - fp ? fp : current_function); + fp ? fp : cfun); #endif /* Record the trampoline for reuse and note it for later initialization @@ -5558,7 +5558,7 @@ identify_blocks (block, insns) /* In whole-function mode, we might not have seen the whole function yet, so we might not use up all the blocks. */ if (n_blocks != current_block_number - && !current_function->x_whole_function_mode_p) + && !cfun->x_whole_function_mode_p) abort (); free (block_vector); @@ -5665,7 +5665,7 @@ all_blocks (block, vector) static void prepare_function_start () { - current_function = (struct function *) xcalloc (1, sizeof (struct function)); + cfun = (struct function *) xcalloc (1, sizeof (struct function)); init_stmt_for_function (); init_eh_for_function (); @@ -5706,14 +5706,14 @@ prepare_function_start () /* We haven't done register allocation yet. */ reg_renumber = 0; - init_varasm_status (current_function); + init_varasm_status (cfun); /* Clear out data used for inlining. */ - current_function->inlinable = 0; - current_function->original_decl_initial = 0; - current_function->original_arg_vector = 0; + cfun->inlinable = 0; + cfun->original_decl_initial = 0; + cfun->original_arg_vector = 0; - current_function->stack_alignment_needed = 0; + cfun->stack_alignment_needed = 0; /* Set if a call to setjmp is seen. */ current_function_calls_setjmp = 0; @@ -5777,9 +5777,9 @@ prepare_function_start () current_function_outgoing_args_size = 0; if (init_lang_status) - (*init_lang_status) (current_function); + (*init_lang_status) (cfun); if (init_machine_status) - (*init_machine_status) (current_function); + (*init_machine_status) (cfun); } /* Initialize the rtl expansion mechanism so that we can do simple things @@ -5804,11 +5804,11 @@ init_function_start (subr, filename, line) prepare_function_start (); /* Remember this function for later. */ - current_function->next_global = all_functions; - all_functions = current_function; + cfun->next_global = all_functions; + all_functions = cfun; current_function_name = (*decl_printable_name) (subr, 2); - current_function->decl = subr; + cfun->decl = subr; /* Nonzero if this is a nested function that uses a static chain. */ @@ -6158,10 +6158,10 @@ expand_dummy_function_end () /* Outside function body, can't compute type's actual size until next function's body starts. */ - free_after_parsing (current_function); - free_after_compilation (current_function); - free (current_function); - current_function = 0; + free_after_parsing (cfun); + free_after_compilation (cfun); + free (cfun); + cfun = 0; } /* Emit CODE for each register of the return value. Useful values for diff --git a/gcc/function.h b/gcc/function.h index a641189e5d1e..e252f7550fee 100644 --- a/gcc/function.h +++ b/gcc/function.h @@ -115,15 +115,13 @@ struct emit_status }; /* For backward compatibility... eventually these should all go away. */ -#define reg_rtx_no (current_function->emit->x_reg_rtx_no) -#define seq_rtl_expr (current_function->emit->sequence_rtl_expr) -#define regno_reg_rtx (current_function->emit->x_regno_reg_rtx) -#define seq_stack (current_function->emit->sequence_stack) +#define reg_rtx_no (cfun->emit->x_reg_rtx_no) +#define seq_rtl_expr (cfun->emit->sequence_rtl_expr) +#define regno_reg_rtx (cfun->emit->x_regno_reg_rtx) +#define seq_stack (cfun->emit->sequence_stack) -#define REGNO_POINTER_ALIGN(REGNO) \ - (current_function->emit->regno_pointer_align[REGNO]) -#define REGNO_POINTER_FLAG(REGNO) \ - (current_function->emit->regno_pointer_flag[REGNO]) +#define REGNO_POINTER_ALIGN(REGNO) (cfun->emit->regno_pointer_align[REGNO]) +#define REGNO_POINTER_FLAG(REGNO) (cfun->emit->regno_pointer_flag[REGNO]) struct expr_status { @@ -163,12 +161,12 @@ struct expr_status rtx x_pending_chain; }; -#define pending_stack_adjust (current_function->expr->x_pending_stack_adjust) -#define inhibit_defer_pop (current_function->expr->x_inhibit_defer_pop) -#define saveregs_value (current_function->expr->x_saveregs_value) -#define apply_args_value (current_function->expr->x_apply_args_value) -#define forced_labels (current_function->expr->x_forced_labels) -#define pending_chain (current_function->expr->x_pending_chain) +#define pending_stack_adjust (cfun->expr->x_pending_stack_adjust) +#define inhibit_defer_pop (cfun->expr->x_inhibit_defer_pop) +#define saveregs_value (cfun->expr->x_saveregs_value) +#define apply_args_value (cfun->expr->x_apply_args_value) +#define forced_labels (cfun->expr->x_forced_labels) +#define pending_chain (cfun->expr->x_pending_chain) /* This structure can save all the important global and static variables describing the status of the current function. */ @@ -469,65 +467,68 @@ struct function rtx epilogue_delay_list; }; -extern struct function *current_function; +/* The function currently being compiled. */ +extern struct function *cfun; + +/* A list of all functions we have compiled so far. */ extern struct function *all_functions; /* For backward compatibility... eventually these should all go away. */ -#define current_function_name (current_function->name) -#define current_function_pops_args (current_function->pops_args) -#define current_function_returns_struct (current_function->returns_struct) -#define current_function_returns_pcc_struct (current_function->returns_pcc_struct) -#define current_function_returns_pointer (current_function->returns_pointer) -#define current_function_needs_context (current_function->needs_context) -#define current_function_calls_setjmp (current_function->calls_setjmp) -#define current_function_calls_alloca (current_function->calls_alloca) -#define current_function_calls_longjmp (current_function->calls_longjmp) -#define current_function_has_computed_jump (current_function->has_computed_jump) -#define current_function_contains_functions (current_function->contains_functions) -#define current_function_is_thunk (current_function->is_thunk) -#define current_function_args_info (current_function->args_info) -#define current_function_args_size (current_function->args_size) -#define current_function_pretend_args_size (current_function->pretend_args_size) -#define current_function_outgoing_args_size (current_function->outgoing_args_size) -#define current_function_arg_offset_rtx (current_function->arg_offset_rtx) -#define current_function_varargs (current_function->varargs) -#define current_function_stdarg (current_function->stdarg) -#define current_function_internal_arg_pointer (current_function->internal_arg_pointer) -#define current_function_return_rtx (current_function->return_rtx) -#define current_function_instrument_entry_exit (current_function->instrument_entry_exit) -#define current_function_check_memory_usage (current_function->check_memory_usage) -#define current_function_limit_stack (current_function->limit_stack) -#define current_function_uses_pic_offset_table (current_function->uses_pic_offset_table) -#define current_function_uses_const_pool (current_function->uses_const_pool) -#define current_function_cannot_inline (current_function->cannot_inline) -#define current_function_epilogue_delay_list (current_function->epilogue_delay_list) -#define current_function_has_nonlocal_label (current_function->has_nonlocal_label) -#define current_function_has_nonlocal_goto (current_function->has_nonlocal_goto) - -#define max_parm_reg (current_function->x_max_parm_reg) -#define parm_reg_stack_loc (current_function->x_parm_reg_stack_loc) -#define cleanup_label (current_function->x_cleanup_label) -#define return_label (current_function->x_return_label) -#define save_expr_regs (current_function->x_save_expr_regs) -#define stack_slot_list (current_function->x_stack_slot_list) -#define parm_birth_insn (current_function->x_parm_birth_insn) -#define frame_offset (current_function->x_frame_offset) -#define tail_recursion_label (current_function->x_tail_recursion_label) -#define tail_recursion_reentry (current_function->x_tail_recursion_reentry) -#define arg_pointer_save_area (current_function->x_arg_pointer_save_area) -#define rtl_expr_chain (current_function->x_rtl_expr_chain) -#define last_parm_insn (current_function->x_last_parm_insn) -#define context_display (current_function->x_context_display) -#define trampoline_list (current_function->x_trampoline_list) -#define function_call_count (current_function->x_function_call_count) -#define temp_slots (current_function->x_temp_slots) -#define temp_slot_level (current_function->x_temp_slot_level) -#define target_temp_slot_level (current_function->x_target_temp_slot_level) -#define var_temp_slot_level (current_function->x_var_temp_slot_level) -#define nonlocal_labels (current_function->x_nonlocal_labels) -#define nonlocal_goto_handler_slots (current_function->x_nonlocal_goto_handler_slots) -#define nonlocal_goto_handler_labels (current_function->x_nonlocal_goto_handler_labels) -#define nonlocal_goto_stack_level (current_function->x_nonlocal_goto_stack_level) +#define current_function_name (cfun->name) +#define current_function_pops_args (cfun->pops_args) +#define current_function_returns_struct (cfun->returns_struct) +#define current_function_returns_pcc_struct (cfun->returns_pcc_struct) +#define current_function_returns_pointer (cfun->returns_pointer) +#define current_function_needs_context (cfun->needs_context) +#define current_function_calls_setjmp (cfun->calls_setjmp) +#define current_function_calls_alloca (cfun->calls_alloca) +#define current_function_calls_longjmp (cfun->calls_longjmp) +#define current_function_has_computed_jump (cfun->has_computed_jump) +#define current_function_contains_functions (cfun->contains_functions) +#define current_function_is_thunk (cfun->is_thunk) +#define current_function_args_info (cfun->args_info) +#define current_function_args_size (cfun->args_size) +#define current_function_pretend_args_size (cfun->pretend_args_size) +#define current_function_outgoing_args_size (cfun->outgoing_args_size) +#define current_function_arg_offset_rtx (cfun->arg_offset_rtx) +#define current_function_varargs (cfun->varargs) +#define current_function_stdarg (cfun->stdarg) +#define current_function_internal_arg_pointer (cfun->internal_arg_pointer) +#define current_function_return_rtx (cfun->return_rtx) +#define current_function_instrument_entry_exit (cfun->instrument_entry_exit) +#define current_function_check_memory_usage (cfun->check_memory_usage) +#define current_function_limit_stack (cfun->limit_stack) +#define current_function_uses_pic_offset_table (cfun->uses_pic_offset_table) +#define current_function_uses_const_pool (cfun->uses_const_pool) +#define current_function_cannot_inline (cfun->cannot_inline) +#define current_function_epilogue_delay_list (cfun->epilogue_delay_list) +#define current_function_has_nonlocal_label (cfun->has_nonlocal_label) +#define current_function_has_nonlocal_goto (cfun->has_nonlocal_goto) + +#define max_parm_reg (cfun->x_max_parm_reg) +#define parm_reg_stack_loc (cfun->x_parm_reg_stack_loc) +#define cleanup_label (cfun->x_cleanup_label) +#define return_label (cfun->x_return_label) +#define save_expr_regs (cfun->x_save_expr_regs) +#define stack_slot_list (cfun->x_stack_slot_list) +#define parm_birth_insn (cfun->x_parm_birth_insn) +#define frame_offset (cfun->x_frame_offset) +#define tail_recursion_label (cfun->x_tail_recursion_label) +#define tail_recursion_reentry (cfun->x_tail_recursion_reentry) +#define arg_pointer_save_area (cfun->x_arg_pointer_save_area) +#define rtl_expr_chain (cfun->x_rtl_expr_chain) +#define last_parm_insn (cfun->x_last_parm_insn) +#define context_display (cfun->x_context_display) +#define trampoline_list (cfun->x_trampoline_list) +#define function_call_count (cfun->x_function_call_count) +#define temp_slots (cfun->x_temp_slots) +#define temp_slot_level (cfun->x_temp_slot_level) +#define target_temp_slot_level (cfun->x_target_temp_slot_level) +#define var_temp_slot_level (cfun->x_var_temp_slot_level) +#define nonlocal_labels (cfun->x_nonlocal_labels) +#define nonlocal_goto_handler_slots (cfun->x_nonlocal_goto_handler_slots) +#define nonlocal_goto_handler_labels (cfun->x_nonlocal_goto_handler_labels) +#define nonlocal_goto_stack_level (cfun->x_nonlocal_goto_stack_level) /* The FUNCTION_DECL for an inline function currently being expanded. */ extern tree inline_function_decl; diff --git a/gcc/integrate.c b/gcc/integrate.c index c50c1d4923c9..4b4988b335d8 100644 --- a/gcc/integrate.c +++ b/gcc/integrate.c @@ -430,11 +430,11 @@ save_for_inline_nocopy (fndecl) preserve_data (); - current_function->inl_max_label_num = max_label_num (); - current_function->inl_last_parm_insn = current_function->x_last_parm_insn; - current_function->original_arg_vector = argvec; - current_function->original_decl_initial = DECL_INITIAL (fndecl); - DECL_SAVED_INSNS (fndecl) = current_function; + cfun->inl_max_label_num = max_label_num (); + cfun->inl_last_parm_insn = cfun->x_last_parm_insn; + cfun->original_arg_vector = argvec; + cfun->original_decl_initial = DECL_INITIAL (fndecl); + DECL_SAVED_INSNS (fndecl) = cfun; /* Clean up. */ free (parmdecl_map); @@ -1395,7 +1395,7 @@ expand_inline_function (fndecl, parms, target, ignore, type, if (inl_f->calls_alloca) emit_stack_restore (SAVE_BLOCK, stack_save, NULL_RTX); - if (!current_function->x_whole_function_mode_p) + if (! cfun->x_whole_function_mode_p) /* In statement-at-a-time mode, we just tell the front-end to add this block to the list of blocks at this binding level. We can't do it the way it's done for function-at-a-time mode the @@ -1810,7 +1810,7 @@ copy_rtx_and_substitute (orig, map, for_lhs) remapped label. Otherwise, symbols are returned unchanged. */ if (CONSTANT_POOL_ADDRESS_P (orig)) { - struct function *f = inlining ? inlining : current_function; + struct function *f = inlining ? inlining : cfun; rtx constant = get_pool_constant_for_function (f, orig); enum machine_mode const_mode = get_pool_mode_for_function (f, orig); if (inlining) @@ -2572,10 +2572,10 @@ void output_inline_function (fndecl) tree fndecl; { - struct function *curf = current_function; + struct function *old_cfun = cfun; struct function *f = DECL_SAVED_INSNS (fndecl); - current_function = f; + cfun = f; current_function_decl = fndecl; clear_emit_caches (); @@ -2606,6 +2606,6 @@ output_inline_function (fndecl) /* Compile this function all the way down to assembly code. */ rest_of_compilation (fndecl); - current_function = curf; - current_function_decl = curf ? curf->decl : 0; + cfun = old_cfun; + current_function_decl = old_cfun ? old_cfun->decl : 0; } diff --git a/gcc/stmt.c b/gcc/stmt.c index 826295ba5bbd..1562ae591860 100644 --- a/gcc/stmt.c +++ b/gcc/stmt.c @@ -378,20 +378,20 @@ struct stmt_status struct goto_fixup *x_goto_fixup_chain; }; -#define block_stack (current_function->stmt->x_block_stack) -#define stack_block_stack (current_function->stmt->x_stack_block_stack) -#define cond_stack (current_function->stmt->x_cond_stack) -#define loop_stack (current_function->stmt->x_loop_stack) -#define case_stack (current_function->stmt->x_case_stack) -#define nesting_stack (current_function->stmt->x_nesting_stack) -#define nesting_depth (current_function->stmt->x_nesting_depth) -#define current_block_start_count (current_function->stmt->x_block_start_count) -#define last_expr_type (current_function->stmt->x_last_expr_type) -#define last_expr_value (current_function->stmt->x_last_expr_value) -#define expr_stmts_for_value (current_function->stmt->x_expr_stmts_for_value) -#define emit_filename (current_function->stmt->x_emit_filename) -#define emit_lineno (current_function->stmt->x_emit_lineno) -#define goto_fixup_chain (current_function->stmt->x_goto_fixup_chain) +#define block_stack (cfun->stmt->x_block_stack) +#define stack_block_stack (cfun->stmt->x_stack_block_stack) +#define cond_stack (cfun->stmt->x_cond_stack) +#define loop_stack (cfun->stmt->x_loop_stack) +#define case_stack (cfun->stmt->x_case_stack) +#define nesting_stack (cfun->stmt->x_nesting_stack) +#define nesting_depth (cfun->stmt->x_nesting_depth) +#define current_block_start_count (cfun->stmt->x_block_start_count) +#define last_expr_type (cfun->stmt->x_last_expr_type) +#define last_expr_value (cfun->stmt->x_last_expr_value) +#define expr_stmts_for_value (cfun->stmt->x_expr_stmts_for_value) +#define emit_filename (cfun->stmt->x_emit_filename) +#define emit_lineno (cfun->stmt->x_emit_lineno) +#define goto_fixup_chain (cfun->stmt->x_goto_fixup_chain) /* Non-zero if we are using EH to handle cleanus. */ static int using_eh_for_cleanups_p = 0; @@ -605,8 +605,7 @@ init_stmt () void init_stmt_for_function () { - current_function->stmt - = (struct stmt_status *) xmalloc (sizeof (struct stmt_status)); + cfun->stmt = (struct stmt_status *) xmalloc (sizeof (struct stmt_status)); /* We are not currently within any block, conditional, loop or case. */ block_stack = 0; @@ -1030,7 +1029,7 @@ expand_fixup (tree_label, rtl_label, last_insn) block = make_node (BLOCK); TREE_USED (block) = 1; - if (!current_function->x_whole_function_mode_p) + if (!cfun->x_whole_function_mode_p) insert_block (block); else { @@ -1042,11 +1041,11 @@ expand_fixup (tree_label, rtl_label, last_insn) start_sequence (); start = emit_note (NULL_PTR, NOTE_INSN_BLOCK_BEG); - if (current_function->x_whole_function_mode_p) + if (cfun->x_whole_function_mode_p) NOTE_BLOCK (start) = block; fixup->before_jump = emit_note (NULL_PTR, NOTE_INSN_DELETED); end = emit_note (NULL_PTR, NOTE_INSN_BLOCK_END); - if (current_function->x_whole_function_mode_p) + if (cfun->x_whole_function_mode_p) NOTE_BLOCK (end) = block; fixup->context = block; end_sequence (); @@ -2630,8 +2629,7 @@ preserve_subexpressions_p () if (flag_expensive_optimizations) return 1; - if (optimize == 0 || current_function == 0 - || current_function->stmt == 0 || loop_stack == 0) + if (optimize == 0 || cfun == 0 || cfun->stmt == 0 || loop_stack == 0) return 0; insn = get_last_insn_anywhere (); @@ -3359,8 +3357,7 @@ mark_block_as_not_eh_region () int is_eh_region () { - return (current_function && block_stack - && block_stack->data.block.exception_region); + return cfun && block_stack && block_stack->data.block.exception_region; } /* Emit a handler label for a nonlocal goto handler. @@ -3970,7 +3967,7 @@ expand_decl_cleanup (decl, cleanup) struct nesting *thisblock; /* Error if we are not in any block. */ - if (current_function == 0 || block_stack == 0) + if (cfun == 0 || block_stack == 0) return 0; thisblock = block_stack; @@ -4104,7 +4101,7 @@ expand_dcc_cleanup (decl) tree cleanup; /* Error if we are not in any block. */ - if (current_function == 0 || block_stack == 0) + if (cfun == 0 || block_stack == 0) return 0; thisblock = block_stack; @@ -4146,7 +4143,7 @@ expand_dhc_cleanup (decl) tree cleanup; /* Error if we are not in any block. */ - if (current_function == 0 || block_stack == 0) + if (cfun == 0 || block_stack == 0) return 0; thisblock = block_stack; @@ -4175,7 +4172,7 @@ void expand_anon_union_decl (decl, cleanup, decl_elts) tree decl, cleanup, decl_elts; { - struct nesting *thisblock = current_function == 0 ? 0 : block_stack; + struct nesting *thisblock = cfun == 0 ? 0 : block_stack; rtx x; tree t; @@ -4381,8 +4378,7 @@ any_pending_cleanups (this_contour) { struct nesting *block; - if (current_function == NULL || current_function->stmt == NULL - || block_stack == 0) + if (cfun == NULL || cfun->stmt == NULL || block_stack == 0) return 0; if (this_contour && block_stack->data.block.cleanups != NULL) diff --git a/gcc/stor-layout.c b/gcc/stor-layout.c index 4fa645af9d92..cbc867280089 100644 --- a/gcc/stor-layout.c +++ b/gcc/stor-layout.c @@ -123,8 +123,8 @@ variable_size (size) Also, we would like to pass const0_rtx here, but don't have it. */ expand_expr (size, expand_expr (integer_zero_node, NULL_PTR, VOIDmode, 0), VOIDmode, 0); - else if (current_function != 0 - && current_function->x_dont_save_pending_sizes_p) + else if (cfun != 0 + && cfun->x_dont_save_pending_sizes_p) /* The front-end doesn't want us to keep a list of the expressions that determine sizes for variable size objects. */ ; diff --git a/gcc/toplev.c b/gcc/toplev.c index 39354a56096e..a8dd7b2a5175 100644 --- a/gcc/toplev.c +++ b/gcc/toplev.c @@ -2752,7 +2752,7 @@ rest_of_compilation (decl) /* In function-at-a-time mode, we do not attempt to keep the BLOCK tree in sensible shape. So, we just recalculate it here. */ - if (current_function->x_whole_function_mode_p) + if (cfun->x_whole_function_mode_p) { find_loop_tree_blocks (); unroll_block_trees (); @@ -3676,10 +3676,10 @@ rest_of_compilation (decl) init_recog_no_volatile (); /* We're done with this function. Free up memory if we can. */ - free_after_parsing (current_function); + free_after_parsing (cfun); if (! DECL_DEFER_OUTPUT (decl)) - free_after_compilation (current_function); - current_function = 0; + free_after_compilation (cfun); + cfun = 0; if (ggc_p) ggc_collect (); diff --git a/gcc/unroll.c b/gcc/unroll.c index 6135b858ca75..5b359a9962e1 100644 --- a/gcc/unroll.c +++ b/gcc/unroll.c @@ -1180,8 +1180,8 @@ unroll_loop (loop_end, insn_count, loop_start, end_insert_before, } /* Use our current register alignment and pointer flags. */ - map->regno_pointer_flag = current_function->emit->regno_pointer_flag; - map->regno_pointer_align = current_function->emit->regno_pointer_align; + map->regno_pointer_flag = cfun->emit->regno_pointer_flag; + map->regno_pointer_align = cfun->emit->regno_pointer_align; /* If the loop is being partially unrolled, and the iteration variables are being split, and are being renamed for the split, then must fix up diff --git a/gcc/varasm.c b/gcc/varasm.c index aca7a074d433..efe2c0605eed 100644 --- a/gcc/varasm.c +++ b/gcc/varasm.c @@ -120,12 +120,12 @@ struct varasm_status rtx x_const_double_chain; }; -#define const_rtx_hash_table (current_function->varasm->x_const_rtx_hash_table) -#define const_rtx_sym_hash_table (current_function->varasm->x_const_rtx_sym_hash_table) -#define first_pool (current_function->varasm->x_first_pool) -#define last_pool (current_function->varasm->x_last_pool) -#define pool_offset (current_function->varasm->x_pool_offset) -#define const_double_chain (current_function->varasm->x_const_double_chain) +#define const_rtx_hash_table (cfun->varasm->x_const_rtx_hash_table) +#define const_rtx_sym_hash_table (cfun->varasm->x_const_rtx_sym_hash_table) +#define first_pool (cfun->varasm->x_first_pool) +#define last_pool (cfun->varasm->x_last_pool) +#define pool_offset (cfun->varasm->x_pool_offset) +#define const_double_chain (cfun->varasm->x_const_double_chain) /* Number for making the label on the next constant that is stored in memory. */ @@ -2108,7 +2108,7 @@ immed_double_const (i0, i1, mode) /* Search the chain for an existing CONST_DOUBLE with the right value. If one is found, return it. */ - if (current_function != 0) + if (cfun != 0) for (r = const_double_chain; r; r = CONST_DOUBLE_CHAIN (r)) if (CONST_DOUBLE_LOW (r) == i0 && CONST_DOUBLE_HIGH (r) == i1 && GET_MODE (r) == mode) @@ -2180,7 +2180,7 @@ immed_real_const_1 (d, mode) /* Search the chain for an existing CONST_DOUBLE with the right value. If one is found, return it. */ - if (current_function != 0) + if (cfun != 0) for (r = const_double_chain; r; r = CONST_DOUBLE_CHAIN (r)) if (! bcmp ((char *) &CONST_DOUBLE_LOW (r), (char *) &u, sizeof u) && GET_MODE (r) == mode) @@ -3686,7 +3686,7 @@ rtx get_pool_constant (addr) rtx addr; { - return (find_pool_constant (current_function, addr))->constant; + return (find_pool_constant (cfun, addr))->constant; } /* Likewise, but for the constant pool of a specific function. */ @@ -3705,7 +3705,7 @@ enum machine_mode get_pool_mode (addr) rtx addr; { - return (find_pool_constant (current_function, addr))->mode; + return (find_pool_constant (cfun, addr))->mode; } enum machine_mode @@ -3722,7 +3722,7 @@ int get_pool_offset (addr) rtx addr; { - return (find_pool_constant (current_function, addr))->offset; + return (find_pool_constant (cfun, addr))->offset; } /* Return the size of the constant pool. */ @@ -3895,7 +3895,7 @@ mark_constants (x) if (GET_CODE (x) == SYMBOL_REF) { if (CONSTANT_POOL_ADDRESS_P (x)) - find_pool_constant (current_function, x)->mark = 1; + find_pool_constant (cfun, x)->mark = 1; return; } /* Never search inside a CONST_DOUBLE, because CONST_DOUBLE_MEM may be -- 2.43.5