[llvm-commits] CVS: reopt/lib/LightWtProfiling/ReoptimizerInternal.h FirstTrigger.cpp Initialization.cpp RuntimeOptimizations.cpp SLI.cpp SecondTrigger.cpp UnpackTraceFunction.cpp scheduler.cpp GetTimer.h Globals.h SLI.h SecondTrigger.h scheduler.h

Brian Gaeke gaeke at cs.uiuc.edu
Wed Jan 14 16:53:01 PST 2004


Changes in directory reopt/lib/LightWtProfiling:

ReoptimizerInternal.h added (r1.1)
FirstTrigger.cpp updated: 1.16 -> 1.17
Initialization.cpp updated: 1.12 -> 1.13
RuntimeOptimizations.cpp updated: 1.15 -> 1.16
SLI.cpp updated: 1.11 -> 1.12
SecondTrigger.cpp updated: 1.24 -> 1.25
UnpackTraceFunction.cpp updated: 1.24 -> 1.25
scheduler.cpp updated: 1.6 -> 1.7
GetTimer.h (r1.9) removed
Globals.h (r1.8) removed
SLI.h (r1.2) removed
SecondTrigger.h (r1.4) removed
scheduler.h (r1.3) removed

---
Log message:

Consolidate GetTimer.h, Globals.h, SLI.h, SecondTrigger.h, and scheduler.h
into ReoptimizerInternal.h, along with a few other external declarations.
Sort #includes and remove unnecessary ones.


---
Diffs of the changes:  (+173 -40)

Index: reopt/lib/LightWtProfiling/ReoptimizerInternal.h
diff -c /dev/null reopt/lib/LightWtProfiling/ReoptimizerInternal.h:1.1
*** /dev/null	Wed Jan 14 16:52:10 2004
--- reopt/lib/LightWtProfiling/ReoptimizerInternal.h	Wed Jan 14 16:51:57 2004
***************
*** 0 ****
--- 1,147 ----
+ //===-- LightWtProfiling/ReoptimizerInternal.h -------------------*- C++ -*-==//
+ //
+ // This file contains tunable parameters, internal data structures, and other
+ // global variables used by the LightWtProfiling reoptimizer. It is intended as
+ // a central place to gather together (and perhaps document) the global
+ // variables we use, until we actually get around to encapsulating the
+ // reoptimizer in its own class.
+ //
+ //===----------------------------------------------------------------------===//
+ 
+ #ifndef REOPTIMIZERINTERNAL_H
+ #define REOPTIMIZERINTERNAL_H
+ 
+ #include "Support/DataTypes.h"
+ #include <map>
+ #include <vector>
+ 
+ // Tunable parameters (FIXME: What do they do? (see thesis?))
+ #define MAX_PATH_HISTORIES 12
+ #define MAX_ALLOWED_PATHS 6
+ #define THRESHOLD_PERCENTAGE 90
+ 
+ /// The current SPARC LLC writes the bytecode and its length into the
+ /// executable. We can access them via these global symbols.
+ /// They are not in any namespace.
+ ///
+ extern const unsigned char LLVMBytecode[];
+ extern int llvm_length;
+ 
+ namespace llvm {
+ 
+ class VirtualMem;
+ class TraceCache;
+ class Module;
+ class ModuleProvider;
+ 
+ /// Threshold against which back-edge counters are compared in first-level
+ /// instrumentation. If a back-edge's counter exceeds this threshold, we
+ /// may generate second-level instrumentation (SLI) for the loop.
+ /// This value is also known as THRESHOLD_LEVEL_1.
+ ///
+ extern int32_t reopt_threshold;
+ 
+ /// Another threshold used in SecondTrigger.cpp.
+ ///
+ extern int32_t THRESHOLD_LEVEL_2;
+ 
+ /// If a trace selected as "hot" is exited more than a certain number
+ /// of times, then it will be rejected; this certain number is set to
+ /// 1/3 of the THRESHOLD_LEVEL_2 value.
+ ///
+ extern int32_t LEVEL_TWO_EXITS; 
+ 
+ /// Seconds and nanoseconds used for phase-change detection
+ /// mechanism's interval timer.
+ ///
+ extern int32_t timer_interval_sec;
+ extern int32_t timer_interval_nsec;
+ 
+ /// Second-level instrumented code cache.
+ ///
+ extern TraceCache *tr;
+ 
+ /// Final trace cache.
+ ///
+ extern TraceCache *tr2;
+ 
+ /// Interface by which code segment is read/written.
+ ///
+ extern VirtualMem *vm; 
+ 
+ /// Module being reoptimized, and an ExistingModuleProvider for it -
+ /// currently, we do NOT support on-demand function loading, a/k/a
+ /// "materializing".
+ ///
+ extern Module *M;
+ extern ModuleProvider *MP;
+ 
+ /// When this is set to true, calls to Solaris CPC library functions
+ /// will be inserted that turn on performance counters whenever we are
+ /// executing from the trace, and turn them off whenever we leave the
+ /// trace. The effect is to count the number of cycles that we spend
+ /// executing the trace.  This option used to be controlled by #ifdef
+ /// GET_COVERAGE.
+ ///
+ extern bool count_trace_cycles;
+ 
+ /// When this is set to true, use the new trace optimizer that works
+ /// on vectors of LLVM basic blocks instead of the old trace layout
+ /// engine.
+ ///
+ extern bool enable_trace_optimizer;
+ 
+ /// When this is set to true, turn on the phase detection stuff.
+ ///
+ extern bool enable_phase_detect;
+ 
+ // Initialization.cpp ///////////////////////////////////////////////////
+ 
+ extern void initModules ();
+ 
+ // FirstTrigger.cpp /////////////////////////////////////////////////////
+ 
+ /// Many parts of the reoptimizer need to know the address of
+ /// the first-level instrumentation function, so it is declared here.
+ ///
+ extern "C" void llvm_first_trigger ();
+ 
+ // SLI.cpp //////////////////////////////////////////////////////////////
+ 
+ void doInstrumentation (uint64_t addr1, uint64_t addr2, VirtualMem *vm);
+ 
+ // SecondTrigger.cpp ////////////////////////////////////////////////////
+ 
+ extern std::map<uint64_t, uint64_t> firstTriggerAddr;
+ 
+ void generateTraces (uint64_t start, uint64_t end, 
+ 		     std::vector<uint64_t> &paths, 
+ 		     uint64_t firstLevelTraceStartAddr);
+ void getReturnCode (std::vector<unsigned int> &traces, int &index, 
+ 		    uint64_t ret);
+ void getBranchExitCode (std::vector<unsigned int> &instVec, 
+ 		        std::map<int, uint64_t> &branchMap, 
+ 		        std::map<int, uint64_t> &targetMap, 
+ 		        std::map<int, uint64_t> &callMap);
+ 
+ /// Scan forward through memory starting from startAddr looking for a
+ /// branch instruction. When one is found, foundAddr is set to its
+ /// address, and the instruction word itself is returned.
+ ///
+ uint32_t scanForBranch (const uint64_t startAddr, uint64_t &foundAddr);
+ 
+ void countPath ();
+ 
+ // Scheduler.cpp ////////////////////////////////////////////////////////
+ 
+ int insert_address_at (uint64_t time, uint64_t addr);
+ 
+ void mask_interrupt ();
+ void unmask_interrupt ();
+ bool initialize_timer ();
+ 
+ extern uint64_t llvm_interval_counter;
+ 
+ }; // end namespace llvm
+ 
+ #endif // REOPTIMIZERINTERNAL_H


Index: reopt/lib/LightWtProfiling/FirstTrigger.cpp
diff -u reopt/lib/LightWtProfiling/FirstTrigger.cpp:1.16 reopt/lib/LightWtProfiling/FirstTrigger.cpp:1.17
--- reopt/lib/LightWtProfiling/FirstTrigger.cpp:1.16	Wed Nov 19 16:51:48 2003
+++ reopt/lib/LightWtProfiling/FirstTrigger.cpp	Wed Jan 14 16:51:56 2004
@@ -8,13 +8,8 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "GetTimer.h"
-#include "Globals.h"
-#include "SecondTrigger.h"
+#include "ReoptimizerInternal.h"
 #include "RegSaveRestore.h"
-#include "scheduler.h"
-#include "SLI.h"
-#include "Timer.h"
 #include "Support/Debug.h"
 #include "reopt/VirtualMem.h"
 #include "reopt/InstrUtils.h"


Index: reopt/lib/LightWtProfiling/Initialization.cpp
diff -u reopt/lib/LightWtProfiling/Initialization.cpp:1.12 reopt/lib/LightWtProfiling/Initialization.cpp:1.13
--- reopt/lib/LightWtProfiling/Initialization.cpp:1.12	Tue Jan 13 12:25:01 2004
+++ reopt/lib/LightWtProfiling/Initialization.cpp	Wed Jan 14 16:51:57 2004
@@ -6,14 +6,14 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include <cassert>
-#include "GetTimer.h"
-#include "Globals.h"
-#include "scheduler.h"
+#include "ReoptimizerInternal.h"
 #include "Support/CommandLine.h"
 #include "Support/DataTypes.h"
 #include "llvm/Bytecode/Reader.h"
 #include "reopt/ScratchMemory.h"
+#include "reopt/TraceCache.h"
+#include "reopt/VirtualMem.h"
+#include <cassert>
 
 namespace llvm { 
 


Index: reopt/lib/LightWtProfiling/RuntimeOptimizations.cpp
diff -u reopt/lib/LightWtProfiling/RuntimeOptimizations.cpp:1.15 reopt/lib/LightWtProfiling/RuntimeOptimizations.cpp:1.16
--- reopt/lib/LightWtProfiling/RuntimeOptimizations.cpp:1.15	Wed Jan 14 16:08:45 2004
+++ reopt/lib/LightWtProfiling/RuntimeOptimizations.cpp	Wed Jan 14 16:51:57 2004
@@ -6,27 +6,23 @@
 //
 //===---------------------------------------------------------------------===//
 
-#include "GetTimer.h"
-#include "Globals.h"
+#include "ReoptimizerInternal.h"
 #include "Trace.h"
 #include "TraceToFunction.h"
 #include "Support/Debug.h"
 #include "Support/StringExtras.h"
-#include "llvm/PassManager.h"
-#include "llvm/BasicBlock.h"
 #include "llvm/Analysis/Verifier.h"
 #include "llvm/Assembly/CachedWriter.h"
-#include "llvm/Target/TargetMachine.h"
-#include "llvm/Target/TargetMachineImpls.h"
-#include "llvm/Target/TargetJITInfo.h"
 #include "llvm/CodeGen/MachineFunction.h"
 #include "llvm/IntrinsicLowering.h"
+#include "llvm/ModuleProvider.h"
+#include "llvm/PassManager.h"
+#include "llvm/Target/TargetJITInfo.h"
+#include "llvm/Target/TargetMachine.h"
+#include "llvm/Target/TargetMachineImpls.h"
 #include <fstream>
 
 namespace llvm {
-
-// From Initialization.cpp
-extern void initModules ();
 
 /// This method is called when we have finally constructed a
 /// trace. The first parameter is the vector of basic blocks that form


Index: reopt/lib/LightWtProfiling/SLI.cpp
diff -u reopt/lib/LightWtProfiling/SLI.cpp:1.11 reopt/lib/LightWtProfiling/SLI.cpp:1.12
--- reopt/lib/LightWtProfiling/SLI.cpp:1.11	Wed Nov 19 16:51:48 2003
+++ reopt/lib/LightWtProfiling/SLI.cpp	Wed Jan 14 16:51:57 2004
@@ -3,9 +3,7 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "GetTimer.h"
-#include "Globals.h"
-#include "SecondTrigger.h"
+#include "ReoptimizerInternal.h"
 #include "Support/DataTypes.h"
 #include "Support/Debug.h"
 #include "reopt/MappingInfo.h"


Index: reopt/lib/LightWtProfiling/SecondTrigger.cpp
diff -u reopt/lib/LightWtProfiling/SecondTrigger.cpp:1.24 reopt/lib/LightWtProfiling/SecondTrigger.cpp:1.25
--- reopt/lib/LightWtProfiling/SecondTrigger.cpp:1.24	Wed Nov 19 16:51:48 2003
+++ reopt/lib/LightWtProfiling/SecondTrigger.cpp	Wed Jan 14 16:51:57 2004
@@ -8,19 +8,16 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "GetTimer.h"
-#include "SecondTrigger.h"
+#include "ReoptimizerInternal.h"
 #include "RegSaveRestore.h"
-#include "Globals.h"
-#include "scheduler.h"
-#include "Timer.h"
 #include "Support/Debug.h"
-#include "reopt/MappingInfo.h"
-#include "reopt/VirtualMem.h"
+#include "llvm/Function.h"
+#include "llvm/iTerminators.h"
+#include "reopt/GetTraceTime.h"
 #include "reopt/InstrUtils.h"
+#include "reopt/MappingInfo.h"
 #include "reopt/TraceCache.h"
-#include "reopt/GetTraceTime.h"
-#include "llvm/iTerminators.h"
+#include "reopt/VirtualMem.h"
 #include <cassert>
 #include <libcpc.h>
 
@@ -38,7 +35,6 @@
 // pair counts the number of times a given trace is *not* selected:
 static std::map<uint64_t, std::pair<long, long> > backOffCounters;
 
-extern "C" void llvm_first_trigger(int *cnt);
 extern void optimizeTrace (std::vector<BasicBlock *> &vBB, uint64_t a);
 
 std::map<uint64_t, uint64_t> firstTriggerAddr;


Index: reopt/lib/LightWtProfiling/UnpackTraceFunction.cpp
diff -u reopt/lib/LightWtProfiling/UnpackTraceFunction.cpp:1.24 reopt/lib/LightWtProfiling/UnpackTraceFunction.cpp:1.25
--- reopt/lib/LightWtProfiling/UnpackTraceFunction.cpp:1.24	Mon Jan  5 12:33:23 2004
+++ reopt/lib/LightWtProfiling/UnpackTraceFunction.cpp	Wed Jan 14 16:51:58 2004
@@ -6,15 +6,15 @@
 //===----------------------------------------------------------------------===//
 
 #include "TraceToFunction.h"
-#include "../../../../lib/CodeGen/RegAlloc/AllocInfo.h"
-#include "../../../../lib/CodeGen/RegAlloc/PhyRegAlloc.h"
-#include "../../../../lib/Target/Sparc/SparcTargetMachine.h"
+#include "../../../../lib/Target/Sparc/RegAlloc/AllocInfo.h"
+#include "../../../../lib/Target/Sparc/RegAlloc/PhyRegAlloc.h"
 #include "../../../../lib/Target/Sparc/SparcRegInfo.h"
-#include "llvm/IntrinsicLowering.h"
+#include "../../../../lib/Target/Sparc/SparcTargetMachine.h"
 #include "llvm/CodeGen/MachineFunction.h"
 #include "llvm/CodeGen/MachineInstr.h"
-#include "llvm/Support/InstIterator.h"
+#include "llvm/IntrinsicLowering.h"
 #include "llvm/Module.h"
+#include "llvm/Support/InstIterator.h"
 #include "reopt/MappingInfo.h"
 
 namespace llvm {


Index: reopt/lib/LightWtProfiling/scheduler.cpp
diff -u reopt/lib/LightWtProfiling/scheduler.cpp:1.6 reopt/lib/LightWtProfiling/scheduler.cpp:1.7
--- reopt/lib/LightWtProfiling/scheduler.cpp:1.6	Tue Jan 13 13:50:35 2004
+++ reopt/lib/LightWtProfiling/scheduler.cpp	Wed Jan 14 16:51:58 2004
@@ -5,11 +5,12 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "Globals.h"
-#include "scheduler.h"
+#include "ReoptimizerInternal.h"
 #include "reopt/InstrUtils.h"
+#include "reopt/VirtualMem.h"
 #include <queue>
 #include <csignal>
+#include <iostream>
 
 namespace llvm {
 





More information about the llvm-commits mailing list