mirror of
https://github.com/RPCSX/llvm.git
synced 2024-11-28 22:20:37 +00:00
If location info is attached with an instruction then keep track of alloca slots used by a variable. This info will be used by AsmPrinter to emit debug info for variables.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83189 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
b0fdedb3fd
commit
75549f4444
@ -48,6 +48,7 @@ namespace llvm {
|
|||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
// Forward declarations.
|
// Forward declarations.
|
||||||
class Constant;
|
class Constant;
|
||||||
|
class MDNode;
|
||||||
class GlobalVariable;
|
class GlobalVariable;
|
||||||
class MachineBasicBlock;
|
class MachineBasicBlock;
|
||||||
class MachineFunction;
|
class MachineFunction;
|
||||||
@ -142,9 +143,13 @@ class MachineModuleInfo : public ImmutablePass {
|
|||||||
/// DbgInfoAvailable - True if debugging information is available
|
/// DbgInfoAvailable - True if debugging information is available
|
||||||
/// in this module.
|
/// in this module.
|
||||||
bool DbgInfoAvailable;
|
bool DbgInfoAvailable;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static char ID; // Pass identification, replacement for typeid
|
static char ID; // Pass identification, replacement for typeid
|
||||||
|
|
||||||
|
typedef DenseMap<MDNode *, std::pair<MDNode *, unsigned> > VariableDbgInfoMapTy;
|
||||||
|
VariableDbgInfoMapTy VariableDbgInfo;
|
||||||
|
|
||||||
MachineModuleInfo();
|
MachineModuleInfo();
|
||||||
~MachineModuleInfo();
|
~MachineModuleInfo();
|
||||||
|
|
||||||
@ -325,6 +330,15 @@ public:
|
|||||||
/// of one is required to emit exception handling info.
|
/// of one is required to emit exception handling info.
|
||||||
Function *getPersonality() const;
|
Function *getPersonality() const;
|
||||||
|
|
||||||
|
/// setVariableDbgInfo - Collect information used to emit debugging information
|
||||||
|
/// of a variable.
|
||||||
|
void setVariableDbgInfo(MDNode *N, MDNode *L, unsigned S) {
|
||||||
|
if (N && L)
|
||||||
|
VariableDbgInfo[N] = std::make_pair(L, S);
|
||||||
|
}
|
||||||
|
|
||||||
|
VariableDbgInfoMapTy &getVariableDbgInfo() { return VariableDbgInfo; }
|
||||||
|
|
||||||
}; // End class MachineModuleInfo
|
}; // End class MachineModuleInfo
|
||||||
|
|
||||||
} // End llvm namespace
|
} // End llvm namespace
|
||||||
|
@ -407,7 +407,6 @@ bool FastISel::SelectCall(User *I) {
|
|||||||
|| !DW->ShouldEmitDwarfDebug())
|
|| !DW->ShouldEmitDwarfDebug())
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
Value *Variable = DI->getVariable();
|
|
||||||
Value *Address = DI->getAddress();
|
Value *Address = DI->getAddress();
|
||||||
if (BitCastInst *BCI = dyn_cast<BitCastInst>(Address))
|
if (BitCastInst *BCI = dyn_cast<BitCastInst>(Address))
|
||||||
Address = BCI->getOperand(0);
|
Address = BCI->getOperand(0);
|
||||||
@ -418,8 +417,15 @@ bool FastISel::SelectCall(User *I) {
|
|||||||
StaticAllocaMap.find(AI);
|
StaticAllocaMap.find(AI);
|
||||||
if (SI == StaticAllocaMap.end()) break; // VLAs.
|
if (SI == StaticAllocaMap.end()) break; // VLAs.
|
||||||
int FI = SI->second;
|
int FI = SI->second;
|
||||||
|
if (MMI) {
|
||||||
DW->RecordVariable(cast<MDNode>(Variable), FI);
|
MetadataContext &TheMetadata = AI->getContext().getMetadata();
|
||||||
|
unsigned MDDbgKind = TheMetadata.getMDKind("dbg");
|
||||||
|
MDNode *AllocaLocation =
|
||||||
|
dyn_cast_or_null<MDNode>(TheMetadata.getMD(MDDbgKind, AI));
|
||||||
|
if (AllocaLocation)
|
||||||
|
MMI->setVariableDbgInfo(DI->getVariable(), AllocaLocation, FI);
|
||||||
|
}
|
||||||
|
DW->RecordVariable(DI->getVariable(), FI);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
case Intrinsic::eh_exception: {
|
case Intrinsic::eh_exception: {
|
||||||
|
Loading…
Reference in New Issue
Block a user