Index: src/IceInst.h |
diff --git a/src/IceInst.h b/src/IceInst.h |
index fd0eeea9d76b6908bf8791c9f019ab25424b81ce..d066a81d1d9e16991747ffe5c50c9539e28949c1 100644 |
--- a/src/IceInst.h |
+++ b/src/IceInst.h |
@@ -57,9 +57,11 @@ public: |
InstKind getKind() const { return Kind; } |
int32_t getNumber() const { return Number; } |
+ void renumber(Cfg *Func); |
bool isDeleted() const { return Deleted; } |
void setDeleted() { Deleted = true; } |
+ void deleteIfDead(); |
bool hasSideEffects() const { return HasSideEffects; } |
@@ -71,6 +73,8 @@ public: |
return Srcs[I]; |
} |
+ bool isLastUse(const Operand *Src) const; |
+ |
// Returns a list of out-edges corresponding to a terminator |
// instruction, which is the last instruction of the block. |
virtual NodeList getTerminatorEdges() const { |
@@ -88,8 +92,11 @@ public: |
// basic blocks, i.e. used in a different block from their definition. |
void updateVars(CfgNode *Node); |
+ void liveness(LivenessMode Mode, int32_t InstNumber, llvm::BitVector &Live, |
+ Liveness *Liveness, const CfgNode *Node); |
virtual void emit(const Cfg *Func) const; |
virtual void dump(const Cfg *Func) const; |
+ virtual void dumpExtras(const Cfg *Func) const; |
void dumpDecorated(const Cfg *Func) const; |
void emitSources(const Cfg *Func) const; |
void dumpSources(const Cfg *Func) const; |
@@ -105,6 +112,11 @@ protected: |
assert(NumSrcs < MaxSrcs); |
Srcs[NumSrcs++] = Src; |
} |
+ void setLastUse(SizeT VarIndex) { |
+ if (VarIndex < 8 * sizeof(LiveRangesEnded)) |
JF
2014/05/25 22:50:50
s/8/CHAR_BIT/
Jim Stichnoth
2014/05/29 01:39:46
Done.
|
+ LiveRangesEnded |= (1u << VarIndex); |
JF
2014/05/25 22:50:50
Use a typedef for LiveRangesEnded, and cast 1u to
Jim Stichnoth
2014/05/29 01:39:46
Done.
|
+ } |
+ void resetLastUses() { LiveRangesEnded = 0; } |
// The destroy() method lets the instruction cleanly release any |
// memory that was allocated via the Cfg's allocator. |
virtual void destroy(Cfg *Func) { Func->deallocateArrayOf<Operand *>(Srcs); } |
@@ -114,6 +126,8 @@ protected: |
int32_t Number; |
// Deleted means irrevocably deleted. |
bool Deleted; |
+ // Dead means pending deletion after liveness analysis converges. |
+ bool Dead; |
// HasSideEffects means the instruction is something like a function |
// call or a volatile load that can't be removed even if its Dest |
// variable is not live. |
@@ -124,6 +138,8 @@ protected: |
SizeT NumSrcs; |
Operand **Srcs; |
+ uint32_t LiveRangesEnded; // only first 32 src operands tracked, sorry |
+ |
private: |
Inst(const Inst &) LLVM_DELETED_FUNCTION; |
Inst &operator=(const Inst &) LLVM_DELETED_FUNCTION; |
@@ -393,6 +409,8 @@ public: |
} |
void addArgument(Operand *Source, CfgNode *Label); |
Operand *getOperandForTarget(CfgNode *Target) const; |
+ void livenessPhiOperand(llvm::BitVector &Live, CfgNode *Target, |
+ Liveness *Liveness); |
Inst *lower(Cfg *Func, CfgNode *Node); |
virtual void dump(const Cfg *Func) const; |
static bool classof(const Inst *Inst) { return Inst->getKind() == Phi; } |
@@ -626,6 +644,7 @@ class InstTarget : public Inst { |
public: |
virtual void emit(const Cfg *Func) const = 0; |
virtual void dump(const Cfg *Func) const; |
+ virtual void dumpExtras(const Cfg *Func) const; |
static bool classof(const Inst *Inst) { return Inst->getKind() >= Target; } |
protected: |