This is the mail archive of the gcc-patches@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: [PATCH] Pass -mtune and -march options to assembler.


Valdimir Volynsky wrote:

> Unfortunately, it's not possible to do all optimizations on compiler level.
> Some optimizations are impossible without exact knowledge of
> address and opcodes.

The compiler is certainly capable of knowing opcodes.  It's also capable
of knowing as much about addresses as the assembler does.  The linker,
of course, knows a lot more about addresses than either the compiler or
the assembler does.

By putting knowledge into the assembler, instead of in the compiler, you
will inevitably limit the ability of the combined system to generate the
best possible code.  That may be the right engineering tradeoff because
it is so much easier to do work in the assembler than in the compiler,
but it's unfortunate.  It may also be valuable to do optimization in the
assembler for the benefit of hand-written assembly code.  But, in the
abstract, the assembler should have the simple role of converting a
mnemonic representation of the program into a binary version of the program.

Certainly, everything that can be done in the compiler with reasonable
effort should be done there.

-- 
Mark Mitchell
CodeSourcery
mark@codesourcery.com
(650) 331-3385 x713


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