mirror of
https://github.com/RPCS3/llvm.git
synced 2024-12-29 16:04:33 +00:00
tidy up.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@109038 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
1e20b96313
commit
e62b690607
@ -32,7 +32,7 @@ using namespace llvm::dwarf;
|
|||||||
// DIDescriptor
|
// DIDescriptor
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
StringRef
|
StringRef
|
||||||
DIDescriptor::getStringField(unsigned Elt) const {
|
DIDescriptor::getStringField(unsigned Elt) const {
|
||||||
if (DbgNode == 0)
|
if (DbgNode == 0)
|
||||||
return StringRef();
|
return StringRef();
|
||||||
@ -60,7 +60,8 @@ DIDescriptor DIDescriptor::getDescriptorField(unsigned Elt) const {
|
|||||||
return DIDescriptor();
|
return DIDescriptor();
|
||||||
|
|
||||||
if (Elt < DbgNode->getNumOperands())
|
if (Elt < DbgNode->getNumOperands())
|
||||||
return DIDescriptor(dyn_cast_or_null<const MDNode>(DbgNode->getOperand(Elt)));
|
return
|
||||||
|
DIDescriptor(dyn_cast_or_null<const MDNode>(DbgNode->getOperand(Elt)));
|
||||||
return DIDescriptor();
|
return DIDescriptor();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -353,7 +354,7 @@ bool DIVariable::Verify() const {
|
|||||||
bool DILocation::Verify() const {
|
bool DILocation::Verify() const {
|
||||||
if (!DbgNode)
|
if (!DbgNode)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return DbgNode->getNumOperands() == 4;
|
return DbgNode->getNumOperands() == 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -376,7 +377,7 @@ uint64_t DIDerivedType::getOriginalTypeSize() const {
|
|||||||
Tag == dwarf::DW_TAG_const_type || Tag == dwarf::DW_TAG_volatile_type ||
|
Tag == dwarf::DW_TAG_const_type || Tag == dwarf::DW_TAG_volatile_type ||
|
||||||
Tag == dwarf::DW_TAG_restrict_type) {
|
Tag == dwarf::DW_TAG_restrict_type) {
|
||||||
DIType BaseType = getTypeDerivedFrom();
|
DIType BaseType = getTypeDerivedFrom();
|
||||||
// If this type is not derived from any type then take conservative
|
// If this type is not derived from any type then take conservative
|
||||||
// approach.
|
// approach.
|
||||||
if (!BaseType.isValid())
|
if (!BaseType.isValid())
|
||||||
return getSizeInBits();
|
return getSizeInBits();
|
||||||
@ -385,17 +386,17 @@ uint64_t DIDerivedType::getOriginalTypeSize() const {
|
|||||||
else
|
else
|
||||||
return BaseType.getSizeInBits();
|
return BaseType.getSizeInBits();
|
||||||
}
|
}
|
||||||
|
|
||||||
return getSizeInBits();
|
return getSizeInBits();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// isInlinedFnArgument - Return trule if this variable provides debugging
|
/// isInlinedFnArgument - Return true if this variable provides debugging
|
||||||
/// information for an inlined function arguments.
|
/// information for an inlined function arguments.
|
||||||
bool DIVariable::isInlinedFnArgument(const Function *CurFn) {
|
bool DIVariable::isInlinedFnArgument(const Function *CurFn) {
|
||||||
assert(CurFn && "Invalid function");
|
assert(CurFn && "Invalid function");
|
||||||
if (!getContext().isSubprogram())
|
if (!getContext().isSubprogram())
|
||||||
return false;
|
return false;
|
||||||
// This variable is not inlined function argument if its scope
|
// This variable is not inlined function argument if its scope
|
||||||
// does not describe current function.
|
// does not describe current function.
|
||||||
return !(DISubprogram(getContext()).describes(CurFn));
|
return !(DISubprogram(getContext()).describes(CurFn));
|
||||||
}
|
}
|
||||||
@ -414,7 +415,7 @@ bool DISubprogram::describes(const Function *F) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned DISubprogram::isOptimized() const {
|
unsigned DISubprogram::isOptimized() const {
|
||||||
assert (DbgNode && "Invalid subprogram descriptor!");
|
assert (DbgNode && "Invalid subprogram descriptor!");
|
||||||
if (DbgNode->getNumOperands() == 16)
|
if (DbgNode->getNumOperands() == 16)
|
||||||
return getUnsignedField(15);
|
return getUnsignedField(15);
|
||||||
@ -424,7 +425,7 @@ unsigned DISubprogram::isOptimized() const {
|
|||||||
StringRef DIScope::getFilename() const {
|
StringRef DIScope::getFilename() const {
|
||||||
if (!DbgNode)
|
if (!DbgNode)
|
||||||
return StringRef();
|
return StringRef();
|
||||||
if (isLexicalBlock())
|
if (isLexicalBlock())
|
||||||
return DILexicalBlock(DbgNode).getFilename();
|
return DILexicalBlock(DbgNode).getFilename();
|
||||||
if (isSubprogram())
|
if (isSubprogram())
|
||||||
return DISubprogram(DbgNode).getFilename();
|
return DISubprogram(DbgNode).getFilename();
|
||||||
@ -443,7 +444,7 @@ StringRef DIScope::getFilename() const {
|
|||||||
StringRef DIScope::getDirectory() const {
|
StringRef DIScope::getDirectory() const {
|
||||||
if (!DbgNode)
|
if (!DbgNode)
|
||||||
return StringRef();
|
return StringRef();
|
||||||
if (isLexicalBlock())
|
if (isLexicalBlock())
|
||||||
return DILexicalBlock(DbgNode).getDirectory();
|
return DILexicalBlock(DbgNode).getDirectory();
|
||||||
if (isSubprogram())
|
if (isSubprogram())
|
||||||
return DISubprogram(DbgNode).getDirectory();
|
return DISubprogram(DbgNode).getDirectory();
|
||||||
@ -978,8 +979,8 @@ DISubprogram DIFactory::CreateSubprogram(DIDescriptor Context,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// CreateSubprogramDefinition - Create new subprogram descriptor for the
|
/// CreateSubprogramDefinition - Create new subprogram descriptor for the
|
||||||
/// given declaration.
|
/// given declaration.
|
||||||
DISubprogram DIFactory::CreateSubprogramDefinition(DISubprogram &SPDeclaration) {
|
DISubprogram DIFactory::CreateSubprogramDefinition(DISubprogram &SPDeclaration){
|
||||||
if (SPDeclaration.isDefinition())
|
if (SPDeclaration.isDefinition())
|
||||||
return DISubprogram(SPDeclaration);
|
return DISubprogram(SPDeclaration);
|
||||||
|
|
||||||
@ -1087,7 +1088,7 @@ DIVariable DIFactory::CreateComplexVariable(unsigned Tag, DIDescriptor Context,
|
|||||||
const std::string &Name,
|
const std::string &Name,
|
||||||
DIFile F,
|
DIFile F,
|
||||||
unsigned LineNo,
|
unsigned LineNo,
|
||||||
DIType Ty,
|
DIType Ty,
|
||||||
SmallVector<Value *, 9> &addr) {
|
SmallVector<Value *, 9> &addr) {
|
||||||
SmallVector<Value *, 9> Elts;
|
SmallVector<Value *, 9> Elts;
|
||||||
Elts.push_back(GetTagConstant(Tag));
|
Elts.push_back(GetTagConstant(Tag));
|
||||||
@ -1177,7 +1178,7 @@ Instruction *DIFactory::InsertDeclare(Value *Storage, DIVariable D,
|
|||||||
|
|
||||||
// If this block already has a terminator then insert this intrinsic
|
// If this block already has a terminator then insert this intrinsic
|
||||||
// before the terminator.
|
// before the terminator.
|
||||||
if (TerminatorInst *T = InsertAtEnd->getTerminator())
|
if (TerminatorInst *T = InsertAtEnd->getTerminator())
|
||||||
return CallInst::Create(DeclareFn, Args, Args+2, "", T);
|
return CallInst::Create(DeclareFn, Args, Args+2, "", T);
|
||||||
else
|
else
|
||||||
return CallInst::Create(DeclareFn, Args, Args+2, "", InsertAtEnd);}
|
return CallInst::Create(DeclareFn, Args, Args+2, "", InsertAtEnd);}
|
||||||
@ -1206,7 +1207,7 @@ Instruction *DIFactory::InsertDbgValueIntrinsic(Value *V, uint64_t Offset,
|
|||||||
if (!ValueFn)
|
if (!ValueFn)
|
||||||
ValueFn = Intrinsic::getDeclaration(&M, Intrinsic::dbg_value);
|
ValueFn = Intrinsic::getDeclaration(&M, Intrinsic::dbg_value);
|
||||||
|
|
||||||
Value *Args[] = { MDNode::get(V->getContext(), &V, 1),
|
Value *Args[] = { MDNode::get(V->getContext(), &V, 1),
|
||||||
ConstantInt::get(Type::getInt64Ty(V->getContext()), Offset),
|
ConstantInt::get(Type::getInt64Ty(V->getContext()), Offset),
|
||||||
D };
|
D };
|
||||||
return CallInst::Create(ValueFn, Args, Args+3, "", InsertAtEnd);
|
return CallInst::Create(ValueFn, Args, Args+3, "", InsertAtEnd);
|
||||||
@ -1224,21 +1225,21 @@ void DebugInfoFinder::processModule(Module &M) {
|
|||||||
++BI) {
|
++BI) {
|
||||||
if (DbgDeclareInst *DDI = dyn_cast<DbgDeclareInst>(BI))
|
if (DbgDeclareInst *DDI = dyn_cast<DbgDeclareInst>(BI))
|
||||||
processDeclare(DDI);
|
processDeclare(DDI);
|
||||||
|
|
||||||
DebugLoc Loc = BI->getDebugLoc();
|
DebugLoc Loc = BI->getDebugLoc();
|
||||||
if (Loc.isUnknown())
|
if (Loc.isUnknown())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
LLVMContext &Ctx = BI->getContext();
|
LLVMContext &Ctx = BI->getContext();
|
||||||
DIDescriptor Scope(Loc.getScope(Ctx));
|
DIDescriptor Scope(Loc.getScope(Ctx));
|
||||||
|
|
||||||
if (Scope.isCompileUnit())
|
if (Scope.isCompileUnit())
|
||||||
addCompileUnit(DICompileUnit(Scope));
|
addCompileUnit(DICompileUnit(Scope));
|
||||||
else if (Scope.isSubprogram())
|
else if (Scope.isSubprogram())
|
||||||
processSubprogram(DISubprogram(Scope));
|
processSubprogram(DISubprogram(Scope));
|
||||||
else if (Scope.isLexicalBlock())
|
else if (Scope.isLexicalBlock())
|
||||||
processLexicalBlock(DILexicalBlock(Scope));
|
processLexicalBlock(DILexicalBlock(Scope));
|
||||||
|
|
||||||
if (MDNode *IA = Loc.getInlinedAt(Ctx))
|
if (MDNode *IA = Loc.getInlinedAt(Ctx))
|
||||||
processLocation(DILocation(IA));
|
processLocation(DILocation(IA));
|
||||||
}
|
}
|
||||||
@ -1396,16 +1397,16 @@ static Value *findDbgGlobalDeclare(GlobalVariable *V) {
|
|||||||
/// It looks through pointer casts too.
|
/// It looks through pointer casts too.
|
||||||
static const DbgDeclareInst *findDbgDeclare(const Value *V) {
|
static const DbgDeclareInst *findDbgDeclare(const Value *V) {
|
||||||
V = V->stripPointerCasts();
|
V = V->stripPointerCasts();
|
||||||
|
|
||||||
if (!isa<Instruction>(V) && !isa<Argument>(V))
|
if (!isa<Instruction>(V) && !isa<Argument>(V))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
const Function *F = NULL;
|
const Function *F = NULL;
|
||||||
if (const Instruction *I = dyn_cast<Instruction>(V))
|
if (const Instruction *I = dyn_cast<Instruction>(V))
|
||||||
F = I->getParent()->getParent();
|
F = I->getParent()->getParent();
|
||||||
else if (const Argument *A = dyn_cast<Argument>(V))
|
else if (const Argument *A = dyn_cast<Argument>(V))
|
||||||
F = A->getParent();
|
F = A->getParent();
|
||||||
|
|
||||||
for (Function::const_iterator FI = F->begin(), FE = F->end(); FI != FE; ++FI)
|
for (Function::const_iterator FI = F->begin(), FE = F->end(); FI != FE; ++FI)
|
||||||
for (BasicBlock::const_iterator BI = (*FI).begin(), BE = (*FI).end();
|
for (BasicBlock::const_iterator BI = (*FI).begin(), BE = (*FI).end();
|
||||||
BI != BE; ++BI)
|
BI != BE; ++BI)
|
||||||
@ -1463,10 +1464,10 @@ DISubprogram llvm::getDISubprogram(const MDNode *Scope) {
|
|||||||
DIDescriptor D(Scope);
|
DIDescriptor D(Scope);
|
||||||
if (D.isSubprogram())
|
if (D.isSubprogram())
|
||||||
return DISubprogram(Scope);
|
return DISubprogram(Scope);
|
||||||
|
|
||||||
if (D.isLexicalBlock())
|
if (D.isLexicalBlock())
|
||||||
return getDISubprogram(DILexicalBlock(Scope).getContext());
|
return getDISubprogram(DILexicalBlock(Scope).getContext());
|
||||||
|
|
||||||
return DISubprogram();
|
return DISubprogram();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1474,9 +1475,9 @@ DISubprogram llvm::getDISubprogram(const MDNode *Scope) {
|
|||||||
DICompositeType llvm::getDICompositeType(DIType T) {
|
DICompositeType llvm::getDICompositeType(DIType T) {
|
||||||
if (T.isCompositeType())
|
if (T.isCompositeType())
|
||||||
return DICompositeType(T);
|
return DICompositeType(T);
|
||||||
|
|
||||||
if (T.isDerivedType())
|
if (T.isDerivedType())
|
||||||
return getDICompositeType(DIDerivedType(T).getTypeDerivedFrom());
|
return getDICompositeType(DIDerivedType(T).getTypeDerivedFrom());
|
||||||
|
|
||||||
return DICompositeType();
|
return DICompositeType();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user