Parse undef and unreachable

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17053 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner
2004-10-16 18:17:13 +00:00
parent c17edbdeeb
commit 16710e9574
3 changed files with 24 additions and 4 deletions

View File

@@ -72,7 +72,7 @@ static inline void ThrowException(const std::string &message,
struct ValID {
enum {
NumberVal, NameVal, ConstSIntVal, ConstUIntVal, ConstFPVal, ConstNullVal,
ConstantVal,
ConstUndefVal, ConstantVal,
} Type;
union {
@@ -108,6 +108,10 @@ struct ValID {
ValID D; D.Type = ConstNullVal; return D;
}
static ValID createUndef() {
ValID D; D.Type = ConstUndefVal; return D;
}
static ValID create(Constant *Val) {
ValID D; D.Type = ConstantVal; D.ConstantValue = Val; return D;
}
@@ -130,6 +134,7 @@ struct ValID {
case NameVal : return Name;
case ConstFPVal : return ftostr(ConstPoolFP);
case ConstNullVal : return "null";
case ConstUndefVal : return "undef";
case ConstUIntVal :
case ConstSIntVal : return std::string("%") + itostr(ConstPool64);
case ConstantVal:
@@ -152,6 +157,7 @@ struct ValID {
case ConstUIntVal: return UConstPool64 < V.UConstPool64;
case ConstFPVal: return ConstPoolFP < V.ConstPoolFP;
case ConstNullVal: return false;
case ConstUndefVal: return false;
case ConstantVal: return ConstantValue < V.ConstantValue;
default: assert(0 && "Unknown value type!"); return false;
}