This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
tampering with the insn chain
- From: Per Fransson <per dot fransson dot 768 at student dot lu dot se>
- To: gcc <gcc at gcc dot gnu dot org>
- Date: Thu, 16 May 2002 01:38:16 +0200
- Subject: tampering with the insn chain
Hi,
I'm trying to insert calls at some places in the insn chain. I'm working
on a sparc.
Inserting *just* a call works fine, I do it like this:
> gen_rtx (PARALLEL, VOIDmode,
> gen_rtvec (2,
> gen_rtx (SET, VOIDmode,
> gen_rtx (REG, SImode,
> 0
> ),
> gen_rtx (CALL, VOIDmode,
> gen_rtx (MEM, SImode,
> gen_rtx (SYMBOL_REF, SImode,
> func_name
> ),
> 0
> ),
> gen_rtx (CONST_INT, VOIDmode,
> 0
> )
> )
> ),
> gen_rtx (CLOBBER, VOIDmode,
> gen_rtx (REG, SImode,
> 15
> )
> )
> ))
> , insn);
>
When I try to move the %o0 register to a safe place (which I hope a
pseudo register is) during the call, the RTL code looks alright when I
do a dump, but in the assembler code produced there is no trace of that
code. My RTL manipulation now looks like this:
tmp_reg_rtx = gen_reg_rtx (SImode);
new_insn = emit_insn_before (
gen_rtx (SET, VOIDmode,
tmp_reg_rtx,
gen_rtx (REG, SImode,
8
)
)
, insn);
// Construct PARALLEL rtx from rtvec and use it to put call insn in chain
new_insn = emit_insn_before (
gen_rtx (PARALLEL, VOIDmode,
gen_rtvec (2,
gen_rtx (SET, VOIDmode,
gen_rtx (REG, SImode,
0
),
gen_rtx (CALL, VOIDmode,
gen_rtx (MEM, SImode,
gen_rtx (SYMBOL_REF, SImode,
func_name
),
0
),
gen_rtx (CONST_INT, VOIDmode,
0
)
)
),
gen_rtx (CLOBBER, VOIDmode,
gen_rtx (REG, SImode,
15
)
)
))
, insn);
new_insn = emit_insn_before (
gen_rtx (SET, VOIDmode,
gen_rtx (REG, SImode,
8
),
copy_rtx (tmp_reg_rtx)
)
, insn);
Any ideas?
Thanks in advance
=0)
/Per