diff options
author | Jakob Stoklund Olesen <stoklund@2pi.dk> | 2012-08-01 22:36:00 +0000 |
---|---|---|
committer | Jakob Stoklund Olesen <stoklund@2pi.dk> | 2012-08-01 22:36:00 +0000 |
commit | c7f44b8b8fca87cdd28ffe420c3b87141d88c099 (patch) | |
tree | a5337172ca9cf3d27e1039a56ced7ecce2dcad21 /lib/CodeGen/MachineTraceMetrics.h | |
parent | cc5fc665e3f68bd70b42516adaf4a2f9879f2940 (diff) |
Compute instruction heights through a trace.
The height on an instruction is the minimum number of cycles from the
instruction is issued to the end of the trace. Heights are computed for
all instructions in and below the trace center block.
The method for computing heights is different from the depth
computation. As we visit instructions in the trace bottom-up, heights of
used instructions are pushed upwards. This way, we avoid scanning long
use lists, looking for uses in the current trace.
At each basic block boundary, a list of live-in registers and their
minimum heights is saved in the trace block info. These live-in lists
are used when restarting depth computations on a trace that
converges with an already computed trace. They will also be used to
accurately compute the critical path length.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@161138 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/MachineTraceMetrics.h')
-rw-r--r-- | lib/CodeGen/MachineTraceMetrics.h | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/lib/CodeGen/MachineTraceMetrics.h b/lib/CodeGen/MachineTraceMetrics.h index 1eb98c1968..b0edfeb7bd 100644 --- a/lib/CodeGen/MachineTraceMetrics.h +++ b/lib/CodeGen/MachineTraceMetrics.h @@ -47,8 +47,8 @@ #ifndef LLVM_CODEGEN_MACHINE_TRACE_METRICS_H #define LLVM_CODEGEN_MACHINE_TRACE_METRICS_H +#include "llvm/ADT/ArrayRef.h" #include "llvm/ADT/DenseMap.h" -#include "llvm/ADT/SmallVector.h" #include "llvm/CodeGen/MachineFunctionPass.h" namespace llvm { @@ -106,6 +106,19 @@ public: /// Get the fixed resource information about MBB. Compute it on demand. const FixedBlockInfo *getResources(const MachineBasicBlock*); + /// A virtual register or regunit required by a basic block or its trace + /// successors. + struct LiveInReg { + /// The virtual register required, or a register unit. + unsigned Reg; + + /// For virtual registers: Minimum height of the defining instruction. + /// For regunits: Height of the highest user in the trace. + unsigned Height; + + LiveInReg(unsigned Reg, unsigned Height = 0) : Reg(Reg), Height(Height) {} + }; + /// Per-basic block information that relates to a specific trace through the /// block. Convergent traces means that only one of these is required per /// block in a trace ensemble. @@ -161,6 +174,12 @@ public: /// Instruction heights have been computed. This implies hasValidHeight(). bool HasValidInstrHeights; + /// Live-in registers. These registers are defined above the current block + /// and used by this block or a block below it. + /// This does not include PHI uses in the current block, but it does + /// include PHI uses in deeper blocks. + SmallVector<LiveInReg, 4> LiveIns; + void print(raw_ostream&) const; }; @@ -207,6 +226,8 @@ public: void computeHeightResources(const MachineBasicBlock*); void computeInstrDepths(const MachineBasicBlock*); void computeInstrHeights(const MachineBasicBlock*); + void addLiveIns(const MachineInstr *DefMI, + ArrayRef<const MachineBasicBlock*> Trace); protected: MachineTraceMetrics &MTM; |