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: specifying insn costs from attributes


On 10/11/07, Tomas Svensson <idulus@gmail.com> wrote:
> In the .md-file of my port, I have set an attribute "size" of every
> insn, giving its size (obviously), in bytes. Is there any way I can use the
> value of this attribute to determine the cost (in e.g. TARGET_RTX_COSTS)
> when optimizing for size? Or is there some other smart way of achieving
> the same thing? Is it better to use the "length" attribute for this?
>


At the time of rtx_costs you have no way of estimating which exact
instruction is going to get generated / matched with the backend. So
in TARGET_RTX_COSTS you estimate the number of instructions or the
size of each instruction. Look at how these are defined in other
backends.

It is also important that you set up the length attribute correctly so
that you can use that for other features like branch shortening and
reordering basic blocks. However this is useful in passes in the
backend only after  RTL insns have finished up with matching with
actual insns in the md file. You can set this attribute based on types
of the insns if you have these based on the types of instructions
probably for scheduling descriptions or manually set this for every
define_insn pattern in your backend.

HTH

cheers
Ramana


-- 
Ramana Radhakrishnan


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