Skip to content

Commit 8703ee8

Browse files
clazissartemiy-volkov
authored andcommitted
Improve trampoline
1 parent 69bee20 commit 8703ee8

File tree

2 files changed

+9
-10
lines changed

2 files changed

+9
-10
lines changed

gcc/config/arc64/arc64.c

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1088,9 +1088,9 @@ arc64_legitimize_address_1 (rtx x, rtx scratch)
10881088
a trampoline, leaving space for variable parts. A trampoline looks
10891089
like this:
10901090
1091-
ldl r12,[pcl,10]
1092-
ldl r11,[pcl,18]
1093-
j_s [r12]
1091+
ldl r12,[pcl,12]
1092+
ldl r11,[pcl,16]
1093+
j [r12]
10941094
.xword function's address
10951095
.xword static chain value
10961096
@@ -1099,9 +1099,9 @@ arc64_legitimize_address_1 (rtx x, rtx scratch)
10991099
static void
11001100
arc64_asm_trampoline_template (FILE *f)
11011101
{
1102-
asm_fprintf (f, "\tldl\t%s,[pcl,8]\n", reg_names[12]);
1103-
asm_fprintf (f, "\tldl\t%s,[pcl,12]\n", reg_names[STATIC_CHAIN_REGNUM]);
1104-
asm_fprintf (f, "\tj_s\t[%s]\n", reg_names[12]);
1102+
asm_fprintf (f, "\tldl\t%s,[pcl,12]\n", reg_names[12]);
1103+
asm_fprintf (f, "\tldl\t%s,[pcl,16]\n", reg_names[STATIC_CHAIN_REGNUM]);
1104+
asm_fprintf (f, "\tj\t[%s]\n", reg_names[12]);
11051105
assemble_aligned_integer (POINTER_BYTES, const0_rtx);
11061106
assemble_aligned_integer (POINTER_BYTES, const0_rtx);
11071107
}
@@ -1115,15 +1115,14 @@ arc64_initialize_trampoline (rtx tramp, tree fndecl, rtx cxt)
11151115

11161116
emit_block_move (tramp, assemble_trampoline_template (),
11171117
GEN_INT (TRAMPOLINE_SIZE), BLOCK_OP_NORMAL);
1118-
emit_move_insn (adjust_address (tramp, Pmode, 8), fnaddr);
1119-
emit_move_insn (adjust_address (tramp, Pmode, 12), cxt);
1118+
emit_move_insn (adjust_address (tramp, Pmode, 12), fnaddr);
1119+
emit_move_insn (adjust_address (tramp, Pmode, 20), cxt);
11201120
emit_library_call (gen_rtx_SYMBOL_REF (Pmode, "__clear_cache"),
11211121
LCT_NORMAL, VOIDmode, XEXP (tramp, 0), Pmode,
11221122
plus_constant (Pmode, XEXP (tramp, 0), TRAMPOLINE_SIZE),
11231123
Pmode);
11241124
}
11251125

1126-
11271126
/* Implement FUNCTION_OK_FOR_SIBCALL hook. */
11281127

11291128
static bool

gcc/config/arc64/arc64.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,7 @@ extern const enum reg_class arc64_regno_to_regclass[];
399399

400400
/* Length in units of the trampoline for entering a nested function: 3
401401
insns + 2 pointer-sized entries. */
402-
#define TRAMPOLINE_SIZE 26
402+
#define TRAMPOLINE_SIZE (12+16)
403403

404404
/* Alignment required for a trampoline in bits . */
405405
#define TRAMPOLINE_ALIGNMENT 64

0 commit comments

Comments
 (0)