Subzero: Improve the use of NodeList objects.
Currently NodeList is defined as std::vector<CfgNode*>, but in the future it may be desirable to change it to something like std::list<CfgNode*> so that it is easier to split edges and insert the new nodes at the right locations, rather than re-sorting them in a separate pass.
This gets us closer by using foo.front() instead of foo[0]. There are still a couple more places using the [] operator, but the changes would be more intrusive.
Also, a few instances of ".size()==0" are changed to the possibly more efficient ".empty()".
BUG= none
R=jvoung@chromium.org, kschimpf@google.com
Review URL: https://codereview.chromium.org/704753007
diff --git a/src/PNaClTranslator.cpp b/src/PNaClTranslator.cpp
index f2d8e0c..68a1ebc 100644
--- a/src/PNaClTranslator.cpp
+++ b/src/PNaClTranslator.cpp
@@ -1637,7 +1637,7 @@
// insert unreachable. This shouldn't happen, but be safe.
unsigned Index = 0;
for (Ice::CfgNode *Node : Func->getNodes()) {
- if (Node->getInsts().size() == 0) {
+ if (Node->getInsts().empty()) {
std::string Buffer;
raw_string_ostream StrBuf(Buffer);
StrBuf << "Basic block " << Index << " contains no instructions";
@@ -1908,7 +1908,7 @@
// RET: [opval?]
if (!isValidRecordSizeInRange(0, 1, "function block ret"))
return;
- if (Values.size() == 0) {
+ if (Values.empty()) {
CurrentNode->appendInst(Ice::InstRet::create(Func));
} else {
CurrentNode->appendInst(