mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-28 04:33:05 +00:00
Rename some variables to match the style guide.
I am about to patch this code, and this makes the diff far more readable. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@189982 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
f94eea9e11
commit
775079c227
@ -109,7 +109,7 @@ Pass *createPruneEHPass();
|
|||||||
///
|
///
|
||||||
/// Note that commandline options that are used with the above function are not
|
/// Note that commandline options that are used with the above function are not
|
||||||
/// used now!
|
/// used now!
|
||||||
ModulePass *createInternalizePass(ArrayRef<const char *> exportList);
|
ModulePass *createInternalizePass(ArrayRef<const char *> ExportList);
|
||||||
/// createInternalizePass - Same as above, but with an empty exportList.
|
/// createInternalizePass - Same as above, but with an empty exportList.
|
||||||
ModulePass *createInternalizePass();
|
ModulePass *createInternalizePass();
|
||||||
|
|
||||||
|
@ -50,7 +50,7 @@ namespace {
|
|||||||
public:
|
public:
|
||||||
static char ID; // Pass identification, replacement for typeid
|
static char ID; // Pass identification, replacement for typeid
|
||||||
explicit InternalizePass();
|
explicit InternalizePass();
|
||||||
explicit InternalizePass(ArrayRef<const char *> exportList);
|
explicit InternalizePass(ArrayRef<const char *> ExportList);
|
||||||
void LoadFile(const char *Filename);
|
void LoadFile(const char *Filename);
|
||||||
virtual bool runOnModule(Module &M);
|
virtual bool runOnModule(Module &M);
|
||||||
|
|
||||||
@ -73,11 +73,11 @@ InternalizePass::InternalizePass()
|
|||||||
ExternalNames.insert(APIList.begin(), APIList.end());
|
ExternalNames.insert(APIList.begin(), APIList.end());
|
||||||
}
|
}
|
||||||
|
|
||||||
InternalizePass::InternalizePass(ArrayRef<const char *> exportList)
|
InternalizePass::InternalizePass(ArrayRef<const char *> ExportList)
|
||||||
: ModulePass(ID){
|
: ModulePass(ID){
|
||||||
initializeInternalizePassPass(*PassRegistry::getPassRegistry());
|
initializeInternalizePassPass(*PassRegistry::getPassRegistry());
|
||||||
for(ArrayRef<const char *>::const_iterator itr = exportList.begin();
|
for(ArrayRef<const char *>::const_iterator itr = ExportList.begin();
|
||||||
itr != exportList.end(); itr++) {
|
itr != ExportList.end(); itr++) {
|
||||||
ExternalNames.insert(*itr);
|
ExternalNames.insert(*itr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -210,6 +210,6 @@ ModulePass *llvm::createInternalizePass() {
|
|||||||
return new InternalizePass();
|
return new InternalizePass();
|
||||||
}
|
}
|
||||||
|
|
||||||
ModulePass *llvm::createInternalizePass(ArrayRef<const char *> el) {
|
ModulePass *llvm::createInternalizePass(ArrayRef<const char *> ExportList) {
|
||||||
return new InternalizePass(el);
|
return new InternalizePass(ExportList);
|
||||||
}
|
}
|
||||||
|
@ -300,18 +300,18 @@ bool LTOCodeGenerator::determineTarget(std::string &errMsg) {
|
|||||||
|
|
||||||
void LTOCodeGenerator::
|
void LTOCodeGenerator::
|
||||||
applyRestriction(GlobalValue &GV,
|
applyRestriction(GlobalValue &GV,
|
||||||
std::vector<const char*> &mustPreserveList,
|
std::vector<const char*> &MustPreserveList,
|
||||||
SmallPtrSet<GlobalValue*, 8> &asmUsed,
|
SmallPtrSet<GlobalValue*, 8> &AsmUsed,
|
||||||
Mangler &mangler) {
|
Mangler &Mangler) {
|
||||||
SmallString<64> Buffer;
|
SmallString<64> Buffer;
|
||||||
mangler.getNameWithPrefix(Buffer, &GV, false);
|
Mangler.getNameWithPrefix(Buffer, &GV, false);
|
||||||
|
|
||||||
if (GV.isDeclaration())
|
if (GV.isDeclaration())
|
||||||
return;
|
return;
|
||||||
if (MustPreserveSymbols.count(Buffer))
|
if (MustPreserveSymbols.count(Buffer))
|
||||||
mustPreserveList.push_back(GV.getName().data());
|
MustPreserveList.push_back(GV.getName().data());
|
||||||
if (AsmUndefinedRefs.count(Buffer))
|
if (AsmUndefinedRefs.count(Buffer))
|
||||||
asmUsed.insert(&GV);
|
AsmUsed.insert(&GV);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void findUsedValues(GlobalVariable *LLVMUsed,
|
static void findUsedValues(GlobalVariable *LLVMUsed,
|
||||||
@ -337,31 +337,31 @@ void LTOCodeGenerator::applyScopeRestrictions() {
|
|||||||
// mark which symbols can not be internalized
|
// mark which symbols can not be internalized
|
||||||
MCContext MContext(TargetMach->getMCAsmInfo(), TargetMach->getRegisterInfo(),
|
MCContext MContext(TargetMach->getMCAsmInfo(), TargetMach->getRegisterInfo(),
|
||||||
NULL);
|
NULL);
|
||||||
Mangler mangler(MContext, TargetMach);
|
Mangler Mangler(MContext, TargetMach);
|
||||||
std::vector<const char*> mustPreserveList;
|
std::vector<const char*> MustPreserveList;
|
||||||
SmallPtrSet<GlobalValue*, 8> asmUsed;
|
SmallPtrSet<GlobalValue*, 8> AsmUsed;
|
||||||
|
|
||||||
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(),
|
||||||
e = mergedModule->alias_end(); a != e; ++a)
|
e = mergedModule->alias_end(); a != e; ++a)
|
||||||
applyRestriction(*a, mustPreserveList, asmUsed, mangler);
|
applyRestriction(*a, MustPreserveList, AsmUsed, Mangler);
|
||||||
|
|
||||||
GlobalVariable *LLVMCompilerUsed =
|
GlobalVariable *LLVMCompilerUsed =
|
||||||
mergedModule->getGlobalVariable("llvm.compiler.used");
|
mergedModule->getGlobalVariable("llvm.compiler.used");
|
||||||
findUsedValues(LLVMCompilerUsed, asmUsed);
|
findUsedValues(LLVMCompilerUsed, AsmUsed);
|
||||||
if (LLVMCompilerUsed)
|
if (LLVMCompilerUsed)
|
||||||
LLVMCompilerUsed->eraseFromParent();
|
LLVMCompilerUsed->eraseFromParent();
|
||||||
|
|
||||||
if (!asmUsed.empty()) {
|
if (!AsmUsed.empty()) {
|
||||||
llvm::Type *i8PTy = llvm::Type::getInt8PtrTy(Context);
|
llvm::Type *i8PTy = llvm::Type::getInt8PtrTy(Context);
|
||||||
std::vector<Constant*> asmUsed2;
|
std::vector<Constant*> asmUsed2;
|
||||||
for (SmallPtrSet<GlobalValue*, 16>::const_iterator i = asmUsed.begin(),
|
for (SmallPtrSet<GlobalValue*, 16>::const_iterator i = AsmUsed.begin(),
|
||||||
e = asmUsed.end(); i !=e; ++i) {
|
e = AsmUsed.end(); i !=e; ++i) {
|
||||||
GlobalValue *GV = *i;
|
GlobalValue *GV = *i;
|
||||||
Constant *c = ConstantExpr::getBitCast(GV, i8PTy);
|
Constant *c = ConstantExpr::getBitCast(GV, i8PTy);
|
||||||
asmUsed2.push_back(c);
|
asmUsed2.push_back(c);
|
||||||
@ -377,7 +377,7 @@ void LTOCodeGenerator::applyScopeRestrictions() {
|
|||||||
LLVMCompilerUsed->setSection("llvm.metadata");
|
LLVMCompilerUsed->setSection("llvm.metadata");
|
||||||
}
|
}
|
||||||
|
|
||||||
passes.add(createInternalizePass(mustPreserveList));
|
passes.add(createInternalizePass(MustPreserveList));
|
||||||
|
|
||||||
// apply scope restrictions
|
// apply scope restrictions
|
||||||
passes.run(*mergedModule);
|
passes.run(*mergedModule);
|
||||||
|
@ -106,9 +106,9 @@ private:
|
|||||||
bool generateObjectFile(llvm::raw_ostream &out, std::string &errMsg);
|
bool generateObjectFile(llvm::raw_ostream &out, std::string &errMsg);
|
||||||
void applyScopeRestrictions();
|
void applyScopeRestrictions();
|
||||||
void applyRestriction(llvm::GlobalValue &GV,
|
void applyRestriction(llvm::GlobalValue &GV,
|
||||||
std::vector<const char*> &mustPreserveList,
|
std::vector<const char*> &MustPreserveList,
|
||||||
llvm::SmallPtrSet<llvm::GlobalValue*, 8> &asmUsed,
|
llvm::SmallPtrSet<llvm::GlobalValue*, 8> &AsmUsed,
|
||||||
llvm::Mangler &mangler);
|
llvm::Mangler &Mangler);
|
||||||
bool determineTarget(std::string &errMsg);
|
bool determineTarget(std::string &errMsg);
|
||||||
|
|
||||||
typedef llvm::StringMap<uint8_t> StringSet;
|
typedef llvm::StringMap<uint8_t> StringSet;
|
||||||
|
Loading…
Reference in New Issue
Block a user