Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(247)

Unified Diff: src/IceInst.h

Issue 300563003: Subzero: Initial O2 lowering (Closed) Base URL: https://gerrit.chromium.org/gerrit/p/native_client/pnacl-subzero.git@master
Patch Set: Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/IceInst.h
diff --git a/src/IceInst.h b/src/IceInst.h
index fd0eeea9d76b6908bf8791c9f019ab25424b81ce..514af97b4ad309c501a0039672e0976482cfb169 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,12 @@ public:
// basic blocks, i.e. used in a different block from their definition.
void updateVars(CfgNode *Node);
+ void livenessLightweight(llvm::BitVector &Live);
+ void liveness(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 +113,11 @@ protected:
assert(NumSrcs < MaxSrcs);
Srcs[NumSrcs++] = Src;
}
+ void setLastUse(SizeT VarIndex) {
+ if (VarIndex < CHAR_BIT * sizeof(LiveRangesEnded))
+ LiveRangesEnded |= (((LREndedBits)1u) << VarIndex);
+ }
+ 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 +127,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 +139,18 @@ protected:
SizeT NumSrcs;
Operand **Srcs;
+ // LiveRangesEnded marks which Variables' live ranges end in this
+ // instruction. An instruction can have an arbitrary number of
+ // source operands (e.g. a call instruction), and each source
+ // operand can contain 0 or 1 Variable (and target-specific operands
+ // could contain more than 1 Variable). All the variables in an
+ // instruction are conceptually flattened and each variable is
+ // mapped to one bit position of the LiveRangesEnded bit vector.
+ // Only the first CHAR_BIT * sizeof(LREndedBits) variables are
+ // tracked this way.
+ typedef uint32_t LREndedBits; // only first 32 src operands tracked, sorry
+ LREndedBits LiveRangesEnded;
+
private:
Inst(const Inst &) LLVM_DELETED_FUNCTION;
Inst &operator=(const Inst &) LLVM_DELETED_FUNCTION;
@@ -393,6 +420,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 +655,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:

Powered by Google App Engine
This is Rietveld 408576698