X-Git-Url: https://git.saurik.com/apple/javascriptcore.git/blobdiff_plain/2d39b0e377c0896910ee49ae70082ba665faf986..ed1e77d3adeb83d26fd1dfb16dd84cabdcefd250:/llvm/InitializeLLVM.cpp diff --git a/llvm/InitializeLLVM.cpp b/llvm/InitializeLLVM.cpp index 870688e..47348bc 100644 --- a/llvm/InitializeLLVM.cpp +++ b/llvm/InitializeLLVM.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2013, 2014 Apple Inc. All rights reserved. + * Copyright (C) 2013-2015 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -29,12 +29,42 @@ #if HAVE(LLVM) #include "LLVMAPI.h" +#include "Options.h" #include +#include namespace JSC { static pthread_once_t initializeLLVMOnceKey = PTHREAD_ONCE_INIT; +static void initializeLLVMImpl() +{ + const bool verbose = + Options::verboseFTLCompilation() + || Options::showFTLDisassembly() + || Options::verboseFTLFailure() + || Options::verboseCompilation() + || Options::showDFGDisassembly() + || Options::showDisassembly(); + + LLVMInitializerFunction initializer = getLLVMInitializerFunction(verbose); + if (!initializer) + return; + + bool enableFastISel = Options::enableLLVMFastISel(); + llvm = initializer(WTFLogAlwaysAndCrash, &enableFastISel); + if (!llvm) { + if (verbose) + dataLog("LLVM initilization failed.\n"); + } + if (Options::enableLLVMFastISel() && !enableFastISel) { + if (verbose) + dataLog("Fast ISel requested but LLVM not new enough.\n"); + } + + enableLLVMFastISel = enableFastISel; +} + bool initializeLLVM() { pthread_once(&initializeLLVMOnceKey, initializeLLVMImpl);