Subzero: Fix a signed/unsigned warning reported on the Mac. Also cleans up some unneeded table size const static variables. BUG= https://codereview.chromium.org/296053008/ R=jvoung@chromium.org Review URL: https://codereview.chromium.org/428353002
diff --git a/src/IceInstX8632.cpp b/src/IceInstX8632.cpp index 14e9503..c30c9f5 100644 --- a/src/IceInstX8632.cpp +++ b/src/IceInstX8632.cpp
@@ -33,8 +33,6 @@ ICEINSTX8632BR_TABLE #undef X }; -const size_t InstX8632BrAttributesSize = - llvm::array_lengthof(InstX8632BrAttributes); const struct InstX8632CmppsAttributes_ { const char *EmitString; @@ -45,8 +43,6 @@ ICEINSTX8632CMPPS_TABLE #undef X }; -const size_t InstX8632CmppsAttributesSize = - llvm::array_lengthof(InstX8632CmppsAttributes); const struct TypeX8632Attributes_ { const char *CvtString; // i (integer), s (single FP), d (double FP) @@ -60,16 +56,12 @@ ICETYPEX8632_TABLE #undef X }; -const size_t TypeX8632AttributesSize = - llvm::array_lengthof(TypeX8632Attributes); const char *InstX8632SegmentRegNames[] = { #define X(val, name) name, SEG_REGX8632_TABLE #undef X }; -const size_t InstX8632SegmentRegNamesSize = - llvm::array_lengthof(InstX8632SegmentRegNames); } // end of anonymous namespace @@ -766,7 +758,7 @@ void InstX8632Cmpps::emit(const Cfg *Func) const { Ostream &Str = Func->getContext()->getStrEmit(); assert(getSrcSize() == 2); - assert(Condition < InstX8632CmppsAttributesSize); + assert(Condition < Cmpps_Invalid); Str << "\t"; Str << "cmp" << InstX8632CmppsAttributes[Condition].EmitString << "ps" << "\t"; @@ -778,7 +770,7 @@ void InstX8632Cmpps::dump(const Cfg *Func) const { Ostream &Str = Func->getContext()->getStrDump(); - assert(Condition < InstX8632CmppsAttributesSize); + assert(Condition < Cmpps_Invalid); dumpDest(Func); Str << " = cmp" << InstX8632CmppsAttributes[Condition].EmitString << "ps" << "\t"; @@ -1360,8 +1352,7 @@ Ostream &Str = Func->getContext()->getStrEmit(); Str << TypeX8632Attributes[getType()].WidthString << " "; if (SegmentReg != DefaultSegment) { - assert(SegmentReg >= 0 && - static_cast<size_t>(SegmentReg) < InstX8632SegmentRegNamesSize); + assert(SegmentReg >= 0 && SegmentReg < SegReg_NUM); Str << InstX8632SegmentRegNames[SegmentReg] << ":"; } // TODO: The following is an almost verbatim paste of dump(). @@ -1404,8 +1395,7 @@ void OperandX8632Mem::dump(const Cfg *Func) const { Ostream &Str = Func->getContext()->getStrDump(); if (SegmentReg != DefaultSegment) { - assert(SegmentReg >= 0 && - static_cast<size_t>(SegmentReg) < InstX8632SegmentRegNamesSize); + assert(SegmentReg >= 0 && SegmentReg < SegReg_NUM); Str << InstX8632SegmentRegNames[SegmentReg] << ":"; } bool Dumped = false;