Revisión | 700904331bba3e9d0675f57ef011a68a7262c96e (tree) |
---|---|
Tiempo | 2022-11-23 18:25:34 |
Autor | Yoshinori Sato <yo-satoh@sios...> |
Commiter | Yoshinori Sato |
wip: rx pic
Signed-off-by: Yoshinori Sato <yo-satoh@sios.com>
@@ -470,7 +470,10 @@ | ||
470 | 470 | |
471 | 471 | if (! rx_call_operand (dest, Pmode)) |
472 | 472 | dest = force_reg (Pmode, dest); |
473 | - emit_call_insn (gen_call_value_internal (operands[0], dest)); | |
473 | + if (!flag_pic || !(GET_CODE (dest) == SYMBOL_REF && !SYMBOL_REF_LOCAL_P (dest))) | |
474 | + emit_call_insn (gen_call_value_internal (operands[0], dest)); | |
475 | + else | |
476 | + emit_call_insn (gen_call_value_pcrel (operands[0], dest)); | |
474 | 477 | DONE; |
475 | 478 | } |
476 | 479 | ) |
@@ -2998,3 +3001,25 @@ | ||
2998 | 3001 | return "mvfc\tpc,%0\n\tadd\t#_GLOBAL_OFFSET_TABLE_,%0"; |
2999 | 3002 | } |
3000 | 3003 | ) |
3004 | + | |
3005 | +(define_expand "call_value_pcrel" | |
3006 | + [(set (match_operand 0 "register_operand" "=r,r") | |
3007 | + (call (mem:QI (match_operand:SI 1 "rx_call_operand" "r,CALL_OP_SYMBOL_REF")) | |
3008 | + (const_int 0))) | |
3009 | + (clobber (reg:CC CC_REG))] | |
3010 | + "" | |
3011 | +{ | |
3012 | + rtx gotoffsym; | |
3013 | + rtx t = (!can_create_pseudo_p () | |
3014 | + ? operands[0] | |
3015 | + : gen_reg_rtx (GET_MODE (operands[0]))); | |
3016 | + | |
3017 | + rtx picreg = gen_rtx_REG (Pmode, PIC_REG); | |
3018 | + | |
3019 | + gotoffsym = gen_sym2GOTOFF (operands[1]); | |
3020 | + emit_move_insn (t, gotoffsym); | |
3021 | + emit_move_insn (operands[0], t); | |
3022 | + emit_insn(gen_mov_from_rirb(operands[0], picreg)); | |
3023 | + emit_call_insn (gen_call_internal (operands[0])); | |
3024 | + DONE; | |
3025 | +}) |