aboutsummaryrefslogtreecommitdiff
path: root/lib/MC
diff options
context:
space:
mode:
authorBill Wendling <isanbard@gmail.com>2011-01-25 21:26:41 +0000
committerBill Wendling <isanbard@gmail.com>2011-01-25 21:26:41 +0000
commit69c4ef321c9f6e12c66a3f2809e12faec21d4249 (patch)
tree71d6a8ee72aa8625233d1ce706480ac3dd5dcd1c /lib/MC
parent3971df5203146649a34dc50d217c0cc072d39be9 (diff)
Add support for parsing a Real value. It stores the Real value as its binary
encoding. It's up to the individual back-ends to convert it to their preferred representation when printing. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124229 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/MC')
-rw-r--r--lib/MC/MCParser/AsmParser.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/MC/MCParser/AsmParser.cpp b/lib/MC/MCParser/AsmParser.cpp
index 0b0df0285d..b72894db78 100644
--- a/lib/MC/MCParser/AsmParser.cpp
+++ b/lib/MC/MCParser/AsmParser.cpp
@@ -563,6 +563,13 @@ bool AsmParser::ParsePrimaryExpr(const MCExpr *&Res, SMLoc &EndLoc) {
}
return false;
}
+ case AsmToken::Real: {
+ APFloat RealVal(APFloat::IEEEdouble, getTok().getString());
+ int64_t IntVal = RealVal.bitcastToAPInt().getSExtValue();
+ Res = MCConstantExpr::Create(IntVal, getContext());
+ Lex(); // Eat token.
+ return false;
+ }
case AsmToken::Dot: {
// This is a '.' reference, which references the current PC. Emit a
// temporary label to the streamer and refer to it.
@@ -573,7 +580,6 @@ bool AsmParser::ParsePrimaryExpr(const MCExpr *&Res, SMLoc &EndLoc) {
Lex(); // Eat identifier.
return false;
}
-
case AsmToken::LParen:
Lex(); // Eat the '('.
return ParseParenExpr(Res, EndLoc);