Fix PR number.
[oota-llvm.git] / lib / CodeGen / AsmPrinter.cpp
index 90a98cb5a75a9f2fc8043501da95a2695310dc06..fd112a3531acaba3136bf8ae70feb6cfc5e70cdc 100644 (file)
@@ -32,9 +32,10 @@ using namespace llvm;
 static cl::opt<bool>
 AsmVerbose("asm-verbose", cl::Hidden, cl::desc("Add comments to directives."));
 
+char AsmPrinter::ID = 0;
 AsmPrinter::AsmPrinter(std::ostream &o, TargetMachine &tm,
                        const TargetAsmInfo *T)
-: FunctionNumber(0), O(o), TM(tm), TAI(T)
+  : MachineFunctionPass((intptr_t)&ID), FunctionNumber(0), O(o), TM(tm), TAI(T)
 {}
 
 std::string AsmPrinter::getSectionForFunction(const Function &F) const {
@@ -123,18 +124,20 @@ bool AsmPrinter::doFinalization(Module &M) {
   }
 
   if (TAI->getSetDirective()) {
-    if (M.alias_size())
+    if (!M.alias_empty())
       SwitchToTextSection(TAI->getTextSection());
 
     O << "\n";
     for (Module::const_alias_iterator I = M.alias_begin(), E = M.alias_end();
          I!=E; ++I) {
-      const GlobalValue *Aliasee = I->getAliasee();
-      assert(Aliasee && "Aliasee cannot be null!");
-      std::string Target   = Mang->getValueName(Aliasee);
-      std::string Name     = Mang->getValueName(I);
-
-      // Aliases with external weak linkage was emitted already
+      std::string Name = Mang->getValueName(I);
+      std::string Target;
+      
+      if (const GlobalValue *GV = I->getAliasedGlobal())
+        Target = Mang->getValueName(GV);
+      else
+        assert(0 && "Unsupported aliasee");
+      
       if (I->hasExternalLinkage())
         O << "\t.globl\t" << Name << "\n";
       else if (I->hasWeakLinkage())
@@ -952,7 +955,7 @@ void AsmPrinter::printInlineAsm(const MachineInstr *MI) const {
     }
     case '\n':
       ++LastEmitted;   // Consume newline character.
-      O << "\n\t";     // Indent code with newline.
+      O << "\n";       // Indent code with newline.
       break;
     case '$': {
       ++LastEmitted;   // Consume '$' character.