mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-21 06:30:16 +00:00
Print profile info if exit() is called
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@1268 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
e240906471
commit
a95c69997f
@ -599,6 +599,34 @@ static void executeBinaryInst(BinaryOperator *I, ExecutionContext &SF) {
|
|||||||
// Terminator Instruction Implementations
|
// Terminator Instruction Implementations
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
|
static void PerformExitStuff() {
|
||||||
|
#ifdef PROFILE_STRUCTURE_FIELDS
|
||||||
|
// Print out structure field accounting information...
|
||||||
|
if (!FieldAccessCounts.empty()) {
|
||||||
|
CW << "Field Access Profile Information:\n";
|
||||||
|
map<const StructType *, vector<unsigned> >::iterator
|
||||||
|
I = FieldAccessCounts.begin(), E = FieldAccessCounts.end();
|
||||||
|
for (; I != E; ++I) {
|
||||||
|
vector<unsigned> &OfC = I->second;
|
||||||
|
CW << " '" << (Value*)I->first << "'\t- Sum=";
|
||||||
|
|
||||||
|
unsigned Sum = 0;
|
||||||
|
for (unsigned i = 0; i < OfC.size(); ++i)
|
||||||
|
Sum += OfC[i];
|
||||||
|
CW << Sum << " - ";
|
||||||
|
|
||||||
|
for (unsigned i = 0; i < OfC.size(); ++i) {
|
||||||
|
if (i) CW << ", ";
|
||||||
|
CW << OfC[i];
|
||||||
|
}
|
||||||
|
CW << endl;
|
||||||
|
}
|
||||||
|
CW << endl;
|
||||||
|
FieldAccessCounts.clear();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
void Interpreter::exitCalled(GenericValue GV) {
|
void Interpreter::exitCalled(GenericValue GV) {
|
||||||
cout << "Program returned ";
|
cout << "Program returned ";
|
||||||
print(Type::IntTy, GV);
|
print(Type::IntTy, GV);
|
||||||
@ -606,6 +634,7 @@ void Interpreter::exitCalled(GenericValue GV) {
|
|||||||
|
|
||||||
ExitCode = GV.SByteVal;
|
ExitCode = GV.SByteVal;
|
||||||
ECStack.clear();
|
ECStack.clear();
|
||||||
|
PerformExitStuff();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Interpreter::executeRetInst(ReturnInst *I, ExecutionContext &SF) {
|
void Interpreter::executeRetInst(ReturnInst *I, ExecutionContext &SF) {
|
||||||
@ -637,32 +666,7 @@ void Interpreter::executeRetInst(ReturnInst *I, ExecutionContext &SF) {
|
|||||||
ExitCode = 0;
|
ExitCode = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef PROFILE_STRUCTURE_FIELDS
|
PerformExitStuff();
|
||||||
// Print out structure field accounting information...
|
|
||||||
if (!FieldAccessCounts.empty()) {
|
|
||||||
CW << "Field Access Profile Information:\n";
|
|
||||||
map<const StructType *, vector<unsigned> >::iterator
|
|
||||||
I = FieldAccessCounts.begin(), E = FieldAccessCounts.end();
|
|
||||||
for (; I != E; ++I) {
|
|
||||||
vector<unsigned> &OfC = I->second;
|
|
||||||
CW << " '" << (Value*)I->first << "'\t- Sum=";
|
|
||||||
|
|
||||||
unsigned Sum = 0;
|
|
||||||
for (unsigned i = 0; i < OfC.size(); ++i)
|
|
||||||
Sum += OfC[i];
|
|
||||||
CW << Sum << " - ";
|
|
||||||
|
|
||||||
for (unsigned i = 0; i < OfC.size(); ++i) {
|
|
||||||
if (i) CW << ", ";
|
|
||||||
CW << OfC[i];
|
|
||||||
}
|
|
||||||
CW << endl;
|
|
||||||
}
|
|
||||||
CW << endl;
|
|
||||||
FieldAccessCounts.clear();
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user