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

Unified Diff: src/IceOperand.h

Issue 586943003: Subzero: Change the way bitcast stack slot lowering is handled. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Add clarifying comment to asType() Created 6 years, 3 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
« no previous file with comments | « src/IceInstX8632.h ('k') | src/IceOperand.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/IceOperand.h
diff --git a/src/IceOperand.h b/src/IceOperand.h
index 02a1cf7aedb59c8b2b2664b1ee4d7f961711ba36..7fedfd24af7b528fd62cb1a2383544cfebcbb31b 100644
--- a/src/IceOperand.h
+++ b/src/IceOperand.h
@@ -25,6 +25,7 @@ namespace Ice {
class Operand {
public:
+ static const size_t MaxTargetKinds = 10;
enum OperandKind {
kConst_Base,
kConstInteger32,
@@ -33,8 +34,11 @@ public:
kConstDouble,
kConstRelocatable,
kConstUndef,
- kConst_Num,
+ kConst_Target, // leave space for target-specific constant kinds
+ kConst_Num = kConst_Target + MaxTargetKinds,
kVariable,
+ kVariable_Target, // leave space for target-specific variable kinds
+ kVariable_Num = kVariable_Target + MaxTargetKinds,
// Target-specific operand classes use kTarget as the starting
// point for their Kind enum space.
kTarget
@@ -339,10 +343,14 @@ Ostream &operator<<(Ostream &Str, const LiveRange &L);
// stack-allocated. If it is register-allocated, it will ultimately
// have a non-negative RegNum field.
class Variable : public Operand {
+ Variable(const Variable &) LLVM_DELETED_FUNCTION;
+ Variable &operator=(const Variable &) LLVM_DELETED_FUNCTION;
+
public:
static Variable *create(Cfg *Func, Type Ty, const CfgNode *Node, SizeT Index,
const IceString &Name) {
- return new (Func->allocate<Variable>()) Variable(Ty, Node, Index, Name);
+ return new (Func->allocate<Variable>())
+ Variable(kVariable, Ty, Node, Index, Name);
}
SizeT getIndex() const { return Number; }
@@ -431,16 +439,18 @@ public:
virtual void dump(const Cfg *Func, Ostream &Str) const;
static bool classof(const Operand *Operand) {
- return Operand->getKind() == kVariable;
+ OperandKind Kind = Operand->getKind();
+ return Kind >= kVariable && Kind <= kVariable_Num;
}
// The destructor is public because of the asType() method.
virtual ~Variable() {}
-private:
- Variable(Type Ty, const CfgNode *Node, SizeT Index, const IceString &Name)
- : Operand(kVariable, Ty), Number(Index), Name(Name), DefInst(NULL),
- DefNode(Node), IsMultidef(false), IsArgument(false), StackOffset(0),
+protected:
+ Variable(OperandKind K, Type Ty, const CfgNode *Node, SizeT Index,
+ const IceString &Name)
+ : Operand(K, Ty), Number(Index), Name(Name), DefInst(NULL), DefNode(Node),
+ IsMultidef(false), IsArgument(false), StackOffset(0),
RegNum(NoRegister), RegNumTmp(NoRegister), Weight(1),
RegisterPreference(NULL), AllowRegisterOverlap(false), LoVar(NULL),
HiVar(NULL) {
@@ -448,8 +458,6 @@ private:
Vars[0] = this;
NumVars = 1;
}
- Variable(const Variable &) LLVM_DELETED_FUNCTION;
- Variable &operator=(const Variable &) LLVM_DELETED_FUNCTION;
// Number is unique across all variables, and is used as a
// (bit)vector index for liveness analysis.
const SizeT Number;
« no previous file with comments | « src/IceInstX8632.h ('k') | src/IceOperand.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698