llvm-mc: Switch MCInst to storing an MCExpr* instead of an MCValue.

Also, use MCInst::print instead of custom code in MCAsmPrinter.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80575 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Target/X86/X86CodeEmitter.cpp b/lib/Target/X86/X86CodeEmitter.cpp
index 0c472a7..7e2fd97 100644
--- a/lib/Target/X86/X86CodeEmitter.cpp
+++ b/lib/Target/X86/X86CodeEmitter.cpp
@@ -30,6 +30,7 @@
 #include "llvm/Function.h"
 #include "llvm/ADT/Statistic.h"
 #include "llvm/MC/MCCodeEmitter.h"
+#include "llvm/MC/MCExpr.h"
 #include "llvm/MC/MCInst.h"
 #include "llvm/Support/Compiler.h"
 #include "llvm/Support/Debug.h"
@@ -968,12 +969,12 @@
       Instr->addOperand(MachineOperand::CreateImm(Op.getImm()));
       return true;
     }
-    if (!Op.isMCValue())
+    if (!Op.isExpr())
       return false;
 
-    const MCValue &Val = Op.getMCValue();
-    if (Val.isAbsolute()) {
-      Instr->addOperand(MachineOperand::CreateImm(Val.getConstant()));
+    const MCExpr *Expr = Op.getExpr();
+    if (const MCConstantExpr *CE = dyn_cast<MCConstantExpr>(Expr)) {
+      Instr->addOperand(MachineOperand::CreateImm(CE->getValue()));
       return true;
     }
 
@@ -1036,9 +1037,8 @@
       if (CurOp < NumOps) {
         // Hack to make branches work.
         if (!(Desc.TSFlags & X86II::ImmMask) &&
-            MI.getOperand(0).isMCValue() && 
-            MI.getOperand(0).getMCValue().getSymA() &&
-            !MI.getOperand(0).getMCValue().getSymB())
+            MI.getOperand(0).isExpr() &&
+            isa<MCSymbolRefExpr>(MI.getOperand(0).getExpr()))
           Instr->addOperand(MachineOperand::CreateMBB(DummyMBB));
         else
           OK &= AddImmToInstr(MI, Instr, CurOp);