summaryrefslogtreecommitdiffstats
path: root/llvm/lib/ExecutionEngine/Interpreter
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2001-11-12 16:28:48 +0000
committerChris Lattner <sabre@nondot.org>2001-11-12 16:28:48 +0000
commita7482e05d0187016b83c6ba221216810ef102c61 (patch)
tree58e2b0c72b9be9772431931144d5c08726d6da80 /llvm/lib/ExecutionEngine/Interpreter
parente32deb455b089e7ffc20828eff058cc99f9d2bf6 (diff)
downloadbcm5719-llvm-a7482e05d0187016b83c6ba221216810ef102c61.tar.gz
bcm5719-llvm-a7482e05d0187016b83c6ba221216810ef102c61.zip
Print profile info if exit() is called
llvm-svn: 1268
Diffstat (limited to 'llvm/lib/ExecutionEngine/Interpreter')
-rw-r--r--llvm/lib/ExecutionEngine/Interpreter/Execution.cpp56
1 files changed, 30 insertions, 26 deletions
diff --git a/llvm/lib/ExecutionEngine/Interpreter/Execution.cpp b/llvm/lib/ExecutionEngine/Interpreter/Execution.cpp
index c19d15cff42..5c763d79fbd 100644
--- a/llvm/lib/ExecutionEngine/Interpreter/Execution.cpp
+++ b/llvm/lib/ExecutionEngine/Interpreter/Execution.cpp
@@ -599,6 +599,34 @@ static void executeBinaryInst(BinaryOperator *I, ExecutionContext &SF) {
// 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) {
cout << "Program returned ";
print(Type::IntTy, GV);
@@ -606,6 +634,7 @@ void Interpreter::exitCalled(GenericValue GV) {
ExitCode = GV.SByteVal;
ECStack.clear();
+ PerformExitStuff();
}
void Interpreter::executeRetInst(ReturnInst *I, ExecutionContext &SF) {
@@ -637,32 +666,7 @@ void Interpreter::executeRetInst(ReturnInst *I, ExecutionContext &SF) {
ExitCode = 0;
}
-#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
-
+ PerformExitStuff();
return;
}
OpenPOWER on IntegriCloud