Start processing function blocks.
Handle binops and returns.
BUG= https://code.google.com/p/nativeclient/issues/detail?id=3894
R=jvoung@chromium.org, stichnot@chromium.org
Review URL: https://codereview.chromium.org/395193005
diff --git a/src/IceInst.cpp b/src/IceInst.cpp
index af7152f..a3d4ee6 100644
--- a/src/IceInst.cpp
+++ b/src/IceInst.cpp
@@ -33,8 +33,6 @@
ICEINSTARITHMETIC_TABLE
#undef X
};
-const size_t InstArithmeticAttributesSize =
- llvm::array_lengthof(InstArithmeticAttributes);
// Using non-anonymous struct so that array_lengthof works.
const struct InstCastAttributes_ {
@@ -46,7 +44,6 @@
ICEINSTCAST_TABLE
#undef X
};
-const size_t InstCastAttributesSize = llvm::array_lengthof(InstCastAttributes);
// Using non-anonymous struct so that array_lengthof works.
const struct InstFcmpAttributes_ {
@@ -58,7 +55,6 @@
ICEINSTFCMP_TABLE
#undef X
};
-const size_t InstFcmpAttributesSize = llvm::array_lengthof(InstFcmpAttributes);
// Using non-anonymous struct so that array_lengthof works.
const struct InstIcmpAttributes_ {
@@ -70,7 +66,6 @@
ICEINSTICMP_TABLE
#undef X
};
-const size_t InstIcmpAttributesSize = llvm::array_lengthof(InstIcmpAttributes);
} // end of anonymous namespace
@@ -228,6 +223,13 @@
addSource(Source2);
}
+const char *InstArithmetic::getOpName(OpKind Op) {
+ size_t OpIndex = static_cast<size_t>(Op);
+ return OpIndex < InstArithmetic::_num
+ ? InstArithmeticAttributes[OpIndex].DisplayString
+ : "???";
+}
+
bool InstArithmetic::isCommutative() const {
return InstArithmeticAttributes[getOp()].IsCommutative;
}