Pool allocate SDDbgValue nodes.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@99836 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Evan Cheng 2010-03-29 20:48:30 +00:00
parent 545d3b18d5
commit 31441b7e95
3 changed files with 39 additions and 11 deletions

View File

@ -34,6 +34,7 @@ class FunctionLoweringInfo;
class MachineConstantPoolValue; class MachineConstantPoolValue;
class MachineFunction; class MachineFunction;
class MachineModuleInfo; class MachineModuleInfo;
class MDNode;
class SDNodeOrdering; class SDNodeOrdering;
class SDDbgValue; class SDDbgValue;
class TargetLowering; class TargetLowering;
@ -767,6 +768,15 @@ public:
SDNode *getNodeIfExists(unsigned Opcode, SDVTList VTs, SDNode *getNodeIfExists(unsigned Opcode, SDVTList VTs,
const SDValue *Ops, unsigned NumOps); const SDValue *Ops, unsigned NumOps);
/// getDbgValue - Creates a SDDbgValue node.
///
SDDbgValue *getDbgValue(MDNode *MDPtr, SDNode *N, unsigned R, uint64_t Off,
DebugLoc DL, unsigned O);
SDDbgValue *getDbgValue(MDNode *MDPtr, Value *C, uint64_t Off,
DebugLoc DL, unsigned O);
SDDbgValue *getDbgValue(MDNode *MDPtr, unsigned FI, uint64_t Off,
DebugLoc DL, unsigned O);
/// DAGUpdateListener - Clients of various APIs that cause global effects on /// DAGUpdateListener - Clients of various APIs that cause global effects on
/// the DAG can optionally implement this interface. This allows the clients /// the DAG can optionally implement this interface. This allows the clients
/// to handle the various sorts of updates that happen. /// to handle the various sorts of updates that happen.

View File

@ -842,6 +842,7 @@ void SelectionDAG::clear() {
Root = getEntryNode(); Root = getEntryNode();
delete Ordering; delete Ordering;
Ordering = new SDNodeOrdering(); Ordering = new SDNodeOrdering();
DbgInfo->clear();
delete DbgInfo; delete DbgInfo;
DbgInfo = new SDDbgInfo(); DbgInfo = new SDDbgInfo();
} }
@ -4849,6 +4850,26 @@ SDNode *SelectionDAG::getNodeIfExists(unsigned Opcode, SDVTList VTList,
return NULL; return NULL;
} }
/// getDbgValue - Creates a SDDbgValue node.
///
SDDbgValue *
SelectionDAG::getDbgValue(MDNode *MDPtr, SDNode *N, unsigned R, uint64_t Off,
DebugLoc DL, unsigned O) {
return new (Allocator) SDDbgValue(MDPtr, N, R, Off, DL, O);
}
SDDbgValue *
SelectionDAG::getDbgValue(MDNode *MDPtr, Value *C, uint64_t Off,
DebugLoc DL, unsigned O) {
return new (Allocator) SDDbgValue(MDPtr, C, Off, DL, O);
}
SDDbgValue *
SelectionDAG::getDbgValue(MDNode *MDPtr, unsigned FI, uint64_t Off,
DebugLoc DL, unsigned O) {
return new (Allocator) SDDbgValue(MDPtr, FI, Off, DL, O);
}
namespace { namespace {
/// RAUWUpdateListener - Helper for ReplaceAllUsesWith - When the node /// RAUWUpdateListener - Helper for ReplaceAllUsesWith - When the node

View File

@ -3824,22 +3824,19 @@ SelectionDAGBuilder::visitIntrinsicCall(CallInst &I, unsigned Intrinsic) {
// debug info exists. // debug info exists.
++SDNodeOrder; ++SDNodeOrder;
if (isa<ConstantInt>(V) || isa<ConstantFP>(V)) { if (isa<ConstantInt>(V) || isa<ConstantFP>(V)) {
SDDbgValue* dv = new SDDbgValue(Variable, V, Offset, dl, SDNodeOrder); DAG.AddDbgValue(DAG.getDbgValue(Variable, V, Offset, dl, SDNodeOrder));
DAG.AddDbgValue(dv);
} else { } else {
SDValue &N = NodeMap[V]; SDValue &N = NodeMap[V];
if (N.getNode()) { if (N.getNode())
SDDbgValue *dv = new SDDbgValue(Variable, N.getNode(), DAG.AddDbgValue(DAG.getDbgValue(Variable, N.getNode(),
N.getResNo(), Offset, dl, SDNodeOrder); N.getResNo(), Offset, dl, SDNodeOrder),
DAG.AddDbgValue(dv, N.getNode()); N.getNode());
} else { else
// We may expand this to cover more cases. One case where we have no // We may expand this to cover more cases. One case where we have no
// data available is an unreferenced parameter; we need this fallback. // data available is an unreferenced parameter; we need this fallback.
SDDbgValue* dv = new SDDbgValue(Variable, DAG.AddDbgValue(DAG.getDbgValue(Variable,
UndefValue::get(V->getType()), UndefValue::get(V->getType()),
Offset, dl, SDNodeOrder); Offset, dl, SDNodeOrder));
DAG.AddDbgValue(dv);
}
} }
// Build a debug info table entry. // Build a debug info table entry.