diff options
author | Chris Lattner <sabre@nondot.org> | 2001-07-15 00:17:01 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2001-07-15 00:17:01 +0000 |
commit | 3d52b2fdcc07ce26c61adf99822adfa8251696cc (patch) | |
tree | 320de2cd2d6927e91cddfc37685bdfc3259f6c8d /lib/AsmParser/ParserInternals.h | |
parent | 2e35bedc825ab1e125d1173a69faca784e2b5a2f (diff) |
Add support to the parser to recognize floating point constants
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@188 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AsmParser/ParserInternals.h')
-rw-r--r-- | lib/AsmParser/ParserInternals.h | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/AsmParser/ParserInternals.h b/lib/AsmParser/ParserInternals.h index bd26fdbaaf..d9f34440b8 100644 --- a/lib/AsmParser/ParserInternals.h +++ b/lib/AsmParser/ParserInternals.h @@ -53,12 +53,14 @@ static inline void ThrowException(const string &message) { // struct ValID { int Type; // 0 = number, 1 = name, 2 = const pool, - // 3 = unsigned const pool, 4 = const string + // 3 = unsigned const pool, 4 = const string, + // 5 = const fp union { int Num; // If it's a numeric reference char *Name; // If it's a named reference. Memory must be free'd. int64_t ConstPool64; // Constant pool reference. This is the value uint64_t UConstPool64;// Unsigned constant pool reference. + double ConstPoolFP; // Floating point constant pool reference }; static ValID create(int Num) { @@ -81,6 +83,10 @@ struct ValID { ValID D; D.Type = 4; D.Name = Name; return D; } + static ValID create(double Val) { + ValID D; D.Type = 5; D.ConstPoolFP = Val; return D; + } + inline void destroy() { if (Type == 1 || Type == 4) free(Name); // Free this strdup'd memory... } @@ -97,6 +103,7 @@ struct ValID { 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); } } |