This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Hi The real busywork on function calling is comming separately. This patch just updates the call patterns and expanders to wrok. In x86_64 ABI we use hidden AL register to pass number of SSE registers used to va_arg functions so the expanders are now prepared for that. Function_arg is updated to pass -1 to avoid such usage on i386. Honza Thu Apr 5 17:23:22 CEST 2001 Jan Hubicka <jh@suse.cz> * i386.c (function_arg): Return constm1_rtx for last argument. (ix86_expand_prologue): Update gen_call calls. * i386.h (FUNCTION_BLOCK_PROFILER_EXIT): Likewise. * i386.md (call_pop): Likewise. (call): Second operand is VOIDmode. (call_0): Likewise; Support 64bits. (call_exp): New expander. (call_1): Get to the sync. (call_1_exp): New pattern. (call_value): Support 64bit. (call_value_exp): New pattern. (untyped_call): Update gen_call call. (call_value_pop): Disable for 64bit. (call_value_0_rex64): New pattern. (call_value_1_rex64): Likewise. Index: i386.c =================================================================== RCS file: /cvs/gcc/egcs/gcc/config/i386/i386.c,v retrieving revision 1.247 diff -c -3 -p -r1.247 i386.c *** i386.c 2001/04/03 17:44:45 1.247 --- i386.c 2001/04/05 15:41:07 *************** function_arg (cum, mode, type, named) *** 1105,1110 **** --- 1105,1113 ---- (mode == BLKmode) ? int_size_in_bytes (type) : (int) GET_MODE_SIZE (mode); int words = (bytes + UNITS_PER_WORD - 1) / UNITS_PER_WORD; + if (mode == VOIDmode) + return constm1_rtx; + switch (mode) { /* For now, pass fp/complex values on the stack. */ *************** ix86_expand_prologue () *** 2510,2516 **** sym = gen_rtx_MEM (FUNCTION_MODE, gen_rtx_SYMBOL_REF (Pmode, "_alloca")); ! insn = emit_call_insn (gen_call (sym, const0_rtx)); CALL_INSN_FUNCTION_USAGE (insn) = gen_rtx_EXPR_LIST (VOIDmode, gen_rtx_USE (VOIDmode, arg0), --- 2513,2519 ---- sym = gen_rtx_MEM (FUNCTION_MODE, gen_rtx_SYMBOL_REF (Pmode, "_alloca")); ! insn = emit_call_insn (gen_call (sym, const0_rtx, constm1_rtx)); CALL_INSN_FUNCTION_USAGE (insn) = gen_rtx_EXPR_LIST (VOIDmode, gen_rtx_USE (VOIDmode, arg0), *************** ix86_split_to_parts (operand, parts, mod *** 6842,6848 **** operand = change_address (operand, DImode, XEXP (operand, 0)); parts[0] = operand; parts[1] = adj_offsettable_operand (operand, 8); ! parts[1] = change_address (parts[1], SImode, XEXP (operand, 0)); } else if (GET_CODE (operand) == CONST_DOUBLE) { --- 6845,6851 ---- operand = change_address (operand, DImode, XEXP (operand, 0)); parts[0] = operand; parts[1] = adj_offsettable_operand (operand, 8); ! parts[1] = change_address (parts[1], SImode, XEXP (parts[1], 0)); } else if (GET_CODE (operand) == CONST_DOUBLE) { Index: i386.h =================================================================== RCS file: /cvs/gcc/egcs/gcc/config/i386/i386.h,v retrieving revision 1.173 diff -c -3 -p -r1.173 i386.h *** i386.h 2001/03/28 11:14:39 1.173 --- i386.h 2001/04/05 15:41:09 *************** typedef struct ix86_args { *** 1632,1638 **** #define FUNCTION_BLOCK_PROFILER_EXIT \ emit_call_insn (gen_call (gen_rtx_MEM (QImode, \ gen_rtx_SYMBOL_REF (VOIDmode, "__bb_trace_ret")), \ ! const0_rtx)) /* The function `__bb_trace_func' is called in every basic block and is not allowed to change the machine state. Saving (restoring) --- 1632,1638 ---- #define FUNCTION_BLOCK_PROFILER_EXIT \ emit_call_insn (gen_call (gen_rtx_MEM (QImode, \ gen_rtx_SYMBOL_REF (VOIDmode, "__bb_trace_ret")), \ ! const0_rtx, constm1_rtx)) /* The function `__bb_trace_func' is called in every basic block and is not allowed to change the machine state. Saving (restoring) Index: i386.md =================================================================== RCS file: /cvs/gcc/egcs/gcc/config/i386/i386.md,v retrieving revision 1.254 diff -c -3 -p -r1.254 i386.md *** i386.md 2001/04/05 12:51:42 1.254 --- i386.md 2001/04/05 15:41:16 *************** *** 12716,12722 **** { if (operands[3] == const0_rtx) { ! emit_insn (gen_call (operands[0], operands[1])); DONE; } /* Static functions and indirect calls don't need --- 12716,12722 ---- { if (operands[3] == const0_rtx) { ! emit_insn (gen_call (operands[0], operands[1], constm1_rtx)); DONE; } /* Static functions and indirect calls don't need *************** *** 12770,12776 **** (define_expand "call" [(call (match_operand:QI 0 "" "") ! (match_operand:SI 1 "" ""))] ;; Operand 1 not used on the i386. "" " --- 12770,12776 ---- (define_expand "call" [(call (match_operand:QI 0 "" "") ! (match_operand 2 "" ""))] ;; Operand 1 not used on the i386. "" " *************** *** 12781,12793 **** && GET_CODE (XEXP (operands[0], 0)) == SYMBOL_REF && ! SYMBOL_REF_FLAG (XEXP (operands[0], 0))) current_function_uses_pic_offset_table = 1; if (! call_insn_operand (XEXP (operands[0], 0), Pmode)) XEXP (operands[0], 0) = copy_to_mode_reg (Pmode, XEXP (operands[0], 0)); }") (define_insn "*call_0" ! [(call (mem:QI (match_operand:SI 0 "constant_call_address_operand" "")) ! (match_operand:SI 1 "" ""))] "" "* { --- 12781,12809 ---- && GET_CODE (XEXP (operands[0], 0)) == SYMBOL_REF && ! SYMBOL_REF_FLAG (XEXP (operands[0], 0))) current_function_uses_pic_offset_table = 1; + if (! call_insn_operand (XEXP (operands[0], 0), Pmode)) XEXP (operands[0], 0) = copy_to_mode_reg (Pmode, XEXP (operands[0], 0)); + if (TARGET_64BIT && INTVAL (operands[2]) >= 0) + { + rtx insn; + rtx reg = gen_rtx_REG (QImode, 0); + emit_move_insn (reg, operands[2]); + insn = emit_call_insn (gen_call_exp (operands[0], operands[2])); + use_reg (&CALL_INSN_FUNCTION_USAGE (insn), reg); + DONE; + } }") + (define_expand "call_exp" + [(call (match_operand:QI 0 "" "") + (match_operand 1 "" ""))] + "" + "") + (define_insn "*call_0" ! [(call (mem:QI (match_operand 0 "constant_call_address_operand" "")) ! (match_operand 1 "" ""))] "" "* { *************** *** 12800,12807 **** (define_insn "*call_1" [(call (mem:QI (match_operand:SI 0 "call_insn_operand" "rsm")) ! (match_operand:SI 1 "" ""))] ! "" "* { if (constant_call_address_operand (operands[0], QImode)) --- 12816,12843 ---- (define_insn "*call_1" [(call (mem:QI (match_operand:SI 0 "call_insn_operand" "rsm")) ! (match_operand 1 "" ""))] ! "!TARGET_64BIT" ! "* ! { ! if (constant_call_address_operand (operands[0], QImode)) ! { ! if (SIBLING_CALL_P (insn)) ! return \"jmp\\t%P0\"; ! else ! return \"call\\t%P0\"; ! } ! if (SIBLING_CALL_P (insn)) ! return \"jmp\\t%A0\"; ! else ! return \"call\\t%A0\"; ! }" ! [(set_attr "type" "call")]) ! ! (define_insn "*call_1_rex64" ! [(call (mem:QI (match_operand:DI 0 "call_insn_operand" "rsm")) ! (match_operand 1 "" ""))] ! "TARGET_64BIT" "* { if (constant_call_address_operand (operands[0], QImode)) *************** *** 12833,12839 **** { if (operands[4] == const0_rtx) { ! emit_insn (gen_call_value (operands[0], operands[1], operands[2])); DONE; } /* Static functions and indirect calls don't need --- 12869,12876 ---- { if (operands[4] == const0_rtx) { ! emit_insn (gen_call_value (operands[0], operands[1], operands[2], ! constm1_rtx)); DONE; } /* Static functions and indirect calls don't need *************** *** 12849,12855 **** (define_expand "call_value" [(set (match_operand 0 "" "") (call (match_operand:QI 1 "" "") ! (match_operand:SI 2 "" "")))] ;; Operand 2 not used on the i386. "" " --- 12886,12892 ---- (define_expand "call_value" [(set (match_operand 0 "" "") (call (match_operand:QI 1 "" "") ! (match_operand:SI 3 "" "")))] ;; Operand 2 not used on the i386. "" " *************** *** 12862,12869 **** --- 12899,12923 ---- current_function_uses_pic_offset_table = 1; if (! call_insn_operand (XEXP (operands[1], 0), Pmode)) XEXP (operands[1], 0) = copy_to_mode_reg (Pmode, XEXP (operands[1], 0)); + if (TARGET_64BIT && INTVAL (operands[3]) >= 0) + { + rtx insn; + rtx reg = gen_rtx_REG (QImode, 0); + emit_move_insn (reg, operands[3]); + insn = emit_call_insn (gen_call_value_exp (operands[0], operands[1], + operands[3])); + use_reg (&CALL_INSN_FUNCTION_USAGE (insn), reg); + DONE; + } }") + (define_expand "call_value_exp" + [(set (match_operand 0 "" "") + (call (match_operand:QI 1 "" "") + (match_operand:SI 2 "" "")))] + "" + "") + ;; Call subroutine returning any type. (define_expand "untyped_call" *************** *** 12883,12890 **** emit_call_insn (TARGET_80387 ? gen_call_value (gen_rtx_REG (XCmode, FIRST_FLOAT_REG), ! operands[0], const0_rtx) ! : gen_call (operands[0], const0_rtx)); for (i = 0; i < XVECLEN (operands[2], 0); i++) { --- 12937,12946 ---- emit_call_insn (TARGET_80387 ? gen_call_value (gen_rtx_REG (XCmode, FIRST_FLOAT_REG), ! operands[0], const0_rtx, ! GEN_INT (SSE_REGPARM_MAX - 1)) ! : gen_call (operands[0], const0_rtx, ! GEN_INT (SSE_REGPARM_MAX - 1))); for (i = 0; i < XVECLEN (operands[2], 0); i++) { *************** *** 12975,12981 **** (plus:SI (match_operand:SI 1 "symbolic_operand" "") (minus:SI (pc) (match_operand 2 "" ""))))] 1)) (clobber (reg:CC 17))] ! "" "* { if (GET_CODE (operands[2]) == LABEL_REF) --- 13031,13037 ---- (plus:SI (match_operand:SI 1 "symbolic_operand" "") (minus:SI (pc) (match_operand 2 "" ""))))] 1)) (clobber (reg:CC 17))] ! "!TARGET_64BIT" "* { if (GET_CODE (operands[2]) == LABEL_REF) *************** *** 16751,16757 **** [(set (match_operand 0 "" "") (call (mem:QI (match_operand:SI 1 "constant_call_address_operand" "")) (match_operand:SI 2 "" "")))] ! "" "* { if (SIBLING_CALL_P (insn)) --- 16807,16827 ---- [(set (match_operand 0 "" "") (call (mem:QI (match_operand:SI 1 "constant_call_address_operand" "")) (match_operand:SI 2 "" "")))] ! "!TARGET_64BIT" ! "* ! { ! if (SIBLING_CALL_P (insn)) ! return \"jmp\\t%P1\"; ! else ! return \"call\\t%P1\"; ! }" ! [(set_attr "type" "callv")]) ! ! (define_insn "*call_value_0_rex64" ! [(set (match_operand 0 "" "") ! (call (mem:QI (match_operand:DI 1 "constant_call_address_operand" "")) ! (match_operand:DI 2 "const_int_operand" "")))] ! "TARGET_64BIT" "* { if (SIBLING_CALL_P (insn)) *************** *** 16765,16771 **** [(set (match_operand 0 "" "") (call (mem:QI (match_operand:SI 1 "call_insn_operand" "rsm")) (match_operand:SI 2 "" "")))] ! "" "* { if (constant_call_address_operand (operands[1], QImode)) --- 16835,16862 ---- [(set (match_operand 0 "" "") (call (mem:QI (match_operand:SI 1 "call_insn_operand" "rsm")) (match_operand:SI 2 "" "")))] ! "!TARGET_64BIT" ! "* ! { ! if (constant_call_address_operand (operands[1], QImode)) ! { ! if (SIBLING_CALL_P (insn)) ! return \"jmp\\t%P1\"; ! else ! return \"call\\t%P1\"; ! } ! if (SIBLING_CALL_P (insn)) ! return \"jmp\\t%*%1\"; ! else ! return \"call\\t%*%1\"; ! }" ! [(set_attr "type" "callv")]) ! ! (define_insn "*call_value_1_rex64" ! [(set (match_operand 0 "" "") ! (call (mem:QI (match_operand:DI 1 "call_insn_operand" "rsm")) ! (match_operand:DI 2 "" "")))] ! "TARGET_64BIT" "* { if (constant_call_address_operand (operands[1], QImode))
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |