This is the mail archive of the gcc-help@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: Excluding parts of the instruction set during compilation


On 13/02/14 10:21, Fabian Oboril wrote:
Hello everybody,

I am currently working on a project for which I need to compile C-code
using only a small subset of the available instruction set. So for
example, instead of using add, addi, addiu and addu, I would like that
the compiler is using just one of them. Is there a way, that this can be
handled with gcc, for example by giving a list of not-to-use
instructions at compile time?

Can anyone help?

Hi Fabian,

It's not really possible to give gcc a list of instructions not to use. What if some operations in your source code can only be performed by those instructions that you excluded? Getting the compiler to synthesise any operation using any arbitrary subset of instructions is not realistic. Some targets, for example arm, can generate code for multiple revisions of the architecture and newer revisions might allow instructions that are not present in previous ones. In that case gcc will know not to generate those instructions if asked to compile for the old instruction by having -march set appropriately, but the list of instructions available for use is defined by the architecture, not the user.

HTH,
Kyrill



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