const XCoreSubtarget &Subtarget;
public:
explicit XCoreAsmPrinter(raw_ostream &O, XCoreTargetMachine &TM,
- const TargetAsmInfo *T, CodeGenOpt::Level OL,
- bool V)
- : AsmPrinter(O, TM, T, OL, V), DW(0),
+ const TargetAsmInfo *T, bool V)
+ : AsmPrinter(O, TM, T, V), DW(0),
Subtarget(*TM.getSubtargetImpl()) {}
virtual const char *getPassName() const {
///
FunctionPass *llvm::createXCoreCodePrinterPass(raw_ostream &o,
XCoreTargetMachine &tm,
- CodeGenOpt::Level OptLevel,
bool verbose) {
- return new XCoreAsmPrinter(o, tm, tm.getTargetAsmInfo(), OptLevel, verbose);
+ return new XCoreAsmPrinter(o, tm, tm.getTargetAsmInfo(), verbose);
}
// PrintEscapedString - Print each character of the specified string, escaping
EmitAlignment(Align, GV, 2);
- unsigned Size = TD->getTypePaddedSize(C->getType());
+ unsigned Size = TD->getTypeAllocSize(C->getType());
if (GV->isThreadLocal()) {
Size *= MaxThreads;
}
// Mark the end of the global
O << "\t.cc_bottom " << name << ".data\n";
- } else {
- if (GV->hasExternalWeakLinkage())
- ExtWeakSymbols.insert(GV);
}
}
break;
}
// (1 << 1) byte aligned
- EmitAlignment(1, F, 1);
+ EmitAlignment(MF.getAlignment(), F, 1);
if (TAI->hasDotTypeDotSizeDirective()) {
O << "\t.type " << CurrentFnName << ",@function\n";
}
printBasicBlockLabel(MO.getMBB());
break;
case MachineOperand::MO_GlobalAddress:
- {
- const GlobalValue *GV = MO.getGlobal();
- O << Mang->getValueName(GV);
- if (GV->hasExternalWeakLinkage())
- ExtWeakSymbols.insert(GV);
- }
+ O << Mang->getValueName(MO.getGlobal());
break;
case MachineOperand::MO_ExternalSymbol:
O << MO.getSymbolName();
bool XCoreAsmPrinter::doInitialization(Module &M) {
bool Result = AsmPrinter::doInitialization(M);
+ DW = getAnalysisIfAvailable<DwarfWriter>();
- if (!FileDirective.empty()) {
+ if (!FileDirective.empty())
emitFileDirective(FileDirective);
- }
-
- // Print out type strings for external functions here
- for (Module::const_iterator I = M.begin(), E = M.end();
- I != E; ++I) {
- if (I->isDeclaration() && !I->isIntrinsic()) {
- switch (I->getLinkage()) {
- default:
- assert(0 && "Unexpected linkage");
- case Function::ExternalWeakLinkage:
- ExtWeakSymbols.insert(I);
- // fallthrough
- case Function::ExternalLinkage:
- break;
- }
- }
- }
- // Emit initial debug information.
- DW = getAnalysisIfAvailable<DwarfWriter>();
- assert(DW && "Dwarf Writer is not available");
- DW->BeginModule(&M, getAnalysisIfAvailable<MachineModuleInfo>(),
- O, this, TAI);
return Result;
}
emitGlobal(I);
}
- // Emit final debug information.
- DW->EndModule();
-
return AsmPrinter::doFinalization(M);
}