1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 02:52:53 +02:00

Make sure targets are initialized before we do anything, even command line

processing.

llvm-svn: 75888
This commit is contained in:
Daniel Dunbar 2009-07-16 02:04:54 +00:00
parent 90536f6737
commit f9b1d883dd
2 changed files with 8 additions and 5 deletions

View File

@ -210,10 +210,12 @@ int main(int argc, char **argv) {
PrettyStackTraceProgram X(argc, argv);
LLVMContext &Context = getGlobalContext();
llvm_shutdown_obj Y; // Call llvm_shutdown() on exit.
cl::ParseCommandLineOptions(argc, argv, "llvm system compiler\n");
// Initialize targets first.
InitializeAllTargets();
InitializeAllAsmPrinters();
cl::ParseCommandLineOptions(argc, argv, "llvm system compiler\n");
// Load the module to be compiled...
std::string ErrorMessage;

View File

@ -96,6 +96,11 @@ int main(int argc, char **argv, char * const *envp) {
LLVMContext &Context = getGlobalContext();
atexit(do_shutdown); // Call llvm_shutdown() on exit.
// If we have a native target, initialize it to ensure it is linked in and
// usable by the JIT.
InitializeNativeTarget();
cl::ParseCommandLineOptions(argc, argv,
"llvm interpreter & dynamic compiler\n");
@ -142,10 +147,6 @@ int main(int argc, char **argv, char * const *envp) {
case '3': OLvl = CodeGenOpt::Aggressive; break;
}
// If we have a native target, initialize it to ensure it is linked in and
// usable by the JIT.
InitializeNativeTarget();
EE = ExecutionEngine::create(MP, ForceInterpreter, &ErrorMsg, OLvl);
if (!EE) {
if (!ErrorMsg.empty())