mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-24 22:24:54 +00:00
For PR411:
Take an incremental step towards type plane elimination. This change separates types from values in the symbol tables by finally making use of the TypeSymbolTable class. This yields more natural interfaces for dealing with types and unclutters the SymbolTable class. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32956 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -16,7 +16,7 @@
|
||||
#include "llvm/Transforms/IPO.h"
|
||||
#include "llvm/Analysis/FindUsedTypes.h"
|
||||
#include "llvm/Module.h"
|
||||
#include "llvm/SymbolTable.h"
|
||||
#include "llvm/TypeSymbolTable.h"
|
||||
#include "llvm/DerivedTypes.h"
|
||||
#include "llvm/ADT/Statistic.h"
|
||||
using namespace llvm;
|
||||
@@ -69,14 +69,15 @@ static inline bool ShouldNukeSymtabEntry(const Type *Ty){
|
||||
bool DTE::runOnModule(Module &M) {
|
||||
bool Changed = false;
|
||||
|
||||
SymbolTable &ST = M.getSymbolTable();
|
||||
TypeSymbolTable &ST = M.getTypeSymbolTable();
|
||||
std::set<const Type *> UsedTypes = getAnalysis<FindUsedTypes>().getTypes();
|
||||
|
||||
// Check the symbol table for superfluous type entries...
|
||||
//
|
||||
// Grab the 'type' plane of the module symbol...
|
||||
SymbolTable::type_iterator TI = ST.type_begin();
|
||||
while ( TI != ST.type_end() ) {
|
||||
TypeSymbolTable::iterator TI = ST.begin();
|
||||
TypeSymbolTable::iterator TE = ST.end();
|
||||
while ( TI != TE ) {
|
||||
// If this entry should be unconditionally removed, or if we detect that
|
||||
// the type is not used, remove it.
|
||||
const Type *RHS = TI->second;
|
||||
|
@@ -29,6 +29,7 @@
|
||||
#include "llvm/Module.h"
|
||||
#include "llvm/Pass.h"
|
||||
#include "llvm/SymbolTable.h"
|
||||
#include "llvm/TypeSymbolTable.h"
|
||||
using namespace llvm;
|
||||
|
||||
namespace {
|
||||
@@ -83,13 +84,11 @@ bool StripSymbols::runOnModule(Module &M) {
|
||||
for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I) {
|
||||
if (I->hasInternalLinkage())
|
||||
I->setName(""); // Internal symbols can't participate in linkage
|
||||
I->getSymbolTable().strip();
|
||||
I->getValueSymbolTable().strip();
|
||||
}
|
||||
|
||||
// Remove all names from types.
|
||||
SymbolTable &SymTab = M.getSymbolTable();
|
||||
while (SymTab.type_begin() != SymTab.type_end())
|
||||
SymTab.remove(SymTab.type_begin());
|
||||
M.getTypeSymbolTable().strip();
|
||||
}
|
||||
|
||||
// Strip debug info in the module if it exists. To do this, we remove
|
||||
|
@@ -16,6 +16,7 @@
|
||||
#include "llvm/Module.h"
|
||||
#include "llvm/DerivedTypes.h"
|
||||
#include "llvm/SymbolTable.h"
|
||||
#include "llvm/TypeSymbolTable.h"
|
||||
#include "llvm/Constant.h"
|
||||
#include "ValueMapper.h"
|
||||
using namespace llvm;
|
||||
@@ -42,11 +43,10 @@ Module *llvm::CloneModule(const Module *M, std::map<const Value*, Value*> &Value
|
||||
New->setModuleInlineAsm(M->getModuleInlineAsm());
|
||||
|
||||
// Copy all of the type symbol table entries over.
|
||||
const SymbolTable &SymTab = M->getSymbolTable();
|
||||
SymbolTable::type_const_iterator TypeI = SymTab.type_begin();
|
||||
SymbolTable::type_const_iterator TypeE = SymTab.type_end();
|
||||
for (; TypeI != TypeE; ++TypeI)
|
||||
New->addTypeName(TypeI->first, TypeI->second);
|
||||
const TypeSymbolTable &TST = M->getTypeSymbolTable();
|
||||
for (TypeSymbolTable::const_iterator TI = TST.begin(), TE = TST.end();
|
||||
TI != TE; ++TI)
|
||||
New->addTypeName(TI->first, TI->second);
|
||||
|
||||
// Copy all of the dependent libraries over.
|
||||
for (Module::lib_iterator I = M->lib_begin(), E = M->lib_end(); I != E; ++I)
|
||||
|
Reference in New Issue
Block a user