From ebb1b59ac046c73a55541f5c6d7acc65c6e284b9 Mon Sep 17 00:00:00 2001 From: Bernd Schmidt Date: Sun, 17 Sep 2000 12:45:51 +0000 Subject: [PATCH] Bring back equal forms for libcalls From-SVN: r36469 --- gcc/ChangeLog | 13 +++++++++ gcc/builtins.c | 14 +++++----- gcc/calls.c | 71 ++++++++++++++++++++++++++++++++++++++--------- gcc/except.c | 5 ++-- gcc/expr.c | 87 +++++++++++++++++++++++++++++++--------------------------- gcc/expr.h | 5 ---- gcc/function.c | 11 ++++---- gcc/optabs.c | 25 +++++++++-------- gcc/rtl.h | 20 ++++++++++---- gcc/stmt.c | 2 +- 10 files changed, 162 insertions(+), 91 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index d3a8a6b..13fa24d 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,16 @@ +2000-09-17 Bernd Schmidt + + * expr.h (emit_library_call, emit_library_call_value): Delete + declarations. + * rtl.h (enum libcall_type): New. + (emit_library_call, emit_library_call_value): Change fn_type arg to + be of type enum libcall_type. + * calls.c: Likewise for the function definitions. Several callers + throughout changed to use the new enumeration appropriately. + (emit_library_call_value_1): Likewise. Put back code to make libcall + blocks of equal form, but only use it for the two new higher + enumeration values. + 2000-09-16 Mark Mitchell Convert the C front-end to use function-at-a-time mode. diff --git a/gcc/builtins.c b/gcc/builtins.c index 74a1d86..2983b2b 100644 --- a/gcc/builtins.c +++ b/gcc/builtins.c @@ -1388,8 +1388,8 @@ expand_builtin_strlen (exp, target, mode) /* Check the string is readable and has an end. */ if (current_function_check_memory_usage) - emit_library_call (chkr_check_str_libfunc, 1, VOIDmode, 2, - src_reg, Pmode, + emit_library_call (chkr_check_str_libfunc, LCT_CONST_MAKE_BLOCK, + VOIDmode, 2, src_reg, Pmode, GEN_INT (MEMORY_USE_RO), TYPE_MODE (integer_type_node)); @@ -1468,8 +1468,8 @@ expand_builtin_memcpy (arglist) /* Just copy the rights of SRC to the rights of DEST. */ if (current_function_check_memory_usage) - emit_library_call (chkr_copy_bitmap_libfunc, 1, VOIDmode, 3, - XEXP (dest_mem, 0), Pmode, + emit_library_call (chkr_copy_bitmap_libfunc, LCT_CONST_MAKE_BLOCK, + VOIDmode, 3, XEXP (dest_mem, 0), Pmode, XEXP (src_mem, 0), Pmode, len_rtx, TYPE_MODE (sizetype)); @@ -1574,8 +1574,8 @@ expand_builtin_memset (exp) /* Just check DST is writable and mark it as readable. */ if (current_function_check_memory_usage) - emit_library_call (chkr_check_addr_libfunc, 1, VOIDmode, 3, - XEXP (dest_mem, 0), Pmode, + emit_library_call (chkr_check_addr_libfunc, LCT_CONST_MAKE_BLOCK, + VOIDmode, 3, XEXP (dest_mem, 0), Pmode, len_rtx, TYPE_MODE (sizetype), GEN_INT (MEMORY_USE_WO), TYPE_MODE (integer_type_node)); @@ -1687,7 +1687,7 @@ expand_builtin_memcmp (exp, arglist, target) if (insn) emit_insn (insn); else - emit_library_call_value (memcmp_libfunc, result, 2, + emit_library_call_value (memcmp_libfunc, result, LCT_PURE_MAKE_BLOCK, TYPE_MODE (integer_type_node), 3, XEXP (arg1_rtx, 0), Pmode, XEXP (arg2_rtx, 0), Pmode, diff --git a/gcc/calls.c b/gcc/calls.c index 7186611..2163e51 100644 --- a/gcc/calls.c +++ b/gcc/calls.c @@ -219,7 +219,8 @@ static rtx rtx_for_function_call PARAMS ((tree, tree)); static void load_register_parameters PARAMS ((struct arg_data *, int, rtx *, int)); static int libfunc_nothrow PARAMS ((rtx)); -static rtx emit_library_call_value_1 PARAMS ((int, rtx, rtx, int, +static rtx emit_library_call_value_1 PARAMS ((int, rtx, rtx, + enum libcall_type, enum machine_mode, int, va_list)); static int special_function_p PARAMS ((tree, int)); @@ -1678,9 +1679,8 @@ rtx_for_function_call (fndecl, exp) that this seems safer. */ funaddr = convert_memory_address (Pmode, funexp); #endif - emit_library_call (chkr_check_exec_libfunc, 1, - VOIDmode, 1, - funaddr, Pmode); + emit_library_call (chkr_check_exec_libfunc, LCT_CONST_MAKE_BLOCK, + VOIDmode, 1, funaddr, Pmode); } emit_queue (); } @@ -3026,7 +3026,7 @@ expand_call (exp, target, ignore) /* Mark the memory for the aggregate as write-only. */ if (current_function_check_memory_usage) - emit_library_call (chkr_set_right_libfunc, 1, + emit_library_call (chkr_set_right_libfunc, LCT_CONST_MAKE_BLOCK, VOIDmode, 3, structure_value_addr, ptr_mode, GEN_INT (struct_value_size), @@ -3465,7 +3465,7 @@ emit_library_call_value_1 (retval, orgfun, value, fn_type, outmode, nargs, p) int retval; rtx orgfun; rtx value; - int fn_type; + enum libcall_type fn_type; enum machine_mode outmode; int nargs; va_list p; @@ -3521,9 +3521,9 @@ emit_library_call_value_1 (retval, orgfun, value, fn_type, outmode, nargs, p) #endif #endif - if (fn_type == 1) + if (fn_type == LCT_CONST_MAKE_BLOCK) flags |= ECF_CONST; - else if (fn_type == 2) + else if (fn_type == LCT_PURE_MAKE_BLOCK) flags |= ECF_PURE; fun = orgfun; @@ -3580,6 +3580,11 @@ emit_library_call_value_1 (retval, orgfun, value, fn_type, outmode, nargs, p) count = 0; + /* Now we are about to start emitting insns that can be deleted + if a libcall is deleted. */ + if (flags & (ECF_CONST | ECF_PURE)) + start_sequence (); + push_temp_slots (); /* If there's a structure value address to be passed, @@ -4017,6 +4022,45 @@ emit_library_call_value_1 (retval, orgfun, value, fn_type, outmode, nargs, p) /* Now restore inhibit_defer_pop to its actual original value. */ OK_DEFER_POP; + /* If call is cse'able, make appropriate pair of reg-notes around it. + Test valreg so we don't crash; may safely ignore `const' + if return type is void. Disable for PARALLEL return values, because + we have no way to move such values into a pseudo register. */ + if ((flags & (ECF_CONST | ECF_PURE)) + && valreg != 0 && GET_CODE (valreg) != PARALLEL) + { + rtx note = 0; + rtx temp = gen_reg_rtx (GET_MODE (valreg)); + rtx insns; + int i; + + /* Construct an "equal form" for the value which mentions all the + arguments in order as well as the function name. */ + for (i = 0; i < nargs; i++) + note = gen_rtx_EXPR_LIST (VOIDmode, argvec[i].value, note); + note = gen_rtx_EXPR_LIST (VOIDmode, fun, note); + + insns = get_insns (); + end_sequence (); + + if (flags & ECF_PURE) + note = gen_rtx_EXPR_LIST (VOIDmode, + gen_rtx_USE (VOIDmode, + gen_rtx_MEM (BLKmode, + gen_rtx_SCRATCH (VOIDmode))), note); + + emit_libcall_block (insns, temp, valreg, note); + + valreg = temp; + } + else if (flags & (ECF_CONST | ECF_PURE)) + { + /* Otherwise, just write out the sequence without a note. */ + rtx insns = get_insns (); + + end_sequence (); + emit_insns (insns); + } pop_temp_slots (); /* Copy the value to the right place. */ @@ -4098,8 +4142,8 @@ emit_library_call_value_1 (retval, orgfun, value, fn_type, outmode, nargs, p) (use (memory (scratch)). */ void -emit_library_call VPARAMS((rtx orgfun, int fn_type, enum machine_mode outmode, - int nargs, ...)) +emit_library_call VPARAMS((rtx orgfun, enum libcall_type fn_type, + enum machine_mode outmode, int nargs, ...)) { #ifndef ANSI_PROTOTYPES rtx orgfun; @@ -4132,7 +4176,8 @@ emit_library_call VPARAMS((rtx orgfun, int fn_type, enum machine_mode outmode, If VALUE is nonzero, VALUE is returned. */ rtx -emit_library_call_value VPARAMS((rtx orgfun, rtx value, int fn_type, +emit_library_call_value VPARAMS((rtx orgfun, rtx value, + enum libcall_type fn_type, enum machine_mode outmode, int nargs, ...)) { #ifndef ANSI_PROTOTYPES @@ -4376,8 +4421,8 @@ store_one_arg (arg, argblock, flags, variable_size, reg_parm_stack_space) /* If the value is already in the stack slot, we are done. */ if (current_function_check_memory_usage && GET_CODE (arg->stack) == MEM) { - emit_library_call (chkr_set_right_libfunc, 1, VOIDmode, 3, - XEXP (arg->stack, 0), Pmode, + emit_library_call (chkr_set_right_libfunc, LCT_CONST_MAKE_BLOCK, + VOIDmode, 3, XEXP (arg->stack, 0), Pmode, ARGS_SIZE_RTX (arg->size), TYPE_MODE (sizetype), GEN_INT (MEMORY_USE_RW), diff --git a/gcc/except.c b/gcc/except.c index ad2e310..fb697a8 100644 --- a/gcc/except.c +++ b/gcc/except.c @@ -1363,7 +1363,7 @@ start_dynamic_handler () buf = plus_constant (XEXP (arg, 0), GET_MODE_SIZE (Pmode)*2); #ifdef DONT_USE_BUILTIN_SETJMP - x = emit_library_call_value (setjmp_libfunc, NULL_RTX, 1, + x = emit_library_call_value (setjmp_libfunc, NULL_RTX, LCT_CONST, TYPE_MODE (integer_type_node), 1, buf, Pmode); /* If we come back here for a catch, transfer control to the handler. */ @@ -1761,7 +1761,8 @@ start_catch_handler (rtime) /* Now issue the call, and branch around handler if needed */ call_rtx = emit_library_call_value (eh_rtime_match_libfunc, NULL_RTX, - 0, TYPE_MODE (integer_type_node), + LCT_NORMAL, + TYPE_MODE (integer_type_node), 1, rtime_address, Pmode); /* Did the function return true? */ diff --git a/gcc/expr.c b/gcc/expr.c index bf2697a..39199cc 100644 --- a/gcc/expr.c +++ b/gcc/expr.c @@ -812,7 +812,7 @@ convert_move (to, from, unsignedp) abort (); start_sequence (); - value = emit_library_call_value (libcall, NULL_RTX, 1, to_mode, + value = emit_library_call_value (libcall, NULL_RTX, LCT_CONST, to_mode, 1, from, from_mode); insns = get_insns (); end_sequence (); @@ -1785,7 +1785,7 @@ emit_block_move (x, y, size, align) retval = expand_expr (call_expr, NULL_RTX, VOIDmode, 0); #else - emit_library_call (bcopy_libfunc, 0, + emit_library_call (bcopy_libfunc, LCT_NORMAL, VOIDmode, 3, y, Pmode, x, Pmode, convert_to_mode (TYPE_MODE (integer_type_node), size, TREE_UNSIGNED (integer_type_node)), @@ -2556,7 +2556,7 @@ clear_storage (object, size, align) retval = expand_expr (call_expr, NULL_RTX, VOIDmode, 0); #else - emit_library_call (bzero_libfunc, 0, + emit_library_call (bzero_libfunc, LCT_NORMAL, VOIDmode, 2, object, Pmode, size, TYPE_MODE (integer_type_node)); #endif @@ -3060,15 +3060,15 @@ emit_push_insn (x, mode, type, size, align, partial, reg, extra, in_check_memory_usage = 1; temp = get_push_address (INTVAL (size) - used); if (GET_CODE (x) == MEM && type && AGGREGATE_TYPE_P (type)) - emit_library_call (chkr_copy_bitmap_libfunc, 1, VOIDmode, 3, - temp, Pmode, - XEXP (xinner, 0), Pmode, + emit_library_call (chkr_copy_bitmap_libfunc, + LCT_CONST_MAKE_BLOCK, VOIDmode, 3, temp, + Pmode, XEXP (xinner, 0), Pmode, GEN_INT (INTVAL (size) - used), TYPE_MODE (sizetype)); else - emit_library_call (chkr_set_right_libfunc, 1, VOIDmode, 3, - temp, Pmode, - GEN_INT (INTVAL (size) - used), + emit_library_call (chkr_set_right_libfunc, + LCT_CONST_MAKE_BLOCK, VOIDmode, 3, temp, + Pmode, GEN_INT (INTVAL (size) - used), TYPE_MODE (sizetype), GEN_INT (MEMORY_USE_RW), TYPE_MODE (integer_type_node)); @@ -3117,12 +3117,14 @@ emit_push_insn (x, mode, type, size, align, partial, reg, extra, in_check_memory_usage = 1; target = copy_to_reg (temp); if (GET_CODE (x) == MEM && type && AGGREGATE_TYPE_P (type)) - emit_library_call (chkr_copy_bitmap_libfunc, 1, VOIDmode, 3, + emit_library_call (chkr_copy_bitmap_libfunc, + LCT_CONST_MAKE_BLOCK, VOIDmode, 3, target, Pmode, XEXP (xinner, 0), Pmode, size, TYPE_MODE (sizetype)); else - emit_library_call (chkr_set_right_libfunc, 1, VOIDmode, 3, + emit_library_call (chkr_set_right_libfunc, + LCT_CONST_MAKE_BLOCK, VOIDmode, 3, target, Pmode, size, TYPE_MODE (sizetype), GEN_INT (MEMORY_USE_RW), @@ -3209,13 +3211,13 @@ emit_push_insn (x, mode, type, size, align, partial, reg, extra, to force it to pop the bcopy-arguments right away. */ NO_DEFER_POP; #ifdef TARGET_MEM_FUNCTIONS - emit_library_call (memcpy_libfunc, 0, + emit_library_call (memcpy_libfunc, LCT_NORMAL, VOIDmode, 3, temp, Pmode, XEXP (xinner, 0), Pmode, convert_to_mode (TYPE_MODE (sizetype), size, TREE_UNSIGNED (sizetype)), TYPE_MODE (sizetype)); #else - emit_library_call (bcopy_libfunc, 0, + emit_library_call (bcopy_libfunc, LCT_NORMAL, VOIDmode, 3, XEXP (xinner, 0), Pmode, temp, Pmode, convert_to_mode (TYPE_MODE (integer_type_node), size, @@ -3339,15 +3341,15 @@ emit_push_insn (x, mode, type, size, align, partial, reg, extra, target = get_push_address (GET_MODE_SIZE (mode)); if (GET_CODE (x) == MEM && type && AGGREGATE_TYPE_P (type)) - emit_library_call (chkr_copy_bitmap_libfunc, 1, VOIDmode, 3, - target, Pmode, - XEXP (x, 0), Pmode, + emit_library_call (chkr_copy_bitmap_libfunc, + LCT_CONST_MAKE_BLOCK, VOIDmode, 3, target, + Pmode, XEXP (x, 0), Pmode, GEN_INT (GET_MODE_SIZE (mode)), TYPE_MODE (sizetype)); else - emit_library_call (chkr_set_right_libfunc, 1, VOIDmode, 3, - target, Pmode, - GEN_INT (GET_MODE_SIZE (mode)), + emit_library_call (chkr_set_right_libfunc, + LCT_CONST_MAKE_BLOCK, VOIDmode, 3, target, + Pmode, GEN_INT (GET_MODE_SIZE (mode)), TYPE_MODE (sizetype), GEN_INT (MEMORY_USE_RW), TYPE_MODE (integer_type_node)); @@ -3548,8 +3550,8 @@ expand_assignment (to, from, want_value, suggest_reg) /* Check the access right of the pointer. */ in_check_memory_usage = 1; if (size) - emit_library_call (chkr_check_addr_libfunc, 1, VOIDmode, 3, - to_addr, Pmode, + emit_library_call (chkr_check_addr_libfunc, LCT_CONST_MAKE_BLOCK, + VOIDmode, 3, to_addr, Pmode, GEN_INT (size), TYPE_MODE (sizetype), GEN_INT (MEMORY_USE_WO), TYPE_MODE (integer_type_node)); @@ -3692,22 +3694,22 @@ expand_assignment (to, from, want_value, suggest_reg) /* Copy the rights of the bitmap. */ if (current_function_check_memory_usage) - emit_library_call (chkr_copy_bitmap_libfunc, 1, VOIDmode, 3, - XEXP (to_rtx, 0), Pmode, + emit_library_call (chkr_copy_bitmap_libfunc, LCT_CONST_MAKE_BLOCK, + VOIDmode, 3, XEXP (to_rtx, 0), Pmode, XEXP (from_rtx, 0), Pmode, convert_to_mode (TYPE_MODE (sizetype), size, TREE_UNSIGNED (sizetype)), TYPE_MODE (sizetype)); #ifdef TARGET_MEM_FUNCTIONS - emit_library_call (memcpy_libfunc, 0, + emit_library_call (memcpy_libfunc, LCT_NORMAL, VOIDmode, 3, XEXP (to_rtx, 0), Pmode, XEXP (from_rtx, 0), Pmode, convert_to_mode (TYPE_MODE (sizetype), size, TREE_UNSIGNED (sizetype)), TYPE_MODE (sizetype)); #else - emit_library_call (bcopy_libfunc, 0, + emit_library_call (bcopy_libfunc, LCT_NORMAL, VOIDmode, 3, XEXP (from_rtx, 0), Pmode, XEXP (to_rtx, 0), Pmode, convert_to_mode (TYPE_MODE (integer_type_node), @@ -3932,13 +3934,13 @@ store_expr (exp, target, want_value) { in_check_memory_usage = 1; if (GET_CODE (temp) == MEM) - emit_library_call (chkr_copy_bitmap_libfunc, 1, VOIDmode, 3, - XEXP (target, 0), Pmode, + emit_library_call (chkr_copy_bitmap_libfunc, LCT_CONST_MAKE_BLOCK, + VOIDmode, 3, XEXP (target, 0), Pmode, XEXP (temp, 0), Pmode, expr_size (exp), TYPE_MODE (sizetype)); else - emit_library_call (chkr_check_addr_libfunc, 1, VOIDmode, 3, - XEXP (target, 0), Pmode, + emit_library_call (chkr_check_addr_libfunc, LCT_CONST_MAKE_BLOCK, + VOIDmode, 3, XEXP (target, 0), Pmode, expr_size (exp), TYPE_MODE (sizetype), GEN_INT (MEMORY_USE_WO), TYPE_MODE (integer_type_node)); @@ -4052,7 +4054,8 @@ store_expr (exp, target, want_value) /* Be sure we can write on ADDR. */ in_check_memory_usage = 1; if (current_function_check_memory_usage) - emit_library_call (chkr_check_addr_libfunc, 1, VOIDmode, 3, + emit_library_call (chkr_check_addr_libfunc, + LCT_CONST_MAKE_BLOCK, VOIDmode, 3, addr, Pmode, size, TYPE_MODE (sizetype), GEN_INT (MEMORY_USE_WO), @@ -4795,7 +4798,7 @@ store_constructor (exp, target, align, cleared, size) && (startb = TREE_INT_CST_LOW (startbit)) % BITS_PER_UNIT == 0 && (endb = TREE_INT_CST_LOW (endbit) + 1) % BITS_PER_UNIT == 0) { - emit_library_call (memset_libfunc, 0, + emit_library_call (memset_libfunc, LCT_NORMAL, VOIDmode, 3, plus_constant (XEXP (targetx, 0), startb / BITS_PER_UNIT), @@ -4807,8 +4810,8 @@ store_constructor (exp, target, align, cleared, size) else #endif emit_library_call (gen_rtx_SYMBOL_REF (Pmode, "__setbits"), - 0, VOIDmode, 4, XEXP (targetx, 0), Pmode, - bitlength_rtx, TYPE_MODE (sizetype), + LCT_NORMAL, VOIDmode, 4, XEXP (targetx, 0), + Pmode, bitlength_rtx, TYPE_MODE (sizetype), startbit_rtx, TYPE_MODE (sizetype), endbit_rtx, TYPE_MODE (sizetype)); @@ -6006,7 +6009,8 @@ expand_expr (exp, target, tmode, modifier) in_check_memory_usage = 1; if (memory_usage != MEMORY_USE_DONT) - emit_library_call (chkr_check_addr_libfunc, 1, VOIDmode, 3, + emit_library_call (chkr_check_addr_libfunc, + LCT_CONST_MAKE_BLOCK, VOIDmode, 3, XEXP (DECL_RTL (exp), 0), Pmode, GEN_INT (int_size_in_bytes (type)), TYPE_MODE (sizetype), @@ -6524,9 +6528,9 @@ expand_expr (exp, target, tmode, modifier) if (memory_usage != MEMORY_USE_DONT) { in_check_memory_usage = 1; - emit_library_call (chkr_check_addr_libfunc, 1, VOIDmode, 3, - op0, Pmode, - GEN_INT (int_size_in_bytes (type)), + emit_library_call (chkr_check_addr_libfunc, + LCT_CONST_MAKE_BLOCK, VOIDmode, 3, op0, + Pmode, GEN_INT (int_size_in_bytes (type)), TYPE_MODE (sizetype), GEN_INT (memory_usage), TYPE_MODE (integer_type_node)); @@ -6837,9 +6841,9 @@ expand_expr (exp, target, tmode, modifier) /* Check the access right of the pointer. */ in_check_memory_usage = 1; if (size > BITS_PER_UNIT) - emit_library_call (chkr_check_addr_libfunc, 1, VOIDmode, 3, - to, Pmode, - GEN_INT (size / BITS_PER_UNIT), + emit_library_call (chkr_check_addr_libfunc, + LCT_CONST_MAKE_BLOCK, VOIDmode, 3, to, + Pmode, GEN_INT (size / BITS_PER_UNIT), TYPE_MODE (sizetype), GEN_INT (memory_usage), TYPE_MODE (integer_type_node)); @@ -8805,7 +8809,8 @@ expand_expr_unaligned (exp, palign) /* Check the access right of the pointer. */ in_check_memory_usage = 1; if (size > BITS_PER_UNIT) - emit_library_call (chkr_check_addr_libfunc, 1, VOIDmode, 3, + emit_library_call (chkr_check_addr_libfunc, + LCT_CONST_MAKE_BLOCK, VOIDmode, 3, to, ptr_mode, GEN_INT (size / BITS_PER_UNIT), TYPE_MODE (sizetype), GEN_INT (MEMORY_USE_RO), diff --git a/gcc/expr.h b/gcc/expr.h index 596b68a..ffa7d86 100644 --- a/gcc/expr.h +++ b/gcc/expr.h @@ -1017,11 +1017,6 @@ extern void emit_push_insn PARAMS ((rtx, enum machine_mode, tree, rtx, unsigned int, int, rtx, int, rtx, rtx, int, rtx)); -/* Emit library call. */ -extern void emit_library_call PARAMS ((rtx, int, enum machine_mode, int, ...)); -extern rtx emit_library_call_value PARAMS ((rtx, rtx, int, enum machine_mode, - int, ...)); - /* Expand an assignment that stores the value of FROM into TO. */ extern rtx expand_assignment PARAMS ((tree, tree, int, int)); diff --git a/gcc/function.c b/gcc/function.c index 4141c41..6a9bdc9 100644 --- a/gcc/function.c +++ b/gcc/function.c @@ -1453,8 +1453,8 @@ put_var_into_stack (decl) return; if (current_function_check_memory_usage) - emit_library_call (chkr_set_right_libfunc, 1, VOIDmode, 3, - XEXP (reg, 0), Pmode, + emit_library_call (chkr_set_right_libfunc, LCT_CONST_MAKE_BLOCK, VOIDmode, + 3, XEXP (reg, 0), Pmode, GEN_INT (GET_MODE_SIZE (GET_MODE (reg))), TYPE_MODE (sizetype), GEN_INT (MEMORY_USE_RW), @@ -4684,7 +4684,8 @@ assign_parms (fndecl) store_expr (parm, copy, 0); emit_move_insn (parmreg, XEXP (copy, 0)); if (current_function_check_memory_usage) - emit_library_call (chkr_set_right_libfunc, 1, VOIDmode, 3, + emit_library_call (chkr_set_right_libfunc, + LCT_CONST_MAKE_BLOCK, VOIDmode, 3, XEXP (copy, 0), Pmode, GEN_INT (int_size_in_bytes (type)), TYPE_MODE (sizetype), @@ -4848,8 +4849,8 @@ assign_parms (fndecl) if (current_function_check_memory_usage) { push_to_sequence (conversion_insns); - emit_library_call (chkr_set_right_libfunc, 1, VOIDmode, 3, - XEXP (stack_parm, 0), Pmode, + emit_library_call (chkr_set_right_libfunc, LCT_CONST_MAKE_BLOCK, + VOIDmode, 3, XEXP (stack_parm, 0), Pmode, GEN_INT (GET_MODE_SIZE (GET_MODE (entry_parm))), TYPE_MODE (sizetype), diff --git a/gcc/optabs.c b/gcc/optabs.c index f688ca1..8468fbe 100644 --- a/gcc/optabs.c +++ b/gcc/optabs.c @@ -1692,7 +1692,7 @@ expand_binop (mode, binoptab, op0, op1, target, unsignedp, methods) /* Pass 1 for NO_QUEUE so we don't lose any increments if the libcall is cse'd or moved. */ value = emit_library_call_value (binoptab->handlers[(int) mode].libfunc, - NULL_RTX, 1, mode, 2, + NULL_RTX, LCT_CONST, mode, 2, op0, mode, op1x, op1_mode); insns = get_insns (); @@ -2175,7 +2175,7 @@ expand_unop (mode, unoptab, op0, target, unsignedp) /* Pass 1 for NO_QUEUE so we don't lose any increments if the libcall is cse'd or moved. */ value = emit_library_call_value (unoptab->handlers[(int) mode].libfunc, - NULL_RTX, 1, mode, 1, op0, mode); + NULL_RTX, LCT_CONST, mode, 1, op0, mode); insns = get_insns (); end_sequence (); @@ -2493,7 +2493,7 @@ expand_complex_abs (mode, op0, target, unsignedp) /* Pass 1 for NO_QUEUE so we don't lose any increments if the libcall is cse'd or moved. */ value = emit_library_call_value (abs_optab->handlers[(int) mode].libfunc, - NULL_RTX, 1, submode, 1, op0, mode); + NULL_RTX, LCT_CONST, submode, 1, op0, mode); insns = get_insns (); end_sequence (); @@ -3033,14 +3033,14 @@ prepare_cmp_insn (px, py, pcomparison, size, pmode, punsignedp, align, #endif { #ifdef TARGET_MEM_FUNCTIONS - emit_library_call (memcmp_libfunc, 2, + emit_library_call (memcmp_libfunc, LCT_PURE_MAKE_BLOCK, TYPE_MODE (integer_type_node), 3, XEXP (x, 0), Pmode, XEXP (y, 0), Pmode, convert_to_mode (TYPE_MODE (sizetype), size, TREE_UNSIGNED (sizetype)), TYPE_MODE (sizetype)); #else - emit_library_call (bcmp_libfunc, 2, + emit_library_call (bcmp_libfunc, LCT_PURE_MAKE_BLOCK, TYPE_MODE (integer_type_node), 3, XEXP (x, 0), Pmode, XEXP (y, 0), Pmode, convert_to_mode (TYPE_MODE (integer_type_node), @@ -3487,7 +3487,8 @@ prepare_float_lib_cmp (px, py, pcomparison, pmode, punsignedp) if (libfunc == 0) abort (); - emit_library_call (libfunc, 1, word_mode, 2, x, mode, y, mode); + emit_library_call (libfunc, LCT_CONST_MAKE_BLOCK, word_mode, 2, x, mode, y, + mode); /* Immediately move the result of the libcall into a pseudo register so reload doesn't clobber the value if it needs @@ -4111,9 +4112,9 @@ expand_float (to, from, unsignedp) start_sequence (); - value = emit_library_call_value (libfcn, NULL_RTX, 1, - GET_MODE (to), - 1, from, GET_MODE (from)); + value = emit_library_call_value (libfcn, NULL_RTX, LCT_CONST, + GET_MODE (to), 1, from, + GET_MODE (from)); insns = get_insns (); end_sequence (); @@ -4345,9 +4346,9 @@ expand_fix (to, from, unsignedp) start_sequence (); - value = emit_library_call_value (libfcn, NULL_RTX, 1, GET_MODE (to), - - 1, from, GET_MODE (from)); + value = emit_library_call_value (libfcn, NULL_RTX, LCT_CONST, + GET_MODE (to), 1, from, + GET_MODE (from)); insns = get_insns (); end_sequence (); diff --git a/gcc/rtl.h b/gcc/rtl.h index d1d7696..a866595 100644 --- a/gcc/rtl.h +++ b/gcc/rtl.h @@ -1913,11 +1913,21 @@ extern void rrotate_double PARAMS ((unsigned HOST_WIDE_INT, HOST_WIDE_INT, HOST_WIDE_INT *)); /* In calls.c */ -extern void emit_library_call PARAMS ((rtx, int, enum machine_mode, - int, ...)); -extern rtx emit_library_call_value PARAMS ((rtx, rtx, int, - enum machine_mode, - int, ...)); +enum libcall_type +{ + LCT_NORMAL = 0, + LCT_CONST = 1, + LCT_PURE = 2, + LCT_CONST_MAKE_BLOCK = 3, + LCT_PURE_MAKE_BLOCK = 4 +}; + +extern void emit_library_call PARAMS ((rtx, enum libcall_type, + enum machine_mode, int, + ...)); +extern rtx emit_library_call_value PARAMS ((rtx, rtx, enum libcall_type, + enum machine_mode, int, + ...)); /* In unroll.c */ extern int set_dominates_use PARAMS ((int, int, int, rtx, rtx)); diff --git a/gcc/stmt.c b/gcc/stmt.c index 25382cc..11a7132 100644 --- a/gcc/stmt.c +++ b/gcc/stmt.c @@ -713,7 +713,7 @@ expand_computed_goto (exp) emit_queue (); /* Be sure the function is executable. */ if (current_function_check_memory_usage) - emit_library_call (chkr_check_exec_libfunc, 1, + emit_library_call (chkr_check_exec_libfunc, LCT_CONST_MAKE_BLOCK, VOIDmode, 1, x, ptr_mode); do_pending_stack_adjust (); -- 2.7.4