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: Help modifying an existing port.


kernel_learner wrote:
For a certain project I want to modify the compiler
for this architecture so that it generates code which
always contains two independent instructions next to
each other. If the compiler does not find independent
instructions it should insert a no-op instead.

Gcc doesn't have any easy way to do this. Usually, it is done in the TARGET_MACHINE_DEPENDENT_REORG hook, which is an optional machine dependent optimization pass at the end. You can write your own code to look for insns that aren't paired, and insert the necessary nops. Try looking at existing ones for ideas.


1. Creating a new rtx for a NOP instruction

Put a pattern called "nop" in the md file, and then call gen_nop().


2. How do I add this new NOP instruction into the
existing RTX list.

emit_insn (gen_nop()) will emit it at the current place.


emit_insn_before (gen_nop (), x) will emit it before insn X.

Any help would be really appreciated.. I would also
like comments on whether my approach of modifying the
function schedule_block() is right or not

There are other optimization passes that occur after sched, and they likely won't preserve the instruction pairs that you create in the scheduler. This probably only works if you do it at the very end, which takes you back to TARGET_MACHINE_DEPENDENT_REORG hook.
--
Jim Wilson, GNU Tools Support, http://www.SpecifixInc.com



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