mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-08-10 02:25:47 +00:00
Add debug output
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2066 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -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,
|
DSNode *GraphNode,
|
||||||
map<DSNode*, Value*> &PoolDescriptors) {
|
map<DSNode*, Value*> &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.
|
// 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
|
// 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) {
|
I != E; ++I) {
|
||||||
TFI.ArgInfo.push_back(CallArgInfo(Arg, *I, PoolDescriptors[*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...
|
// Check to see if the scalar _IS_ a call...
|
||||||
if (CallInst *CI = dyn_cast<CallInst>(ScalarVal))
|
if (CallInst *CI = dyn_cast<CallInst>(ScalarVal))
|
||||||
// If so, add information about the pool it will be returning...
|
// 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...
|
// Check to see if the scalar is an operand to a call...
|
||||||
for (Value::use_iterator UI = ScalarVal->use_begin(),
|
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.
|
// than once! It will get multiple entries for the first pointer.
|
||||||
|
|
||||||
// Add the operand number and pool handle to the call table...
|
// 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);
|
PoolDescriptors);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -636,6 +637,13 @@ void PoolAllocate::transformFunction(TransformFunctionInfo &TFI,
|
|||||||
FunctionDSGraph &CallerIPGraph) {
|
FunctionDSGraph &CallerIPGraph) {
|
||||||
if (getTransformedFunction(TFI)) return; // Function xformation already done?
|
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();
|
const FunctionType *OldFuncType = TFI.Func->getFunctionType();
|
||||||
|
|
||||||
assert(!OldFuncType->isVarArg() && "Vararg functions not handled yet!");
|
assert(!OldFuncType->isVarArg() && "Vararg functions not handled yet!");
|
||||||
|
Reference in New Issue
Block a user