opening "-" automatically yields stdout.
[oota-llvm.git] / lib / CodeGen / AsmPrinter.cpp
index 1ee71bdc72b79848bad59ec2a1a7cba58a22a103..16f26c429921319f512628b78417e2454615347b 100644 (file)
@@ -493,23 +493,12 @@ void AsmPrinter::PrintULEB128(unsigned Value) const {
   } while (Value);
 }
 
-/// SizeULEB128 - Compute the number of bytes required for an unsigned leb128
-/// value.
-unsigned AsmPrinter::SizeULEB128(unsigned Value) {
-  unsigned Size = 0;
-  do {
-    Value >>= 7;
-    Size += sizeof(int8_t);
-  } while (Value);
-  return Size;
-}
-
 /// PrintSLEB128 - Print a series of hexidecimal values (separated by commas)
 /// representing a signed leb128 value.
 void AsmPrinter::PrintSLEB128(int Value) const {
   int Sign = Value >> (8 * sizeof(Value) - 1);
   bool IsMore;
-  
+
   do {
     unsigned Byte = Value & 0x7f;
     Value >>= 7;
@@ -520,22 +509,6 @@ void AsmPrinter::PrintSLEB128(int Value) const {
   } while (IsMore);
 }
 
-/// SizeSLEB128 - Compute the number of bytes required for a signed leb128
-/// value.
-unsigned AsmPrinter::SizeSLEB128(int Value) {
-  unsigned Size = 0;
-  int Sign = Value >> (8 * sizeof(Value) - 1);
-  bool IsMore;
-  
-  do {
-    unsigned Byte = Value & 0x7f;
-    Value >>= 7;
-    IsMore = Value != Sign || ((Byte ^ Sign) & 0x40) != 0;
-    Size += sizeof(int8_t);
-  } while (IsMore);
-  return Size;
-}
-
 //===--------------------------------------------------------------------===//
 // Emission and print routines
 //
@@ -1469,3 +1442,14 @@ void AsmPrinter::printSuffixedName(const char *Name, const char *Suffix,
 void AsmPrinter::printSuffixedName(const std::string &Name, const char* Suffix) {
   printSuffixedName(Name.c_str(), Suffix);
 }
+
+void AsmPrinter::printVisibility(const std::string& Name,
+                                 unsigned Visibility) const {
+  if (Visibility == GlobalValue::HiddenVisibility) {
+    if (const char *Directive = TAI->getHiddenDirective())
+      O << Directive << Name << '\n';
+  } else if (Visibility == GlobalValue::ProtectedVisibility) {
+    if (const char *Directive = TAI->getProtectedDirective())
+      O << Directive << Name << '\n';
+  }
+}