[Sparc] Use SparcMCExpr::VariantKind itself as MachineOperand's target flags.
[oota-llvm.git] / lib / Target / Sparc / MCTargetDesc / SparcMCExpr.cpp
index 45f2f9f11e4d72c71eb7e3ea53b480b4d99b239e..f38e31181845f2abcc2892f63841f7b4cf42d74f 100644 (file)
@@ -29,7 +29,20 @@ SparcMCExpr::Create(VariantKind Kind, const MCExpr *Expr,
 }
 
 
+
 void SparcMCExpr::PrintImpl(raw_ostream &OS) const
+{
+
+  bool closeParen = printVariantKind(OS, Kind);
+
+  const MCExpr *Expr = getSubExpr();
+  Expr->print(OS);
+
+  if (closeParen)
+    OS << ')';
+}
+
+bool SparcMCExpr::printVariantKind(raw_ostream &OS, VariantKind Kind)
 {
   bool closeParen = true;
   switch (Kind) {
@@ -61,11 +74,7 @@ void SparcMCExpr::PrintImpl(raw_ostream &OS) const
   case VK_Sparc_TLS_LE_HIX22:  OS << "%tle_hix22(";  break;
   case VK_Sparc_TLS_LE_LOX10:  OS << "%tle_lox10(";  break;
   }
-
-  const MCExpr *Expr = getSubExpr();
-  Expr->print(OS);
-  if (closeParen)
-    OS << ')';
+  return closeParen;
 }
 
 SparcMCExpr::VariantKind SparcMCExpr::parseVariantKind(StringRef name)