[llvm-commits] CVS: llvm/lib/Reoptimizer/Trigger/Trigger.cpp
Anand Shukla
ashukla at cs.uiuc.edu
Tue Oct 15 17:15:00 PDT 2002
Changes in directory llvm/lib/Reoptimizer/Trigger:
Trigger.cpp updated: 1.13 -> 1.14
---
Log message:
Added defn for llvm_reopt
---
Diffs of the changes:
Index: llvm/lib/Reoptimizer/Trigger/Trigger.cpp
diff -u llvm/lib/Reoptimizer/Trigger/Trigger.cpp:1.13 llvm/lib/Reoptimizer/Trigger/Trigger.cpp:1.14
--- llvm/lib/Reoptimizer/Trigger/Trigger.cpp:1.13 Tue Oct 8 11:29:48 2002
+++ llvm/lib/Reoptimizer/Trigger/Trigger.cpp Tue Oct 15 17:14:28 2002
@@ -29,9 +29,12 @@
extern const unsigned char LLVMBytecode[];
extern void** llvmFunctionTable[];
+int reopt_threshold;
+
#ifdef GET_TRACE_TIME
static struct timeval llvm_trace_time;
+static struct timeval llvm_trigger_time;
extern "C" void llvm_time_start(){
gettimeofday(&llvm_trace_time, (void *)0);
@@ -48,6 +51,23 @@
f_out<<time<<"\n";
}
+
+void llvm_trigger_time_start(){
+ gettimeofday(&llvm_trigger_time, (void *)0);
+}
+
+void llvm_trigger_time_end(){
+ static std::ofstream f_out("llvm_trigger_last_run");
+
+ struct timeval time_end;
+ gettimeofday(&time_end, (void *)0);
+
+ long time = (time_end.tv_sec - llvm_trigger_time.tv_sec)*1000000 +
+ (time_end.tv_usec - llvm_trigger_time.tv_usec);
+
+ f_out<<time<<"\n";
+}
+
#endif
@@ -91,7 +111,9 @@
//intialize counter!
cnt[pn]=0;
-
+#ifdef GET_TRACE_TIME
+ llvm_trigger_time_start();
+#endif
if(!initialized){
//BytecodeParser Parser;
@@ -127,6 +149,9 @@
if(vBB[0] == &funcList[mn]->front() ||
isa<ReturnInst>(vBB[vBB.size()-1]->getTerminator())){
//std::cerr<<"Found a path starting with root!\n";
+#ifdef GET_TRACE_TIME
+ llvm_trigger_time_end();
+#endif
return;
}
@@ -136,13 +161,19 @@
if(Bcheck->isConditional()){
if((vBB[0] != Bcheck->getSuccessor(0)) &&
(vBB[0] != Bcheck->getSuccessor(1))){
- std::cerr<<"Not a loop!\n";
+ std::cerr<<"llvm:: Not a loop!\n";
+#ifdef GET_TRACE_TIME
+ llvm_trigger_time_end();
+#endif
return;
}
}
else{
if(vBB[0] != Bcheck->getSuccessor(0)){
- std::cerr<<"Not a loop!\n";
+ std::cerr<<"llvm:: Not a loop!\n";
+#ifdef GET_TRACE_TIME
+ llvm_trigger_time_end();
+#endif
return;
}
}
@@ -158,11 +189,14 @@
//return if SAME trace already there!
if(tr->hasTraceAddr(startAddr) && tr->hasTraceId(pn)){
std::cerr<<"Trace exists!!!\n";
+#ifdef GET_TRACE_TIME
+ llvm_trigger_time_end();
+#endif
return;
}
if(tr->hasTraceAddr(startAddr)){
- std::cerr<<"Removing old trace!\n";
+ std::cerr<<"llvm:: Removing old trace!\n";
tr->removeTrace(startAddr);
}
@@ -228,7 +262,7 @@
//then read until last 4
int skipIndex = (isCondBranch ? 4:2);
- std::cerr<<"From->to\t"<<(void *)bbInst.first<<"->"<<(void *)(bbInst.second-4*skipIndex)<<"\n";
+ std::cerr<<"llvm:: From->to\t"<<(void *)bbInst.first<<"->"<<(void *)(bbInst.second-4*skipIndex)<<"\n";
for(uint64_t addr = bbInst.first, endAddr = bbInst.second;
addr<=endAddr-4*skipIndex; addr+=4, instIndex++){
@@ -433,6 +467,10 @@
//Now add trace to cache, and we are all set!
if(!tr->addTrace(startAddr, trace, pn, callMap, branchMap))
std::cerr<<"^^^^^^^^^^************** Trace could not be added!!!\n";
+
+#ifdef GET_TRACE_TIME
+ llvm_trigger_time_end();
+#endif
}
More information about the llvm-commits
mailing list