LLVM  14.0.0git
StripNonLineTableDebugInfo.cpp
Go to the documentation of this file.
1 //===- StripNonLineTableDebugInfo.cpp -- Strip parts of Debug Info --------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
10 #include "llvm/IR/DebugInfo.h"
11 #include "llvm/InitializePasses.h"
12 #include "llvm/Pass.h"
13 #include "llvm/Transforms/Utils.h"
14 using namespace llvm;
15 
16 namespace {
17 
18 /// This pass strips all debug info that is not related line tables.
19 /// The result will be the same as if the program where compiled with
20 /// -gline-tables-only.
21 struct StripNonLineTableDebugLegacyPass : public ModulePass {
22  static char ID; // Pass identification, replacement for typeid
23  StripNonLineTableDebugLegacyPass() : ModulePass(ID) {
26  }
27 
28  void getAnalysisUsage(AnalysisUsage &AU) const override {
29  AU.setPreservesAll();
30  }
31 
32  bool runOnModule(Module &M) override {
34  }
35 };
36 }
37 
39 INITIALIZE_PASS(StripNonLineTableDebugLegacyPass,
40  "strip-nonlinetable-debuginfo",
41  "Strip all debug info except linetables", false, false)
42 
44  return new StripNonLineTableDebugLegacyPass();
45 }
46 
50  return PreservedAnalyses::all();
51 }
llvm::PreservedAnalyses
A set of analyses that are preserved following a run of a transformation pass.
Definition: PassManager.h:155
llvm
---------------------— PointerInfo ------------------------------------—
Definition: AllocatorList.h:23
M
We currently emits eax Perhaps this is what we really should generate is Is imull three or four cycles eax eax The current instruction priority is based on pattern complexity The former is more complex because it folds a load so the latter will not be emitted Perhaps we should use AddedComplexity to give LEA32r a higher priority We should always try to match LEA first since the LEA matching code does some estimate to determine whether the match is profitable if we care more about code then imull is better It s two bytes shorter than movl leal On a Pentium M
Definition: README.txt:252
llvm::ModulePass
ModulePass class - This class is used to implement unstructured interprocedural optimizations and ana...
Definition: Pass.h:238
Pass.h
llvm::StripNonLineTableDebugInfoPass::run
PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM)
Definition: StripNonLineTableDebugInfo.cpp:48
INITIALIZE_PASS
INITIALIZE_PASS(StripNonLineTableDebugLegacyPass, "strip-nonlinetable-debuginfo", "Strip all debug info except linetables", false, false) ModulePass *llvm
Definition: StripNonLineTableDebugInfo.cpp:39
llvm::PassRegistry::getPassRegistry
static PassRegistry * getPassRegistry()
getPassRegistry - Access the global registry object, which is automatically initialized at applicatio...
Definition: PassRegistry.cpp:31
llvm::AnalysisUsage
Represent the analysis usage information of a pass.
Definition: PassAnalysisSupport.h:47
Utils.h
DebugInfo.h
llvm::createStripNonLineTableDebugLegacyPass
ModulePass * createStripNonLineTableDebugLegacyPass()
This function returns a new pass that downgrades the debug info in the module to line tables only.
llvm::Module
A Module instance is used to store all the information related to an LLVM module.
Definition: Module.h:67
llvm::AnalysisUsage::setPreservesAll
void setPreservesAll()
Set by analyses that do not transform their input at all.
Definition: PassAnalysisSupport.h:130
llvm::PreservedAnalyses::all
static PreservedAnalyses all()
Construct a special preserved set that preserves all passes.
Definition: PassManager.h:161
llvm::stripNonLineTableDebugInfo
bool stripNonLineTableDebugInfo(Module &M)
Downgrade the debug info in a module to contain only line table information.
Definition: DebugInfo.cpp:711
StripNonLineTableDebugInfo.h
llvm::AnalysisManager
A container for analyses that lazily runs them and caches their results.
Definition: InstructionSimplify.h:44
InitializePasses.h
llvm::initializeStripNonLineTableDebugLegacyPassPass
void initializeStripNonLineTableDebugLegacyPassPass(PassRegistry &)
llvm::Intrinsic::ID
unsigned ID
Definition: TargetTransformInfo.h:37