[LLVMdev] deglobalizing TargetOptions
Nick Lewycky
nlewycky at google.com
Thu Dec 1 17:09:55 PST 2011
I'm running LLVM under threadsanitizer
(http://code.google.com/p/data-race-test/) to find and remove races in
a larger program that uses LLVM as a library. One of the things that I
found is that the TargetOptions are all global; you could create a
TargetMachine targeting ARM and X86 in two threads, but they both have
to share the same FloatABIType setting.
This is silly, and I plan to fix it by moving all the globals in
TargetOptions into getters and setters on TargetMachine. This means
that the TargetMachine object is going to get a bit bigger to
accommodate, but at least two users of llvm linked into one program
won't step on each other. The existing command-line options will move
from TargetMachine into llc which will use the same setters. This has
the side-effect that "clang -mllvm" won't work for them any more.
If you think this change should not happen, or should happen
differently, please let me know.
Nick
More information about the llvm-dev
mailing list