Index: include/llvm/CodeGen/FastISel.h |
=================================================================== |
--- include/llvm/CodeGen/FastISel.h (revision 137987) |
+++ include/llvm/CodeGen/FastISel.h (working copy) |
@@ -54,8 +54,18 @@ |
const TargetInstrInfo &TII; |
const TargetLowering &TLI; |
const TargetRegisterInfo &TRI; |
+ |
+ /// The position of the last instruction for materializing constants |
+ /// for use in the current block. It resets to EmitStartPt when it |
+ /// makes sense (for example, it's usually profitable to avoid function |
+ /// calls between the definition and the use) |
MachineInstr *LastLocalValue; |
+ /// The top most instruction in the current block that is allowed for |
+ /// emitting local variables. LastLocalValue resets to EmitStartPt when |
+ /// it makes sense (for example, on function calls) |
+ MachineInstr *EmitStartPt; |
+ |
public: |
/// getLastLocalValue - Return the position of the last instruction |
/// emitted for materializing constants for use in the current block. |
@@ -63,7 +73,10 @@ |
/// setLastLocalValue - Update the position of the last instruction |
/// emitted for materializing constants for use in the current block. |
- void setLastLocalValue(MachineInstr *I) { LastLocalValue = I; } |
+ void setLastLocalValue(MachineInstr *I) { |
+ EmitStartPt = I; |
+ LastLocalValue = I; |
+ } |
/// startNewBlock - Set the current block to which generated machine |
/// instructions will be appended, and clear the local CSE map. |
@@ -358,6 +371,11 @@ |
/// be materialized with new instructions. |
unsigned materializeRegForValue(const Value *V, MVT VT); |
+ /// flushLocalValueMap - clears LocalValueMap and moves the area for the |
+ /// new local variables to the beginning of the block. It helps to avoid |
+ /// spilling cached variables across heavy instructions like calls. |
+ void flushLocalValueMap(); |
+ |
/// hasTrivialKill - Test whether the given value has exactly one use. |
bool hasTrivialKill(const Value *V) const; |
}; |