Commit 77a2f698 by Torbjorn Granlund

(TRAMPOLINE_TEMPLATE): Rewrite.

(TRAMPOLINE_SIZE): Update with new size.
(INITIALIZE_TRAMPOLINE): Rewrite.

From-SVN: r5838
parent bdc87462
...@@ -1000,13 +1000,19 @@ extern union tree_node *current_function_decl; ...@@ -1000,13 +1000,19 @@ extern union tree_node *current_function_decl;
flush multiple lines in the cache. */ flush multiple lines in the cache. */
#define TRAMPOLINE_TEMPLATE(FILE) \ #define TRAMPOLINE_TEMPLATE(FILE) \
{ \ { \
fprintf (FILE, "\tldw 12(0,%%r22),%%r21\n"); \ fprintf (FILE, "\tldw 36(0,%%r22),%%r21\n"); \
fprintf (FILE, "\tbe 0(4,%%r21)\n"); \ fprintf (FILE, "\tbb,>=,n %%r21,30,.+16\n"); \
fprintf (FILE, "\tldw 16(0,%%r22),%%r29\n"); \ fprintf (FILE, "\tdepi 0,31,2,%%r21\n"); \
fprintf (FILE, "\t.word 0\n"); \ fprintf (FILE, "\tldw 4(0,%%r21),%%r19\n"); \
fprintf (FILE, "\t.word 0\n"); \ fprintf (FILE, "\tldw 0(0,%%r21),%%r21\n"); \
} fprintf (FILE, "\tldsid (0,%%r21),%%r1\n"); \
fprintf (FILE, "\tmtsp %%r1,%%sr0\n"); \
fprintf (FILE, "\tbe 0(%%sr0,%%r21)\n"); \
fprintf (FILE, "\tldw 40(0,%%r22),%%r29\n"); \
fprintf (FILE, "\t.word 0\n"); \
fprintf (FILE, "\t.word 0\n"); \
}
/* Length in units of the trampoline for entering a nested function. /* Length in units of the trampoline for entering a nested function.
...@@ -1014,10 +1020,10 @@ extern union tree_node *current_function_decl; ...@@ -1014,10 +1020,10 @@ extern union tree_node *current_function_decl;
of the trampoline. This is necessary as the trampoline may cross two of the trampoline. This is necessary as the trampoline may cross two
cache lines. cache lines.
If the trampoline ever grows to > 32 bytes, then it will become If the code part of the trampoline ever grows to > 32 bytes, then it
necessary to hack on the cacheflush pattern in pa.md. */ will become necessary to hack on the cacheflush pattern in pa.md. */
#define TRAMPOLINE_SIZE (5 * 4) #define TRAMPOLINE_SIZE (11 * 4)
/* Emit RTL insns to initialize the variable parts of a trampoline. /* Emit RTL insns to initialize the variable parts of a trampoline.
FNADDR is an RTX for the address of the function's pure code. FNADDR is an RTX for the address of the function's pure code.
...@@ -1027,18 +1033,24 @@ extern union tree_node *current_function_decl; ...@@ -1027,18 +1033,24 @@ extern union tree_node *current_function_decl;
Move the static chain value to trampoline template at offset 16. */ Move the static chain value to trampoline template at offset 16. */
#define INITIALIZE_TRAMPOLINE(TRAMP, FNADDR, CXT) \ #define INITIALIZE_TRAMPOLINE(TRAMP, FNADDR, CXT) \
{ \ { \
rtx start_addr, end_addr, mem; \ rtx start_addr, end_addr, masked_start_addr; \
\ \
start_addr = memory_address (Pmode, plus_constant ((TRAMP), 12));\ start_addr = memory_address (Pmode, plus_constant ((TRAMP), 36)); \
emit_move_insn (gen_rtx (MEM, Pmode, start_addr), (FNADDR)); \ emit_move_insn (gen_rtx (MEM, Pmode, start_addr), (FNADDR)); \
start_addr = memory_address (Pmode, plus_constant ((TRAMP), 16));\ start_addr = memory_address (Pmode, plus_constant ((TRAMP), 40)); \
emit_move_insn (gen_rtx (MEM, Pmode, start_addr), (CXT)); \ emit_move_insn (gen_rtx (MEM, Pmode, start_addr), (CXT)); \
/* fdc and fic only use registers for the address to flush, \ /* fdc and fic only use registers for the address to flush, \
they do not accept integer displacements. */ \ they do not accept integer displacements. */ \
start_addr = force_reg (SImode, (TRAMP)); \ start_addr = force_reg (SImode, (TRAMP)); \
end_addr = force_reg (SImode, plus_constant ((TRAMP), 8)); \ end_addr = force_reg (SImode, plus_constant ((TRAMP), 32)); \
emit_insn (gen_cacheflush (start_addr, end_addr)); \ emit_insn (gen_dcacheflush (start_addr, end_addr)); \
masked_start_addr = gen_reg_rtx (SImode); \
emit_insn (gen_andsi3 (masked_start_addr, start_addr, \
GEN_INT (0x3fffffff))); \
end_addr = force_reg (SImode, plus_constant (masked_start_addr, 32)); \
emit_insn (gen_icacheflush (masked_start_addr, end_addr, start_addr, \
gen_reg_rtx (SImode), gen_reg_rtx (SImode)));\
} }
/* Emit code for a call to builtin_saveregs. We must emit USE insns which /* Emit code for a call to builtin_saveregs. We must emit USE insns which
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment