Wrap some darwin'isms with isDarwin checks.
authorChris Lattner <sabre@nondot.org>
Wed, 20 Sep 2006 17:07:15 +0000 (17:07 +0000)
committerChris Lattner <sabre@nondot.org>
Wed, 20 Sep 2006 17:07:15 +0000 (17:07 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30541 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/PowerPC/PPCAsmPrinter.cpp

index b50fc45959994dbd3f993ffca605b4a7b2fd792c..e04e72d7499edd0214ee85e146b3c0dfb84b23f0 100644 (file)
@@ -49,9 +49,11 @@ namespace {
 
   struct VISIBILITY_HIDDEN PPCAsmPrinter : public AsmPrinter {
     std::set<std::string> FnStubs, GVStubs;
+    const PPCSubtarget &Subtarget;
     
     PPCAsmPrinter(std::ostream &O, TargetMachine &TM, const TargetAsmInfo *T)
-      : AsmPrinter(O, TM, T) {}
+      : AsmPrinter(O, TM, T), Subtarget(TM.getSubtarget<PPCSubtarget>()) {
+    }
 
     virtual const char *getPassName() const {
       return "PowerPC Assembly Printer";
@@ -248,7 +250,7 @@ namespace {
     DarwinAsmPrinter(std::ostream &O, PPCTargetMachine &TM,
                      const TargetAsmInfo *T)
       : PPCAsmPrinter(O, TM, T), DW(O, this, T) {
-      bool isPPC64 = TM.getSubtargetImpl()->isPPC64();
+      bool isPPC64 = Subtarget.isPPC64();
     }
 
     virtual const char *getPassName() const {
@@ -480,7 +482,7 @@ bool DarwinAsmPrinter::runOnMachineFunction(MachineFunction &MF) {
 
 
 bool DarwinAsmPrinter::doInitialization(Module &M) {
-  if (TM.getSubtarget<PPCSubtarget>().isGigaProcessor())
+  if (Subtarget.isGigaProcessor())
     O << "\t.machine ppc970\n";
   AsmPrinter::doInitialization(M);
   
@@ -637,7 +639,8 @@ bool DarwinAsmPrinter::doFinalization(Module &M) {
   // implementation of multiple entry points).  If this doesn't occur, the
   // linker can safely perform dead code stripping.  Since LLVM never generates
   // code that does this, it is always safe to set.
-  O << "\t.subsections_via_symbols\n";
+  if (Subtarget.isDarwin())
+    O << "\t.subsections_via_symbols\n";
 
   AsmPrinter::doFinalization(M);
   return false; // success