1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-25 04:02:41 +01:00

Remove dead code

llvm-svn: 4467
This commit is contained in:
Chris Lattner 2002-10-31 06:52:26 +00:00
parent cd6a3b2f2c
commit 07c1f70586

View File

@ -116,7 +116,7 @@ namespace {
DSNodeHandle &getValueNode(Value &V); DSNodeHandle &getValueNode(Value &V);
/// getValueDest - Return the DSNode that the actual value points to. This /// getValueDest - Return the DSNode that the actual value points to. This
/// is basically the same thing as: getLink(getValueNode(V), 0) /// is the same thing as: getLink(getValueNode(V))
/// ///
DSNodeHandle &getValueDest(Value &V); DSNodeHandle &getValueDest(Value &V);
@ -127,12 +127,9 @@ namespace {
/// getLink - This method is used to return the specified link in the /// getLink - This method is used to return the specified link in the
/// specified node if one exists. If a link does not already exist (it's /// specified node if one exists. If a link does not already exist (it's
/// null), then we create a new node, link it, then return it. We must /// null), then we create a new node, link it, then return it.
/// specify the type of the Node field we are accessing so that we know what
/// type should be linked to if we need to create a new node.
/// ///
DSNodeHandle &getLink(const DSNodeHandle &Node, unsigned Link, DSNodeHandle &getLink(const DSNodeHandle &Node, unsigned Link = 0);
const Type *FieldTy);
}; };
} }
@ -218,11 +215,11 @@ DSNodeHandle &GraphBuilder::getValueNode(Value &V) {
} }
} }
/// getValueDest - Return the DSNode that the actual value points to. This /// getValueDest - Return the DSNode that the actual value points to. This is
/// is basically the same thing as: getLink(getValueNode(V), 0) /// the same thing as: getLink(getValueNode(V), 0)
/// ///
DSNodeHandle &GraphBuilder::getValueDest(Value &V) { DSNodeHandle &GraphBuilder::getValueDest(Value &V) {
return getLink(getValueNode(V), 0, V.getType()); return getLink(getValueNode(V));
} }
@ -232,24 +229,11 @@ DSNodeHandle &GraphBuilder::getValueDest(Value &V) {
/// specify the type of the Node field we are accessing so that we know what /// specify the type of the Node field we are accessing so that we know what
/// type should be linked to if we need to create a new node. /// type should be linked to if we need to create a new node.
/// ///
DSNodeHandle &GraphBuilder::getLink(const DSNodeHandle &node, DSNodeHandle &GraphBuilder::getLink(const DSNodeHandle &node, unsigned LinkNo) {
unsigned LinkNo,
const Type *FieldTy // FIXME: eliminate
) {
DSNodeHandle &Node = const_cast<DSNodeHandle&>(node); DSNodeHandle &Node = const_cast<DSNodeHandle&>(node);
DSNodeHandle *Link = Node.getLink(LinkNo); DSNodeHandle *Link = Node.getLink(LinkNo);
if (Link) return *Link; if (Link) return *Link;
#if 0 // FIXME: delete
// If we are indexing with a typed pointer, then the thing we are pointing
// to is of the pointed type. If we are pointing to it with an integer
// (because of cast to an integer), we represent it with a void type.
//
const Type *ReqTy = 0;
if (const PointerType *Ptr = dyn_cast<PointerType>(FieldTy))
ReqTy = Ptr->getElementType();
#endif
// If the link hasn't been created yet, make and return a new shadow node // If the link hasn't been created yet, make and return a new shadow node
DSNode *N = createNode(DSNode::ShadowNode, 0); DSNode *N = createNode(DSNode::ShadowNode, 0);
Node.setLink(LinkNo, N); Node.setLink(LinkNo, N);
@ -373,7 +357,7 @@ void GraphBuilder::visitLoadInst(LoadInst &LI) {
Ptr.getNode()->getTypeRec(LI.getType(), Ptr.getOffset()); Ptr.getNode()->getTypeRec(LI.getType(), Ptr.getOffset());
if (isPointerType(LI.getType())) if (isPointerType(LI.getType()))
getValueNode(LI).addEdgeTo(getLink(Ptr, 0, LI.getType())); getValueNode(LI).addEdgeTo(getLink(Ptr));
} }
void GraphBuilder::visitStoreInst(StoreInst &SI) { void GraphBuilder::visitStoreInst(StoreInst &SI) {
@ -404,15 +388,14 @@ void GraphBuilder::visitCallInst(CallInst &CI) {
// Set up the return value... // Set up the return value...
DSNodeHandle RetVal; DSNodeHandle RetVal;
if (isPointerType(CI.getType())) if (isPointerType(CI.getType()))
RetVal = getLink(getValueNode(CI), 0, CI.getType()); RetVal = getLink(getValueNode(CI));
DSNodeHandle Callee; DSNodeHandle Callee;
// Special case for a direct call, avoid creating spurious scalar node... // Special case for a direct call, avoid creating spurious scalar node...
if (GlobalValue *GV = dyn_cast<GlobalValue>(CI.getOperand(0))) if (GlobalValue *GV = dyn_cast<GlobalValue>(CI.getOperand(0)))
Callee = getGlobalNode(*GV); Callee = getGlobalNode(*GV);
else else
Callee = getLink(getValueNode(*CI.getOperand(0)), 0, Callee = getLink(getValueNode(*CI.getOperand(0)));
CI.getOperand(0)->getType());
std::vector<DSNodeHandle> Args; std::vector<DSNodeHandle> Args;
Args.reserve(CI.getNumOperands()-1); Args.reserve(CI.getNumOperands()-1);
@ -420,8 +403,7 @@ void GraphBuilder::visitCallInst(CallInst &CI) {
// Calculate the arguments vector... // Calculate the arguments vector...
for (unsigned i = 1, e = CI.getNumOperands(); i != e; ++i) for (unsigned i = 1, e = CI.getNumOperands(); i != e; ++i)
if (isPointerType(CI.getOperand(i)->getType())) if (isPointerType(CI.getOperand(i)->getType()))
Args.push_back(getLink(getValueNode(*CI.getOperand(i)), 0, Args.push_back(getLink(getValueNode(*CI.getOperand(i))));
CI.getOperand(i)->getType()));
// Add a new function call entry... // Add a new function call entry...
FunctionCalls.push_back(DSCallSite(CI, RetVal, Callee, Args)); FunctionCalls.push_back(DSCallSite(CI, RetVal, Callee, Args));
@ -430,8 +412,7 @@ void GraphBuilder::visitCallInst(CallInst &CI) {
/// Handle casts... /// Handle casts...
void GraphBuilder::visitCastInst(CastInst &CI) { void GraphBuilder::visitCastInst(CastInst &CI) {
if (isPointerType(CI.getType()) && isPointerType(CI.getOperand(0)->getType())) if (isPointerType(CI.getType()) && isPointerType(CI.getOperand(0)->getType()))
getValueNode(CI).addEdgeTo(getLink(getValueNode(*CI.getOperand(0)), 0, getValueNode(CI).addEdgeTo(getLink(getValueNode(*CI.getOperand(0))));
CI.getOperand(0)->getType()));
} }