[LLVMdev] Changing target features from C++
Cyrille Berger
cberger at cberger.net
Sun Jul 20 12:33:50 PDT 2008
On Sunday 20 July 2008, Chris Lattner wrote:
> On Jul 20, 2008, at 2:59 AM, Nicolas Capens wrote:
> > I see. While hacking AutoDetectSubtargetFeatures() works for me for
> > now, would it be useful to define an interface for X86Subtarget to
> > change the features in a cleaner way? Would methods like
> > disableSSEn()/enableSSEn() work or do you have another suggestion? I
> > certainly want to avoid a situation where one module uses other
> > settings than another moduleā¦
>
> Why would this be useful for other users? It seems best to always
> take advantage of features the cpu has if possible, and the JIT has
> perfect knowledge of what the host cpu has.
Unless it leads to crash. Currently, in my code I had to disable use of
SSE/MMX because when I enable them, the code I generate trigger a crash.
While it would be lovely to find the problem and report it to be fixed (I did
find a reason in llvm 2.2 but it was fixed in 2.3 before I could report ;)
but the problem I found disappeared, but it still crash :( ). In the mean
time, until I have the time to identify the reason of the crash, I still want
my library to be useful, hence the need to disable SSE/MMX.
That said, I found an other way around the problem, adding this to the code:
char** argv = new char*[2];
argv[0] = const_cast<char*>( "GTLVM");
argv[1] =
const_cast<char*>( "-mattr=-3dnow,-3dnowa,-mmx,-sse,-sse2,-sse3,-ssse3" );
llvm::cl::ParseCommandLineOptions(2, argv, "");
--
Cyrille Berger
More information about the llvm-dev
mailing list