[llvm-commits] r55638 - /llvm/trunk/include/llvm/Function.h

Duncan Sands baldrick at free.fr
Fri Sep 26 02:20:45 PDT 2008


> 	define void @S() notes ("x86.sse3") { ... }
> 
> Here, the intent is simple - function S will run on a processor which  
> has sse3 support.
> 
> 	define void @NS() notes ("x86.no-sse") { ... }
> 
> Again, the intent is clear and simple - function NS is intended to run  
> on a processor that does not have SSE support. Do not use SSE  
> instructions.

I think in general all these flags should be tri-state:
"do it", "don't do it" or don't care.  So here you would
have three possibilities: "x86.sse3", "x86.no-sse3" or
nothing.  The point is that it may be useful to override
the function note at codegen time.  For example if you
specify sse3 to llc it can codegen all the "don't care"
with sse3.  Actually, I'm the example I really have in
mind is the frame-pointer.

To get this working nicely, llvm-gcc would require
some modifications to distinguish between three cases:
-fomit-frame-pointer specified, -fno-omit-frame-pointer
specified, and nothing specified.  It could work like this:

When creating the IR:

-fomit-frame-pointer specified -> no-frame-pointer note
-fno-omit-frame-pointer specified -> frame-pointer note
nothing specified -> no note

When doing codegen (which may be the same time, if
not doing LTO), again look at which flags are specified:

-fomit-frame-pointer specified -> guys that don't care and
guys with no-frame-pointer note do not get a frame pointer.

-fno-omit-frame-pointer specified -> guys that don't care
and guys with frame-pointer note do get a frame pointer.

nothing specified -> no-frame-pointer guys get no frame
pointer, frame-pointer guys get a frame pointer; and
also don't care guys get a frame pointer (corresponds
to gcc default behaviour).

This means that if not doing LTO then the resulting
assembler is the same as now: default is to codegen
with a frame pointer.  However if doing LTO and
nothing was specified when compiling the individual
modules, but -fomit-frame-pointer is specified at
link time then the frame pointer is omitted for
everything.

Ciao,

Duncan.



More information about the llvm-commits mailing list