mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-15 20:29:48 +00:00
Remove all dbg symobls, including those with circular references.
This is ugly, but I can't figure out a quick way out of this. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@65889 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
893a0f9f0e
commit
73df3c9721
@ -185,6 +185,21 @@ bool StripSymbolNames(Module &M, bool PreserveDbgInfo) {
|
|||||||
// llvm.dbg.region.end calls, and any globals they point to if now dead.
|
// llvm.dbg.region.end calls, and any globals they point to if now dead.
|
||||||
bool StripDebugInfo(Module &M) {
|
bool StripDebugInfo(Module &M) {
|
||||||
|
|
||||||
|
SmallPtrSet<const GlobalValue*, 8> llvmUsedValues;
|
||||||
|
findUsedValues(M, llvmUsedValues);
|
||||||
|
|
||||||
|
// Delete all dbg variables.
|
||||||
|
for (Module::global_iterator I = M.global_begin(), E = M.global_end();
|
||||||
|
I != E; ++I) {
|
||||||
|
GlobalVariable *GV = dyn_cast<GlobalVariable>(I);
|
||||||
|
if (!GV) continue;
|
||||||
|
if (!GV->use_empty() && llvmUsedValues.count(I) == 0) {
|
||||||
|
if (strncmp(GV->getNameStart(), "llvm.dbg", 8) == 0) {
|
||||||
|
GV->replaceAllUsesWith(UndefValue::get(GV->getType()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Function *FuncStart = M.getFunction("llvm.dbg.func.start");
|
Function *FuncStart = M.getFunction("llvm.dbg.func.start");
|
||||||
Function *StopPoint = M.getFunction("llvm.dbg.stoppoint");
|
Function *StopPoint = M.getFunction("llvm.dbg.stoppoint");
|
||||||
Function *RegionStart = M.getFunction("llvm.dbg.region.start");
|
Function *RegionStart = M.getFunction("llvm.dbg.region.start");
|
||||||
@ -263,9 +278,6 @@ bool StripDebugInfo(Module &M) {
|
|||||||
Declare->eraseFromParent();
|
Declare->eraseFromParent();
|
||||||
}
|
}
|
||||||
|
|
||||||
SmallPtrSet<const GlobalValue*, 8> llvmUsedValues;
|
|
||||||
findUsedValues(M, llvmUsedValues);
|
|
||||||
|
|
||||||
// llvm.dbg.compile_units and llvm.dbg.subprograms are marked as linkonce
|
// llvm.dbg.compile_units and llvm.dbg.subprograms are marked as linkonce
|
||||||
// but since we are removing all debug information, make them internal now.
|
// but since we are removing all debug information, make them internal now.
|
||||||
// FIXME: Use private linkage maybe?
|
// FIXME: Use private linkage maybe?
|
||||||
|
Loading…
Reference in New Issue
Block a user