llvm-mc: Pass values to MCStreamer as MCExprs, not MCValues.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80578 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/tools/llvm-mc/AsmParser.cpp b/tools/llvm-mc/AsmParser.cpp
index dbceb6b..a782561 100644
--- a/tools/llvm-mc/AsmParser.cpp
+++ b/tools/llvm-mc/AsmParser.cpp
@@ -21,7 +21,6 @@
 #include "llvm/MC/MCSectionMachO.h"
 #include "llvm/MC/MCStreamer.h"
 #include "llvm/MC/MCSymbol.h"
-#include "llvm/MC/MCValue.h"
 #include "llvm/Support/SourceMgr.h"
 #include "llvm/Support/raw_ostream.h"
 #include "llvm/Target/TargetAsmParser.h"
@@ -712,15 +711,11 @@
   // FIXME: Use better location, we should use proper tokens.
   SMLoc EqualLoc = Lexer.getLoc();
 
-  MCValue Value;
-  const MCExpr *Expr;
+  const MCExpr *Value;
   SMLoc StartLoc = Lexer.getLoc();
-  if (ParseExpression(Expr))
+  if (ParseExpression(Value))
     return true;
   
-  if (!Expr->EvaluateAsRelocatable(Ctx, Value))
-    return Error(StartLoc, "expected relocatable expression");
-
   if (Lexer.isNot(AsmToken::EndOfStatement))
     return TokError("unexpected token in assignment");
 
@@ -937,15 +932,11 @@
 bool AsmParser::ParseDirectiveValue(unsigned Size) {
   if (Lexer.isNot(AsmToken::EndOfStatement)) {
     for (;;) {
-      MCValue Value;
-      const MCExpr *Expr;
+      const MCExpr *Value;
       SMLoc StartLoc = Lexer.getLoc();
-      if (ParseExpression(Expr))
+      if (ParseExpression(Value))
         return true;
 
-      if (!Expr->EvaluateAsRelocatable(Ctx, Value))
-        return Error(StartLoc, "expected relocatable expression");
-
       Out.EmitValue(Value, Size);
 
       if (Lexer.is(AsmToken::EndOfStatement))
@@ -992,7 +983,7 @@
 
   // FIXME: Sometimes the fill expr is 'nop' if it isn't supplied, instead of 0.
   for (uint64_t i = 0, e = NumBytes; i != e; ++i)
-    Out.EmitValue(MCValue::get(FillExpr), 1);
+    Out.EmitValue(MCConstantExpr::Create(FillExpr, getContext()), 1);
 
   return false;
 }
@@ -1029,7 +1020,7 @@
     return TokError("invalid '.fill' size, expected 1, 2, 4, or 8");
 
   for (uint64_t i = 0, e = NumValues; i != e; ++i)
-    Out.EmitValue(MCValue::get(FillExpr), FillSize);
+    Out.EmitValue(MCConstantExpr::Create(FillExpr, getContext()), FillSize);
 
   return false;
 }
@@ -1037,15 +1028,11 @@
 /// ParseDirectiveOrg
 ///  ::= .org expression [ , expression ]
 bool AsmParser::ParseDirectiveOrg() {
-  MCValue Offset;
-  const MCExpr *Expr;
+  const MCExpr *Offset;
   SMLoc StartLoc = Lexer.getLoc();
-  if (ParseExpression(Expr))
+  if (ParseExpression(Offset))
     return true;
 
-  if (!Expr->EvaluateAsRelocatable(Ctx, Offset))
-    return Error(StartLoc, "expected relocatable expression");
-
   // Parse optional fill expression.
   int64_t FillExpr = 0;
   if (Lexer.isNot(AsmToken::EndOfStatement)) {
@@ -1417,15 +1404,11 @@
     return TokError("unexpected token in '.lsym' directive");
   Lexer.Lex();
 
-  MCValue Value;
-  const MCExpr *Expr;
+  const MCExpr *Value;
   SMLoc StartLoc = Lexer.getLoc();
-  if (ParseExpression(Expr))
+  if (ParseExpression(Value))
     return true;
 
-  if (!Expr->EvaluateAsRelocatable(Ctx, Value))
-    return Error(StartLoc, "expected relocatable expression");
-
   if (Lexer.isNot(AsmToken::EndOfStatement))
     return TokError("unexpected token in '.lsym' directive");