[llvm-commits] [llvm] r127013 - in /llvm/trunk/include/llvm/CodeGen: CalcSpillWeights.h SlotIndexes.h
Jakob Stoklund Olesen
stoklund at 2pi.dk
Fri Mar 4 10:36:51 PST 2011
Author: stoklund
Date: Fri Mar 4 12:36:51 2011
New Revision: 127013
URL: http://llvm.org/viewvc/llvm-project?rev=127013&view=rev
Log:
Symbolize the default instruction distance.
Modified:
llvm/trunk/include/llvm/CodeGen/CalcSpillWeights.h
llvm/trunk/include/llvm/CodeGen/SlotIndexes.h
Modified: llvm/trunk/include/llvm/CodeGen/CalcSpillWeights.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/CalcSpillWeights.h?rev=127013&r1=127012&r2=127013&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/CalcSpillWeights.h (original)
+++ llvm/trunk/include/llvm/CodeGen/CalcSpillWeights.h Fri Mar 4 12:36:51 2011
@@ -11,7 +11,7 @@
#ifndef LLVM_CODEGEN_CALCSPILLWEIGHTS_H
#define LLVM_CODEGEN_CALCSPILLWEIGHTS_H
-#include "llvm/CodeGen/MachineFunctionPass.h"
+#include "llvm/CodeGen/SlotIndexes.h"
#include "llvm/ADT/DenseMap.h"
namespace llvm {
@@ -29,15 +29,12 @@
/// @param Size Size of live interval as returnexd by getSize()
///
static inline float normalizeSpillWeight(float UseDefFreq, unsigned Size) {
- // The magic constant 200 corresponds to approx. 25 instructions since
- // SlotIndexes allocate 8 slots per instruction.
- //
- // The constant is added to avoid depending too much on accidental SlotIndex
- // gaps for small intervals. The effect is that small intervals have a spill
- // weight that is mostly proportional to the number of uses, while large
- // intervals get a spill weight that is closer to a use density.
- //
- return UseDefFreq / (Size + 200);
+ // The constant 25 instructions is added to avoid depending too much on
+ // accidental SlotIndex gaps for small intervals. The effect is that small
+ // intervals have a spill weight that is mostly proportional to the number
+ // of uses, while large intervals get a spill weight that is closer to a use
+ // density.
+ return UseDefFreq / (Size + 25*SlotIndex::InstrDist);
}
/// VirtRegAuxInfo - Calculate auxiliary information for a virtual
Modified: llvm/trunk/include/llvm/CodeGen/SlotIndexes.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/SlotIndexes.h?rev=127013&r1=127012&r2=127013&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/SlotIndexes.h (original)
+++ llvm/trunk/include/llvm/CodeGen/SlotIndexes.h Fri Mar 4 12:36:51 2011
@@ -110,6 +110,12 @@
}
public:
+ enum {
+ /// The default distance between instructions as returned by distance().
+ /// This may vary as instructions are inserted and removed.
+ InstrDist = 2*NUM
+ };
+
static inline SlotIndex getEmptyKey() {
return SlotIndex(0, 1);
}
More information about the llvm-commits
mailing list