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

Unified Diff: src/IceCfgNode.h

Issue 205613002: Initial skeleton of Subzero. (Closed) Base URL: https://gerrit.chromium.org/gerrit/p/native_client/pnacl-subzero.git@master
Patch Set: Fix omissions from previous patchset. Created 6 years, 8 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/IceCfgNode.h
diff --git a/src/IceCfgNode.h b/src/IceCfgNode.h
new file mode 100644
index 0000000000000000000000000000000000000000..dc7828fb3c56a470b2b927886eef74dd30e94ee3
--- /dev/null
+++ b/src/IceCfgNode.h
@@ -0,0 +1,63 @@
+//===- subzero/src/IceCfgNode.h - Control flow graph node -------*- C++ -*-===//
+//
+// The Subzero Code Generator
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This file declares the CfgNode class, which represents a single
+// basic block as its instruction list, in-edge list, and out-edge
+// list.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef SUBZERO_SRC_ICECFGNODE_H
+#define SUBZERO_SRC_ICECFGNODE_H
+
+#include "IceDefs.h"
+
+namespace Ice {
+
+class CfgNode {
+public:
+ static CfgNode *create(IceCfg *Cfg, IceSize_t LabelIndex,
+ IceString Name = "") {
+ return new (Cfg->allocate<CfgNode>()) CfgNode(Cfg, LabelIndex, Name);
+ }
+
+ // Access the label number and name for this node.
+ IceSize_t getIndex() const { return Number; }
+ IceString getName() const;
+
+ // Access predecessor and successor edge lists.
+ const NodeList &getInEdges() const { return InEdges; }
+ const NodeList &getOutEdges() const { return OutEdges; }
+
+ // Manage the instruction list.
+ InstList &getInsts() { return Insts; }
+ void appendInst(Inst *Inst);
+
+ // Add a predecessor edge to the InEdges list for each of this
+ // node's successors.
+ void computePredecessors();
+
+ void dump(IceCfg *Cfg) const;
+
+private:
+ CfgNode(IceCfg *Cfg, IceSize_t LabelIndex, IceString Name);
+ CfgNode(const CfgNode &) LLVM_DELETED_FUNCTION;
+ CfgNode &operator=(const CfgNode &) LLVM_DELETED_FUNCTION;
+ IceCfg *const Cfg;
+ const IceSize_t Number; // label index
+ IceString Name; // for dumping only
+ NodeList InEdges; // in no particular order
+ NodeList OutEdges; // in no particular order
+ PhiList Phis; // unordered set of phi instructions
+ InstList Insts; // ordered list of non-phi instructions
+};
+
+} // end of namespace Ice
+
+#endif // SUBZERO_SRC_ICECFGNODE_H

Powered by Google App Engine
This is Rietveld 408576698