- case 0: return string("#") + itostr(Num);
- case 1: return Name;
- case 4: return string("\"") + Name + string("\"");
- case 5: return ftostr(ConstPoolFP);
- default: return string("%") + itostr(ConstPool64);
+ case NumberVal : return string("#") + itostr(Num);
+ case NameVal : return Name;
+ case ConstStringVal: return string("\"") + Name + string("\"");
+ case ConstFPVal : return ftostr(ConstPoolFP);
+ case ConstNullVal : return "null";
+ case ConstUIntVal :
+ case ConstSIntVal : return string("%") + itostr(ConstPool64);
+ default:
+ assert(0 && "Unknown value!");
+ abort();
+ }
+ }
+
+ bool operator<(const ValID &V) const {
+ if (Type != V.Type) return Type < V.Type;
+ switch (Type) {
+ case NumberVal: return Num < V.Num;
+ case ConstStringVal:
+ case NameVal: return strcmp(Name, V.Name) < 0;
+ case ConstSIntVal: return ConstPool64 < V.ConstPool64;
+ case ConstUIntVal: return UConstPool64 < V.UConstPool64;
+ case ConstFPVal: return ConstPoolFP < V.ConstPoolFP;
+ case ConstNullVal: return false;
+ default: assert(0 && "Unknown value type!"); return false;