diff options
author | Chris Lattner <sabre@nondot.org> | 2002-08-16 21:14:40 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2002-08-16 21:14:40 +0000 |
commit | 7f325cd0bcc511efc7df09e89bedb9798b48966d (patch) | |
tree | 776d8204f5621486b12b5ac2cc887dbcbd6092fc /llvm/lib/AsmParser/ParserInternals.h | |
parent | d0ded9899bc5d760c489945306fbfa5f2c9a3c4c (diff) | |
download | bcm5719-llvm-7f325cd0bcc511efc7df09e89bedb9798b48966d.tar.gz bcm5719-llvm-7f325cd0bcc511efc7df09e89bedb9798b48966d.zip |
- Remove unused STRING token from lexer & parser
- Changed parser to always use parenthesis on ConstExprs to be consistent
- Parser now passes TRUE and FALSE tokens as a special case of the ConstExpr
machinery instead of a special case of constant int stuff
- Fix the AsmParser to use ValueRef ::= ConstExpr, and remove
ResolvedVal ::= ConstExpr this allows constexprs to be used in PHI nodes
llvm-svn: 3362
Diffstat (limited to 'llvm/lib/AsmParser/ParserInternals.h')
-rw-r--r-- | llvm/lib/AsmParser/ParserInternals.h | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/llvm/lib/AsmParser/ParserInternals.h b/llvm/lib/AsmParser/ParserInternals.h index 13023481662..e3eb3480af9 100644 --- a/llvm/lib/AsmParser/ParserInternals.h +++ b/llvm/lib/AsmParser/ParserInternals.h @@ -63,7 +63,8 @@ static inline void ThrowException(const std::string &message, // struct ValID { enum { - NumberVal, NameVal, ConstSIntVal, ConstUIntVal, ConstFPVal, ConstNullVal + NumberVal, NameVal, ConstSIntVal, ConstUIntVal, ConstFPVal, ConstNullVal, + ConstantVal, } Type; union { @@ -72,6 +73,7 @@ struct ValID { int64_t ConstPool64; // Constant pool reference. This is the value uint64_t UConstPool64;// Unsigned constant pool reference. double ConstPoolFP; // Floating point constant pool reference + Constant *ConstantValue; // Fully resolved constant for ConstantVal case. }; static ValID create(int Num) { @@ -98,6 +100,10 @@ struct ValID { ValID D; D.Type = ConstNullVal; return D; } + static ValID create(Constant *Val) { + ValID D; D.Type = ConstantVal; D.ConstantValue = Val; return D; + } + inline void destroy() const { if (Type == NameVal) free(Name); // Free this strdup'd memory... @@ -118,6 +124,10 @@ struct ValID { case ConstNullVal : return "null"; case ConstUIntVal : case ConstSIntVal : return std::string("%") + itostr(ConstPool64); + case ConstantVal: + if (ConstantValue == ConstantBool::True) return "true"; + if (ConstantValue == ConstantBool::False) return "false"; + return "<constant expression>"; default: assert(0 && "Unknown value!"); abort(); @@ -134,6 +144,7 @@ struct ValID { case ConstUIntVal: return UConstPool64 < V.UConstPool64; case ConstFPVal: return ConstPoolFP < V.ConstPoolFP; case ConstNullVal: return false; + case ConstantVal: return ConstantValue < V.ConstantValue; default: assert(0 && "Unknown value type!"); return false; } } |