mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-10-19 11:02:59 +02:00
Remove some coding violations. No functionality change.
llvm-svn: 161530
This commit is contained in:
parent
79f2f796b4
commit
674a10c78a
@ -154,7 +154,7 @@ bool LTOCodeGenerator::writeMergedModules(const char *path,
|
|||||||
bool LTOCodeGenerator::compile_to_file(const char** name, std::string& errMsg) {
|
bool LTOCodeGenerator::compile_to_file(const char** name, std::string& errMsg) {
|
||||||
// make unique temp .o file to put generated object file
|
// make unique temp .o file to put generated object file
|
||||||
sys::PathWithStatus uniqueObjPath("lto-llvm.o");
|
sys::PathWithStatus uniqueObjPath("lto-llvm.o");
|
||||||
if ( uniqueObjPath.createTemporaryFileOnDisk(false, &errMsg) ) {
|
if (uniqueObjPath.createTemporaryFileOnDisk(false, &errMsg)) {
|
||||||
uniqueObjPath.eraseFromDisk();
|
uniqueObjPath.eraseFromDisk();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -174,7 +174,7 @@ bool LTOCodeGenerator::compile_to_file(const char** name, std::string& errMsg) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
objFile.keep();
|
objFile.keep();
|
||||||
if ( genResult ) {
|
if (genResult) {
|
||||||
uniqueObjPath.eraseFromDisk();
|
uniqueObjPath.eraseFromDisk();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -204,14 +204,15 @@ const void* LTOCodeGenerator::compile(size_t* length, std::string& errMsg) {
|
|||||||
sys::Path(_nativeObjectPath).eraseFromDisk();
|
sys::Path(_nativeObjectPath).eraseFromDisk();
|
||||||
|
|
||||||
// return buffer, unless error
|
// return buffer, unless error
|
||||||
if ( _nativeObjectFile == NULL )
|
if (_nativeObjectFile == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
*length = _nativeObjectFile->getBufferSize();
|
*length = _nativeObjectFile->getBufferSize();
|
||||||
return _nativeObjectFile->getBufferStart();
|
return _nativeObjectFile->getBufferStart();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool LTOCodeGenerator::determineTarget(std::string& errMsg) {
|
bool LTOCodeGenerator::determineTarget(std::string& errMsg) {
|
||||||
if ( _target != NULL ) return false;
|
if (_target != NULL)
|
||||||
|
return false;
|
||||||
|
|
||||||
std::string Triple = _linker.getModule()->getTargetTriple();
|
std::string Triple = _linker.getModule()->getTargetTriple();
|
||||||
if (Triple.empty())
|
if (Triple.empty())
|
||||||
@ -219,13 +220,13 @@ bool LTOCodeGenerator::determineTarget(std::string& errMsg) {
|
|||||||
|
|
||||||
// create target machine from info for merged modules
|
// create target machine from info for merged modules
|
||||||
const Target *march = TargetRegistry::lookupTarget(Triple, errMsg);
|
const Target *march = TargetRegistry::lookupTarget(Triple, errMsg);
|
||||||
if ( march == NULL )
|
if (march == NULL)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
// The relocation model is actually a static member of TargetMachine and
|
// The relocation model is actually a static member of TargetMachine and
|
||||||
// needs to be set before the TargetMachine is instantiated.
|
// needs to be set before the TargetMachine is instantiated.
|
||||||
Reloc::Model RelocModel = Reloc::Default;
|
Reloc::Model RelocModel = Reloc::Default;
|
||||||
switch( _codeModel ) {
|
switch (_codeModel) {
|
||||||
case LTO_CODEGEN_PIC_MODEL_STATIC:
|
case LTO_CODEGEN_PIC_MODEL_STATIC:
|
||||||
RelocModel = Reloc::Static;
|
RelocModel = Reloc::Static;
|
||||||
break;
|
break;
|
||||||
@ -337,13 +338,13 @@ void LTOCodeGenerator::applyScopeRestrictions() {
|
|||||||
/// Optimize merged modules using various IPO passes
|
/// Optimize merged modules using various IPO passes
|
||||||
bool LTOCodeGenerator::generateObjectFile(raw_ostream &out,
|
bool LTOCodeGenerator::generateObjectFile(raw_ostream &out,
|
||||||
std::string &errMsg) {
|
std::string &errMsg) {
|
||||||
if ( this->determineTarget(errMsg) )
|
if (this->determineTarget(errMsg))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
Module* mergedModule = _linker.getModule();
|
Module* mergedModule = _linker.getModule();
|
||||||
|
|
||||||
// if options were requested, set them
|
// if options were requested, set them
|
||||||
if ( !_codegenOptions.empty() )
|
if (!_codegenOptions.empty())
|
||||||
cl::ParseCommandLineOptions(_codegenOptions.size(),
|
cl::ParseCommandLineOptions(_codegenOptions.size(),
|
||||||
const_cast<char **>(&_codegenOptions[0]));
|
const_cast<char **>(&_codegenOptions[0]));
|
||||||
|
|
||||||
@ -405,7 +406,7 @@ void LTOCodeGenerator::setCodeGenDebugOptions(const char *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. Lazily add
|
||||||
// that.
|
// that.
|
||||||
if ( _codegenOptions.empty() )
|
if (_codegenOptions.empty())
|
||||||
_codegenOptions.push_back(strdup("libLTO"));
|
_codegenOptions.push_back(strdup("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