mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-08-05 13:26:55 +00:00
Encapsulate PassManager debug flags to avoid static init and cxa_exit.
This puts all the global PassManager debugging flags, like -print-after-all and -time-passes, behind a managed static. This eliminates their static initializers and, more importantly, exit-time destructors. The only behavioral change I anticipate is that tools need to initialize the PassManager before parsing the command line in order to export these options, which makes sense. Tools that already initialize the standard passes (opt/llc) don't need to do anything new. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@190974 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -20,6 +20,7 @@
|
||||
#include "llvm/Assembly/Parser.h"
|
||||
#include "llvm/Bitcode/ReaderWriter.h"
|
||||
#include "llvm/IR/Module.h"
|
||||
#include "llvm/PassManager.h"
|
||||
#include "llvm/Support/CommandLine.h"
|
||||
#include "llvm/Support/ManagedStatic.h"
|
||||
#include "llvm/Support/PrettyStackTrace.h"
|
||||
@@ -89,6 +90,10 @@ int main(int argc, char **argv) {
|
||||
PrettyStackTraceProgram X(argc, argv);
|
||||
LLVMContext &Context = getGlobalContext();
|
||||
llvm_shutdown_obj Y; // Call llvm_shutdown() on exit.
|
||||
|
||||
// Initialize PassManager for -time-passes support.
|
||||
initializePassManager();
|
||||
|
||||
cl::ParseCommandLineOptions(argc, argv, "llvm .ll -> .bc assembler\n");
|
||||
|
||||
// Parse the file now...
|
||||
|
@@ -20,6 +20,7 @@
|
||||
#include "llvm/IR/Module.h"
|
||||
#include "llvm/IR/Type.h"
|
||||
#include "llvm/IRReader/IRReader.h"
|
||||
#include "llvm/PassManager.h"
|
||||
#include "llvm/Support/CommandLine.h"
|
||||
#include "llvm/Support/MemoryBuffer.h"
|
||||
#include "llvm/Support/SourceMgr.h"
|
||||
@@ -67,6 +68,9 @@ static cl::list<std::string> GlobalsToCompare(cl::Positional,
|
||||
cl::desc("<globals to compare>"));
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
// Initialize PassManager for -time-passes support.
|
||||
initializePassManager();
|
||||
|
||||
cl::ParseCommandLineOptions(argc, argv);
|
||||
|
||||
LLVMContext Context;
|
||||
|
@@ -23,6 +23,7 @@
|
||||
#include "llvm/IR/IntrinsicInst.h"
|
||||
#include "llvm/IR/Module.h"
|
||||
#include "llvm/IR/Type.h"
|
||||
#include "llvm/PassManager.h"
|
||||
#include "llvm/Support/CommandLine.h"
|
||||
#include "llvm/Support/DataStream.h"
|
||||
#include "llvm/Support/FormattedStream.h"
|
||||
@@ -119,6 +120,8 @@ int main(int argc, char **argv) {
|
||||
LLVMContext &Context = getGlobalContext();
|
||||
llvm_shutdown_obj Y; // Call llvm_shutdown() on exit.
|
||||
|
||||
// Initialize PassManager for -time-passes support.
|
||||
initializePassManager();
|
||||
|
||||
cl::ParseCommandLineOptions(argc, argv, "llvm .bc -> .ll disassembler\n");
|
||||
|
||||
|
@@ -96,6 +96,10 @@ int main(int argc, char **argv) {
|
||||
|
||||
LLVMContext &Context = getGlobalContext();
|
||||
llvm_shutdown_obj Y; // Call llvm_shutdown() on exit.
|
||||
|
||||
// Initialize PassManager for -time-passes support.
|
||||
initializePassManager();
|
||||
|
||||
cl::ParseCommandLineOptions(argc, argv, "llvm extractor\n");
|
||||
|
||||
// Use lazy loading, since we only care about selected global values.
|
||||
|
@@ -18,6 +18,7 @@
|
||||
#include "llvm/IR/LLVMContext.h"
|
||||
#include "llvm/IR/Module.h"
|
||||
#include "llvm/IRReader/IRReader.h"
|
||||
#include "llvm/PassManager.h"
|
||||
#include "llvm/Support/CommandLine.h"
|
||||
#include "llvm/Support/ManagedStatic.h"
|
||||
#include "llvm/Support/Path.h"
|
||||
@@ -73,6 +74,10 @@ int main(int argc, char **argv) {
|
||||
|
||||
LLVMContext &Context = getGlobalContext();
|
||||
llvm_shutdown_obj Y; // Call llvm_shutdown() on exit.
|
||||
|
||||
// Initialize PassManager for -time-passes support.
|
||||
initializePassManager();
|
||||
|
||||
cl::ParseCommandLineOptions(argc, argv, "llvm linker\n");
|
||||
|
||||
unsigned BaseArg = 0;
|
||||
|
@@ -22,6 +22,7 @@
|
||||
#include "llvm/Object/Archive.h"
|
||||
#include "llvm/Object/MachOUniversal.h"
|
||||
#include "llvm/Object/ObjectFile.h"
|
||||
#include "llvm/PassManager.h"
|
||||
#include "llvm/Support/CommandLine.h"
|
||||
#include "llvm/Support/FileSystem.h"
|
||||
#include "llvm/Support/Format.h"
|
||||
@@ -446,6 +447,10 @@ int main(int argc, char **argv) {
|
||||
PrettyStackTraceProgram X(argc, argv);
|
||||
|
||||
llvm_shutdown_obj Y; // Call llvm_shutdown() on exit.
|
||||
|
||||
// Initialize PassManager for -time-passes support.
|
||||
initializePassManager();
|
||||
|
||||
cl::ParseCommandLineOptions(argc, argv, "llvm symbol table dumper\n");
|
||||
|
||||
// llvm-nm only reads binary files.
|
||||
|
@@ -260,6 +260,9 @@ int main(int argc, char **argv) {
|
||||
LLVMContext &Context = getGlobalContext();
|
||||
llvm_shutdown_obj Y; // Call llvm_shutdown() on exit.
|
||||
|
||||
// Initialize PassManager for -time-passes support.
|
||||
initializePassManager();
|
||||
|
||||
cl::ParseCommandLineOptions(argc, argv, "llvm profile dump decoder\n");
|
||||
|
||||
// Read in the bitcode file...
|
||||
|
@@ -681,6 +681,10 @@ void IntroduceControlFlow(Function *F, Random &R) {
|
||||
int main(int argc, char **argv) {
|
||||
// Init LLVM, call llvm_shutdown() on exit, parse args, etc.
|
||||
llvm::PrettyStackTraceProgram X(argc, argv);
|
||||
|
||||
// Initialize PassManager for -time-passes support.
|
||||
initializePassManager();
|
||||
|
||||
cl::ParseCommandLineOptions(argc, argv, "llvm codegen stress-tester\n");
|
||||
llvm_shutdown_obj Y;
|
||||
|
||||
|
Reference in New Issue
Block a user