llvm-mc: Use EmitIntValue where possible, which makes the API calls from the AsmParse...
authorDaniel Dunbar <daniel@zuster.org>
Sun, 23 May 2010 18:36:38 +0000 (18:36 +0000)
committerDaniel Dunbar <daniel@zuster.org>
Sun, 23 May 2010 18:36:38 +0000 (18:36 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@104467 91177308-0d34-0410-b5e6-96231b3b80d8

lib/MC/MCParser/AsmParser.cpp

index 0d6eaec35fb355e6ffe14a46a856d47392714c39..4523eabb6371f6432cbbd60ddc16bdd9b12ffeee 100644 (file)
@@ -1083,7 +1083,11 @@ bool AsmParser::ParseDirectiveValue(unsigned Size) {
       if (ParseExpression(Value))
         return true;
 
-      Out.EmitValue(Value, Size, DEFAULT_ADDRSPACE);
+      // Special case constant expressions to match code generator.
+      if (const MCConstantExpr *MCE = dyn_cast<MCConstantExpr>(Value))
+        Out.EmitIntValue(MCE->getValue(), Size, DEFAULT_ADDRSPACE);
+      else
+        Out.EmitValue(Value, Size, DEFAULT_ADDRSPACE);
 
       if (Lexer.is(AsmToken::EndOfStatement))
         break;
@@ -1165,8 +1169,7 @@ bool AsmParser::ParseDirectiveFill() {
     return TokError("invalid '.fill' size, expected 1, 2, 4, or 8");
 
   for (uint64_t i = 0, e = NumValues; i != e; ++i)
-    Out.EmitValue(MCConstantExpr::Create(FillExpr, getContext()), FillSize,
-                  DEFAULT_ADDRSPACE);
+    Out.EmitIntValue(FillExpr, FillSize, DEFAULT_ADDRSPACE);
 
   return false;
 }