From 9acfbeeaa8c71badd51d06959c082f377176a620 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Sun, 31 Mar 2002 07:17:46 +0000 Subject: [PATCH] Add debug output git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2066 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Transforms/IPO/OldPoolAllocate.cpp | 30 ++++++++++++++++---------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/lib/Transforms/IPO/OldPoolAllocate.cpp b/lib/Transforms/IPO/OldPoolAllocate.cpp index 7457ae93e1e..f7437db81e3 100644 --- a/lib/Transforms/IPO/OldPoolAllocate.cpp +++ b/lib/Transforms/IPO/OldPoolAllocate.cpp @@ -388,9 +388,18 @@ public: }; -static void addCallInfo(TransformFunctionInfo &TFI, CallInst *CI, int Arg, +static void addCallInfo(DataStructure *DS, + TransformFunctionInfo &TFI, CallInst *CI, int Arg, DSNode *GraphNode, map &PoolDescriptors) { + assert(CI->getCalledFunction() && "Cannot handle indirect calls yet!"); + assert(TFI.Func == 0 || TFI.Func == CI->getCalledFunction() && + "Function call record should always call the same function!"); + assert(TFI.Call == 0 || TFI.Call == CI && + "Call element already filled in with different value!"); + TFI.Func = CI->getCalledFunction(); + TFI.Call = CI; + //FunctionDSGraph &CalledGraph = DS->getClosedDSGraph(TFI.Func); // For now, add the entire graph that is pointed to by the call argument. // This graph can and should be pruned to only what the function itself will @@ -401,14 +410,6 @@ static void addCallInfo(TransformFunctionInfo &TFI, CallInst *CI, int Arg, I != E; ++I) { TFI.ArgInfo.push_back(CallArgInfo(Arg, *I, PoolDescriptors[*I])); } - - assert(CI->getCalledFunction() && "Cannot handle indirect calls yet!"); - assert(TFI.Func == 0 || TFI.Func == CI->getCalledFunction() && - "Function call record should always call the same function!"); - assert(TFI.Call == 0 || TFI.Call == CI && - "Call element already filled in with different value!"); - TFI.Func = CI->getCalledFunction(); - TFI.Call = CI; } @@ -477,7 +478,7 @@ void PoolAllocate::transformFunctionBody(Function *F, FunctionDSGraph &IPFGraph, // Check to see if the scalar _IS_ a call... if (CallInst *CI = dyn_cast(ScalarVal)) // If so, add information about the pool it will be returning... - addCallInfo(CallMap[CI], CI, -1, Scalars[i].Node, PoolDescriptors); + addCallInfo(DS, CallMap[CI], CI, -1, Scalars[i].Node, PoolDescriptors); // Check to see if the scalar is an operand to a call... for (Value::use_iterator UI = ScalarVal->use_begin(), @@ -492,7 +493,7 @@ void PoolAllocate::transformFunctionBody(Function *F, FunctionDSGraph &IPFGraph, // than once! It will get multiple entries for the first pointer. // Add the operand number and pool handle to the call table... - addCallInfo(CallMap[CI], CI, OI-CI->op_begin()-1, Scalars[i].Node, + addCallInfo(DS, CallMap[CI], CI, OI-CI->op_begin()-1, Scalars[i].Node, PoolDescriptors); } } @@ -636,6 +637,13 @@ void PoolAllocate::transformFunction(TransformFunctionInfo &TFI, FunctionDSGraph &CallerIPGraph) { if (getTransformedFunction(TFI)) return; // Function xformation already done? + cerr << "**********\nEntering transformFunction for " + << TFI.Func->getName() << ":\n"; + for (unsigned i = 0, e = TFI.ArgInfo.size(); i != e; ++i) + cerr << " ArgInfo[" << i << "] = " << TFI.ArgInfo[i].ArgNo << "\n"; + cerr << "\n"; + + const FunctionType *OldFuncType = TFI.Func->getFunctionType(); assert(!OldFuncType->isVarArg() && "Vararg functions not handled yet!"); -- 2.34.1