Add Om1 lowering with no optimizations.
This adds infrastructure for low-level x86-32 instructions, and the target lowering patterns.
Practically no optimizations are performed. Optimizations to be introduced later include liveness analysis, dead-code elimination, global linear-scan register allocation, linear-scan based stack slot coalescing, and compare/branch fusing. One optimization that is present is simple coalescing of stack slots for variables that are only live within a single basic block.
There are also some fairly comprehensive cross tests. This testing infrastructure translates bitcode using both Subzero and llc, and a testing harness calls both versions with a variety of "interesting" inputs and compares the results. Specifically, Arithmetic, Icmp, Fcmp, and Cast instructions are tested this way, across all PNaCl primitive types.
BUG=
R=jvoung@chromium.org
Review URL: https://codereview.chromium.org/265703002
diff --git a/src/IceCfgNode.h b/src/IceCfgNode.h
index bf96aef..645dc57 100644
--- a/src/IceCfgNode.h
+++ b/src/IceCfgNode.h
@@ -29,6 +29,14 @@
// Access the label number and name for this node.
SizeT getIndex() const { return Number; }
IceString getName() const;
+ IceString getAsmName() const {
+ return ".L" + Func->getFunctionName() + "$" + getName();
+ }
+
+ // The HasReturn flag indicates that this node contains a return
+ // instruction and therefore needs an epilog.
+ void setHasReturn() { HasReturn = true; }
+ bool getHasReturn() const { return HasReturn; }
// Access predecessor and successor edge lists.
const NodeList &getInEdges() const { return InEdges; }
@@ -42,6 +50,11 @@
// node's successors.
void computePredecessors();
+ void placePhiLoads();
+ void placePhiStores();
+ void deletePhis();
+ void genCode();
+ void emit(Cfg *Func) const;
void dump(Cfg *Func) const;
private:
@@ -51,6 +64,7 @@
Cfg *const Func;
const SizeT Number; // label index
IceString Name; // for dumping only
+ bool HasReturn; // does this block need an epilog?
NodeList InEdges; // in no particular order
NodeList OutEdges; // in no particular order
PhiList Phis; // unordered set of phi instructions