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 {
}
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())
}
case '\n':
++LastEmitted; // Consume newline character.
- O << "\n\t"; // Indent code with newline.
+ O << "\n"; // Indent code with newline.
break;
case '$': {
++LastEmitted; // Consume '$' character.