mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-14 11:32:34 +00:00
Free the codegen options when deleting LTO code generator object.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153803 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
168f142834
commit
caf71d4185
@ -51,24 +51,19 @@
|
|||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
|
||||||
|
|
||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
|
|
||||||
static cl::opt<bool> DisableInline("disable-inlining",
|
static cl::opt<bool> DisableInline("disable-inlining",
|
||||||
cl::desc("Do not run the inliner pass"));
|
cl::desc("Do not run the inliner pass"));
|
||||||
|
|
||||||
|
const char* LTOCodeGenerator::getVersionString() {
|
||||||
const char* LTOCodeGenerator::getVersionString()
|
|
||||||
{
|
|
||||||
#ifdef LLVM_VERSION_INFO
|
#ifdef LLVM_VERSION_INFO
|
||||||
return PACKAGE_NAME " version " PACKAGE_VERSION ", " LLVM_VERSION_INFO;
|
return PACKAGE_NAME " version " PACKAGE_VERSION ", " LLVM_VERSION_INFO;
|
||||||
#else
|
#else
|
||||||
return PACKAGE_NAME " version " PACKAGE_VERSION;
|
return PACKAGE_NAME " version " PACKAGE_VERSION;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
LTOCodeGenerator::LTOCodeGenerator()
|
LTOCodeGenerator::LTOCodeGenerator()
|
||||||
: _context(getGlobalContext()),
|
: _context(getGlobalContext()),
|
||||||
_linker("LinkTimeOptimizer", "ld-temp.o", _context), _target(NULL),
|
_linker("LinkTimeOptimizer", "ld-temp.o", _context), _target(NULL),
|
||||||
@ -81,14 +76,15 @@ LTOCodeGenerator::LTOCodeGenerator()
|
|||||||
InitializeAllAsmPrinters();
|
InitializeAllAsmPrinters();
|
||||||
}
|
}
|
||||||
|
|
||||||
LTOCodeGenerator::~LTOCodeGenerator()
|
LTOCodeGenerator::~LTOCodeGenerator() {
|
||||||
{
|
delete _target;
|
||||||
delete _target;
|
delete _nativeObjectFile;
|
||||||
delete _nativeObjectFile;
|
|
||||||
|
for (std::vector<const char*>::iterator I = _codegenOptions.begin(),
|
||||||
|
E = _codegenOptions.end(); I != E; ++I)
|
||||||
|
free(*I);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
bool LTOCodeGenerator::addModule(LTOModule* mod, std::string& errMsg)
|
bool LTOCodeGenerator::addModule(LTOModule* mod, std::string& errMsg)
|
||||||
{
|
{
|
||||||
bool ret = _linker.LinkInModule(mod->getLLVVMModule(), &errMsg);
|
bool ret = _linker.LinkInModule(mod->getLLVVMModule(), &errMsg);
|
||||||
@ -416,16 +412,15 @@ bool LTOCodeGenerator::generateObjectFile(raw_ostream &out,
|
|||||||
return false; // success
|
return false; // success
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// setCodeGenDebugOptions - Set codegen debugging options to aid in debugging
|
||||||
/// Optimize merged modules using various IPO passes
|
/// LTO problems.
|
||||||
void LTOCodeGenerator::setCodeGenDebugOptions(const char* options)
|
void LTOCodeGenerator::setCodeGenDebugOptions(const char *options) {
|
||||||
{
|
for (std::pair<StringRef, StringRef> o = getToken(options);
|
||||||
for (std::pair<StringRef, StringRef> o = getToken(options);
|
!o.first.empty(); o = getToken(o.second)) {
|
||||||
!o.first.empty(); o = getToken(o.second)) {
|
// ParseCommandLineOptions() expects argv[0] to be program name. Lazily add
|
||||||
// ParseCommandLineOptions() expects argv[0] to be program name.
|
// that.
|
||||||
// Lazily add that.
|
if ( _codegenOptions.empty() )
|
||||||
if ( _codegenOptions.empty() )
|
_codegenOptions.push_back(strdup("libLTO"));
|
||||||
_codegenOptions.push_back("libLTO");
|
_codegenOptions.push_back(strdup(o.first.str().c_str()));
|
||||||
_codegenOptions.push_back(strdup(o.first.str().c_str()));
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user