virtual bool runOnMachineFunction(MachineFunction &F) = 0;
virtual bool doFinalization(Module &M) = 0;
-
};
/// DarwinAsmPrinter - PowerPC assembly printer, customized for Darwin/Mac OS
PPCAsmPrinter::getAnalysisUsage(AU);
}
+ /// getSectionForFunction - Return the section that we should emit the
+ /// specified function body into.
+ virtual std::string getSectionForFunction(const Function &F) const;
};
} // end of anonymous namespace
return;
}
+
+
+std::string DarwinAsmPrinter::getSectionForFunction(const Function &F) const {
+ switch (F.getLinkage()) {
+ default: assert(0 && "Unknown linkage type!");
+ case Function::ExternalLinkage:
+ case Function::InternalLinkage: return TAI->getTextSection();
+ case Function::WeakLinkage:
+ case Function::LinkOnceLinkage:
+ return ".section __TEXT,__textcoal_nt,coalesced,pure_instructions";
+ }
+}
+
/// runOnMachineFunction - This uses the printMachineInstruction()
/// method to print assembly for each instruction.
///
// Print out labels for the function.
const Function *F = MF.getFunction();
- SwitchToTextSection(TAI->getSectionForFunction(*F), F);
+ SwitchToTextSection(getSectionForFunction(*F).c_str(), F);
switch (F->getLinkage()) {
default: assert(0 && "Unknown linkage type!");
DwarfMacInfoSection = ".section __DWARF,__debug_macinfo";
}
-
-const char *DarwinTargetAsmInfo::getSectionForFunction(const Function &F) const{
- switch (F.getLinkage()) {
- default: assert(0 && "Unknown linkage type!");
- case Function::ExternalLinkage:
- case Function::InternalLinkage: return TextSection;
- case Function::WeakLinkage:
- case Function::LinkOnceLinkage:
- return ".section __TEXT,__textcoal_nt,coalesced,pure_instructions";
- }
-}
struct DarwinTargetAsmInfo : public TargetAsmInfo {
DarwinTargetAsmInfo(const PPCTargetMachine &TM);
-
- /// getSectionForFunction - Return the section that we should emit the
- /// specified function body into. This defaults to 'TextSection'. This
- /// should most likely be overridden by the target to put linkonce/weak
- /// functions into special sections.
- virtual const char *getSectionForFunction(const Function &F) const;
};
} // namespace llvm