fanqifei <fanqi...@gmail.com> writes:

> According to the internal manual, insn length attribute can be used to
> to calculate the length of emitted code chunks when verifying branch
> distances.
> Can it be used in code size optimization?

I suppose it could, but it isn't.  Instead of asking the backend for
the length of instructions, the compiler asks the backend for the cost
of instructions.  The backend is free to determine that cost however
it likes.  When using -Os, using the size of the instruction is a good
measure of cost.


> I may change TARGET_RTX_COSTS in my gcc port and return costs
> regarding the ins lengths.  I can see code snippets for this purpose
> in i386/i386.c, however, the insn sizes are hard coded in array
> size_cost.
> Are there any other places where the insn length impacts insn selection?

In one sense, insn length never currently affects insn selection.  In
another sense, the costs hook is the right place for it to affect insn
selection, when using -Os.

Ian

Reply via email to