Commit 5acafbc0 by Jim Stichnoth

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
parent 6e992147
...@@ -33,8 +33,6 @@ const struct InstX8632BrAttributes_ { ...@@ -33,8 +33,6 @@ const struct InstX8632BrAttributes_ {
ICEINSTX8632BR_TABLE ICEINSTX8632BR_TABLE
#undef X #undef X
}; };
const size_t InstX8632BrAttributesSize =
llvm::array_lengthof(InstX8632BrAttributes);
const struct InstX8632CmppsAttributes_ { const struct InstX8632CmppsAttributes_ {
const char *EmitString; const char *EmitString;
...@@ -45,8 +43,6 @@ const struct InstX8632CmppsAttributes_ { ...@@ -45,8 +43,6 @@ const struct InstX8632CmppsAttributes_ {
ICEINSTX8632CMPPS_TABLE ICEINSTX8632CMPPS_TABLE
#undef X #undef X
}; };
const size_t InstX8632CmppsAttributesSize =
llvm::array_lengthof(InstX8632CmppsAttributes);
const struct TypeX8632Attributes_ { const struct TypeX8632Attributes_ {
const char *CvtString; // i (integer), s (single FP), d (double FP) const char *CvtString; // i (integer), s (single FP), d (double FP)
...@@ -60,16 +56,12 @@ const struct TypeX8632Attributes_ { ...@@ -60,16 +56,12 @@ const struct TypeX8632Attributes_ {
ICETYPEX8632_TABLE ICETYPEX8632_TABLE
#undef X #undef X
}; };
const size_t TypeX8632AttributesSize =
llvm::array_lengthof(TypeX8632Attributes);
const char *InstX8632SegmentRegNames[] = { const char *InstX8632SegmentRegNames[] = {
#define X(val, name) name, #define X(val, name) name,
SEG_REGX8632_TABLE SEG_REGX8632_TABLE
#undef X #undef X
}; };
const size_t InstX8632SegmentRegNamesSize =
llvm::array_lengthof(InstX8632SegmentRegNames);
} // end of anonymous namespace } // end of anonymous namespace
...@@ -766,7 +758,7 @@ void InstX8632Cmov::dump(const Cfg *Func) const { ...@@ -766,7 +758,7 @@ void InstX8632Cmov::dump(const Cfg *Func) const {
void InstX8632Cmpps::emit(const Cfg *Func) const { void InstX8632Cmpps::emit(const Cfg *Func) const {
Ostream &Str = Func->getContext()->getStrEmit(); Ostream &Str = Func->getContext()->getStrEmit();
assert(getSrcSize() == 2); assert(getSrcSize() == 2);
assert(Condition < InstX8632CmppsAttributesSize); assert(Condition < Cmpps_Invalid);
Str << "\t"; Str << "\t";
Str << "cmp" << InstX8632CmppsAttributes[Condition].EmitString << "ps" Str << "cmp" << InstX8632CmppsAttributes[Condition].EmitString << "ps"
<< "\t"; << "\t";
...@@ -778,7 +770,7 @@ void InstX8632Cmpps::emit(const Cfg *Func) const { ...@@ -778,7 +770,7 @@ void InstX8632Cmpps::emit(const Cfg *Func) const {
void InstX8632Cmpps::dump(const Cfg *Func) const { void InstX8632Cmpps::dump(const Cfg *Func) const {
Ostream &Str = Func->getContext()->getStrDump(); Ostream &Str = Func->getContext()->getStrDump();
assert(Condition < InstX8632CmppsAttributesSize); assert(Condition < Cmpps_Invalid);
dumpDest(Func); dumpDest(Func);
Str << " = cmp" << InstX8632CmppsAttributes[Condition].EmitString << "ps" Str << " = cmp" << InstX8632CmppsAttributes[Condition].EmitString << "ps"
<< "\t"; << "\t";
...@@ -1360,8 +1352,7 @@ void OperandX8632Mem::emit(const Cfg *Func) const { ...@@ -1360,8 +1352,7 @@ void OperandX8632Mem::emit(const Cfg *Func) const {
Ostream &Str = Func->getContext()->getStrEmit(); Ostream &Str = Func->getContext()->getStrEmit();
Str << TypeX8632Attributes[getType()].WidthString << " "; Str << TypeX8632Attributes[getType()].WidthString << " ";
if (SegmentReg != DefaultSegment) { if (SegmentReg != DefaultSegment) {
assert(SegmentReg >= 0 && assert(SegmentReg >= 0 && SegmentReg < SegReg_NUM);
static_cast<size_t>(SegmentReg) < InstX8632SegmentRegNamesSize);
Str << InstX8632SegmentRegNames[SegmentReg] << ":"; Str << InstX8632SegmentRegNames[SegmentReg] << ":";
} }
// TODO: The following is an almost verbatim paste of dump(). // TODO: The following is an almost verbatim paste of dump().
...@@ -1404,8 +1395,7 @@ void OperandX8632Mem::emit(const Cfg *Func) const { ...@@ -1404,8 +1395,7 @@ void OperandX8632Mem::emit(const Cfg *Func) const {
void OperandX8632Mem::dump(const Cfg *Func) const { void OperandX8632Mem::dump(const Cfg *Func) const {
Ostream &Str = Func->getContext()->getStrDump(); Ostream &Str = Func->getContext()->getStrDump();
if (SegmentReg != DefaultSegment) { if (SegmentReg != DefaultSegment) {
assert(SegmentReg >= 0 && assert(SegmentReg >= 0 && SegmentReg < SegReg_NUM);
static_cast<size_t>(SegmentReg) < InstX8632SegmentRegNamesSize);
Str << InstX8632SegmentRegNames[SegmentReg] << ":"; Str << InstX8632SegmentRegNames[SegmentReg] << ":";
} }
bool Dumped = false; bool Dumped = false;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment