Cleanup whitespace.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153804 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Bill Wendling
2012-03-31 10:50:14 +00:00
parent caf71d4185
commit 76b13ed403

View File

@@ -4,10 +4,10 @@
// //
// This file is distributed under the University of Illinois Open Source // This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details. // License. See LICENSE.TXT for details.
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
// //
// This file implements the Link Time Optimization library. This library is // This file implements the Link Time Optimization library. This library is
// intended to be used by linker to optimize code at link time. // intended to be used by linker to optimize code at link time.
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
@@ -64,7 +64,7 @@ const char* LTOCodeGenerator::getVersionString() {
#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),
_emitDwarfDebugInfo(false), _scopeRestrictionsDone(false), _emitDwarfDebugInfo(false), _scopeRestrictionsDone(false),
@@ -95,7 +95,7 @@ bool LTOCodeGenerator::addModule(LTOModule* mod, std::string& errMsg)
return ret; return ret;
} }
bool LTOCodeGenerator::setDebugInfo(lto_debug_model debug, std::string& errMsg) bool LTOCodeGenerator::setDebugInfo(lto_debug_model debug, std::string& errMsg)
{ {
@@ -103,7 +103,7 @@ bool LTOCodeGenerator::setDebugInfo(lto_debug_model debug, std::string& errMsg)
case LTO_DEBUG_MODEL_NONE: case LTO_DEBUG_MODEL_NONE:
_emitDwarfDebugInfo = false; _emitDwarfDebugInfo = false;
return false; return false;
case LTO_DEBUG_MODEL_DWARF: case LTO_DEBUG_MODEL_DWARF:
_emitDwarfDebugInfo = true; _emitDwarfDebugInfo = true;
return false; return false;
@@ -112,7 +112,7 @@ bool LTOCodeGenerator::setDebugInfo(lto_debug_model debug, std::string& errMsg)
} }
bool LTOCodeGenerator::setCodePICModel(lto_codegen_model model, bool LTOCodeGenerator::setCodePICModel(lto_codegen_model model,
std::string& errMsg) std::string& errMsg)
{ {
switch (model) { switch (model) {
@@ -141,7 +141,7 @@ bool LTOCodeGenerator::writeMergedModules(const char *path,
if (determineTarget(errMsg)) if (determineTarget(errMsg))
return true; return true;
// mark which symbols can not be internalized // mark which symbols can not be internalized
applyScopeRestrictions(); applyScopeRestrictions();
// create output file // create output file
@@ -153,7 +153,7 @@ bool LTOCodeGenerator::writeMergedModules(const char *path,
errMsg += path; errMsg += path;
return true; return true;
} }
// write bitcode to it // write bitcode to it
WriteBitcodeToFile(_linker.getModule(), Out.os()); WriteBitcodeToFile(_linker.getModule(), Out.os());
Out.os().close(); Out.os().close();
@@ -164,7 +164,7 @@ bool LTOCodeGenerator::writeMergedModules(const char *path,
Out.os().clear_error(); Out.os().clear_error();
return true; return true;
} }
Out.keep(); Out.keep();
return false; return false;
} }
@@ -290,7 +290,7 @@ static void findUsedValues(GlobalVariable *LLVMUsed,
if (Inits == 0) return; if (Inits == 0) return;
for (unsigned i = 0, e = Inits->getNumOperands(); i != e; ++i) for (unsigned i = 0, e = Inits->getNumOperands(); i != e; ++i)
if (GlobalValue *GV = if (GlobalValue *GV =
dyn_cast<GlobalValue>(Inits->getOperand(i)->stripPointerCasts())) dyn_cast<GlobalValue>(Inits->getOperand(i)->stripPointerCasts()))
UsedValues.insert(GV); UsedValues.insert(GV);
} }
@@ -303,7 +303,7 @@ void LTOCodeGenerator::applyScopeRestrictions() {
PassManager passes; PassManager passes;
passes.add(createVerifierPass()); passes.add(createVerifierPass());
// mark which symbols can not be internalized // mark which symbols can not be internalized
MCContext Context(*_target->getMCAsmInfo(), *_target->getRegisterInfo(), NULL); MCContext Context(*_target->getMCAsmInfo(), *_target->getRegisterInfo(), NULL);
Mangler mangler(Context, *_target->getTargetData()); Mangler mangler(Context, *_target->getTargetData());
std::vector<const char*> mustPreserveList; std::vector<const char*> mustPreserveList;
@@ -312,7 +312,7 @@ void LTOCodeGenerator::applyScopeRestrictions() {
for (Module::iterator f = mergedModule->begin(), for (Module::iterator f = mergedModule->begin(),
e = mergedModule->end(); f != e; ++f) e = mergedModule->end(); f != e; ++f)
applyRestriction(*f, mustPreserveList, asmUsed, mangler); applyRestriction(*f, mustPreserveList, asmUsed, mangler);
for (Module::global_iterator v = mergedModule->global_begin(), for (Module::global_iterator v = mergedModule->global_begin(),
e = mergedModule->global_end(); v != e; ++v) e = mergedModule->global_end(); v != e; ++v)
applyRestriction(*v, mustPreserveList, asmUsed, mangler); applyRestriction(*v, mustPreserveList, asmUsed, mangler);
for (Module::alias_iterator a = mergedModule->alias_begin(), for (Module::alias_iterator a = mergedModule->alias_begin(),
@@ -347,24 +347,24 @@ void LTOCodeGenerator::applyScopeRestrictions() {
// apply scope restrictions // apply scope restrictions
passes.run(*mergedModule); passes.run(*mergedModule);
_scopeRestrictionsDone = true; _scopeRestrictionsDone = true;
} }
/// 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;
// mark which symbols can not be internalized // mark which symbols can not be internalized
this->applyScopeRestrictions(); this->applyScopeRestrictions();
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]));
// Instantiate the pass manager to organize the passes. // Instantiate the pass manager to organize the passes.
@@ -375,7 +375,7 @@ bool LTOCodeGenerator::generateObjectFile(raw_ostream &out,
// Add an appropriate TargetData instance for this module... // Add an appropriate TargetData instance for this module...
passes.add(new TargetData(*_target->getTargetData())); passes.add(new TargetData(*_target->getTargetData()));
PassManagerBuilder().populateLTOPassManager(passes, /*Internalize=*/ false, PassManagerBuilder().populateLTOPassManager(passes, /*Internalize=*/ false,
!DisableInline); !DisableInline);