This is the mail archive of the gcc@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]
Other format: [Raw text]

Re: GCC Eliminates my Custom RTL ..How to stop this?


Balaji V. Iyer wrote:

>     I am trying to add new RTL into the GCC 4.0.2 OpenRISC port and I am
> trying to insert them into ccertain parts of the instruction stream. For
> testing, I am trying to insert it in the start of every basic block.Here
> is the code for what I am trying to do.
>  
> rtx newInsn = gen_rtx_MY_NEW_INSN(...);
> rtx bbInsn;
>  
> FOR_EACH_BB(bb) {
>    bbInsn = BB_HEAD(bb); 
>    emit_insn_before(newInsn, bbInsn);
> }
>  
> This code is working fine when we are having no optimization. But when I
> have -O1, -O2 or -O3, the newInsn does'nt appear in every basic block.
> It looks like the optimization phases is deleting this instruction. 
>  
> My question is, how can I "tell" GCC to never remove this instruction
> (or RTL)? This instruction doesn't take any register values or write any
> registers, just accepts an immediate field.

What sort of instruction is it?  Are you using an UNSPEC to model some
special CPU hardware?  gcc will remove instructions that don't do
anything.

Have a look at side_effects_p() in rtlanal.c.

Andrew.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]