mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-13 04:38:24 +00:00
-Move the DwarfWriter::ValidDebugInfo check to a static DIDescriptor::ValidDebugInfo
-Create DebugLocs without the need to have a DwarfWriter around git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70682 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -20,13 +20,57 @@
|
||||
#include "llvm/Instructions.h"
|
||||
#include "llvm/Module.h"
|
||||
#include "llvm/Analysis/ValueTracking.h"
|
||||
#include "llvm/Support/Dwarf.h"
|
||||
#include "llvm/Support/Streams.h"
|
||||
using namespace llvm;
|
||||
using namespace llvm::dwarf;
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// DIDescriptor
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
/// ValidDebugInfo - Return true if V represents valid debug info value.
|
||||
bool DIDescriptor::ValidDebugInfo(Value *V, CodeGenOpt::Level OptLevel) {
|
||||
if (!V)
|
||||
return false;
|
||||
|
||||
GlobalVariable *GV = dyn_cast<GlobalVariable>(V->stripPointerCasts());
|
||||
if (!GV)
|
||||
return false;
|
||||
|
||||
if (!GV->hasInternalLinkage () && !GV->hasLinkOnceLinkage())
|
||||
return false;
|
||||
|
||||
DIDescriptor DI(GV);
|
||||
|
||||
// Check current version. Allow Version6 for now.
|
||||
unsigned Version = DI.getVersion();
|
||||
if (Version != LLVMDebugVersion && Version != LLVMDebugVersion6)
|
||||
return false;
|
||||
|
||||
unsigned Tag = DI.getTag();
|
||||
switch (Tag) {
|
||||
case DW_TAG_variable:
|
||||
assert(DIVariable(GV).Verify() && "Invalid DebugInfo value");
|
||||
break;
|
||||
case DW_TAG_compile_unit:
|
||||
assert(DICompileUnit(GV).Verify() && "Invalid DebugInfo value");
|
||||
break;
|
||||
case DW_TAG_subprogram:
|
||||
assert(DISubprogram(GV).Verify() && "Invalid DebugInfo value");
|
||||
break;
|
||||
case DW_TAG_lexical_block:
|
||||
/// FIXME. This interfers with the quality of generated code when
|
||||
/// during optimization.
|
||||
if (OptLevel != CodeGenOpt::None)
|
||||
return false;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
DIDescriptor::DIDescriptor(GlobalVariable *gv, unsigned RequiredTag) {
|
||||
GV = gv;
|
||||
|
||||
|
Reference in New Issue
Block a user