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?


Thank you for your response Andrew.

This is what I am trying to achieve. I want to indicate to my processor
at certain points of execution to do certain control behavior. I am
trying to do this by inserting a specialized instruction that will do
so. 

I am not using the unspec model. I created a new RTL in rtl.def, then I
am inserting that RTL at fixed points of my code, and have a constraint
in my .md file to catch that RTL and convert it into an instruction.

Any help is highly appreciated! 


Please CC me in your response since I am not subscribed to this account.

Thanks,

Balaji V. Iyer.


-- 
 
Balaji V. Iyer
PhD Candidate, 
Center for Efficient, Scalable and Reliable Computing,
Department of Electrical and Computer Engineering,
North Carolina State University.


-----Original Message-----
From: Andrew Haley [mailto:aph@redhat.com] 
Sent: Monday, October 27, 2008 6:07 AM
To: Balaji V. Iyer
Cc: gcc@gcc.gnu.org
Subject: 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]