[llvm-commits] CVS: llvm/lib/Target/PowerPC/PPC.h PPCAsmPrinter.cpp PPCSubtarget.cpp PPCSubtarget.h PPCTargetMachine.cpp

Chris Lattner lattner at cs.uiuc.edu
Fri Jul 14 18:24:36 PDT 2006



Changes in directory llvm/lib/Target/PowerPC:

PPC.h updated: 1.29 -> 1.30
PPCAsmPrinter.cpp updated: 1.186 -> 1.187
PPCSubtarget.cpp updated: 1.24 -> 1.25
PPCSubtarget.h updated: 1.16 -> 1.17
PPCTargetMachine.cpp updated: 1.97 -> 1.98
---
Log message:

Remove what little AIX support we have.  It has never been tested and isn't
complete.


---
Diffs of the changes:  (+2 -169)

 PPC.h                |    1 
 PPCAsmPrinter.cpp    |  154 ---------------------------------------------------
 PPCSubtarget.cpp     |    7 --
 PPCSubtarget.h       |    2 
 PPCTargetMachine.cpp |    7 --
 5 files changed, 2 insertions(+), 169 deletions(-)


Index: llvm/lib/Target/PowerPC/PPC.h
diff -u llvm/lib/Target/PowerPC/PPC.h:1.29 llvm/lib/Target/PowerPC/PPC.h:1.30
--- llvm/lib/Target/PowerPC/PPC.h:1.29	Fri Jun 16 13:50:48 2006
+++ llvm/lib/Target/PowerPC/PPC.h	Fri Jul 14 20:24:23 2006
@@ -24,7 +24,6 @@
 FunctionPass *createPPCBranchSelectionPass();
 FunctionPass *createPPCISelDag(PPCTargetMachine &TM);
 FunctionPass *createDarwinAsmPrinter(std::ostream &OS, PPCTargetMachine &TM);
-FunctionPass *createAIXAsmPrinter(std::ostream &OS, PPCTargetMachine &TM);
 } // end namespace llvm;
 
 // GCC #defines PPC on Linux but we use it as our namespace name


Index: llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
diff -u llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp:1.186 llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp:1.187
--- llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp:1.186	Wed Jul 12 18:24:02 2006
+++ llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp	Fri Jul 14 20:24:23 2006
@@ -306,32 +306,6 @@
     }
 
   };
-
-  /// AIXAsmPrinter - PowerPC assembly printer, customized for AIX
-  ///
-  struct VISIBILITY_HIDDEN AIXAsmPrinter : public PPCAsmPrinter {
-    /// Map for labels corresponding to global variables
-    ///
-    std::map<const GlobalVariable*,std::string> GVToLabelMap;
-
-    AIXAsmPrinter(std::ostream &O, TargetMachine &TM)
-      : PPCAsmPrinter(O, TM) {
-      CommentString = "#";
-      GlobalPrefix = ".";
-      ZeroDirective = "\t.space\t";  // ".space N" emits N zeros.
-      Data64bitsDirective = 0;       // we can't emit a 64-bit unit
-      AlignmentIsInBytes = false;    // Alignment is by power of 2.
-      ConstantPoolSection = "\t.const\t";
-    }
-
-    virtual const char *getPassName() const {
-      return "AIX PPC Assembly Printer";
-    }
-
-    bool runOnMachineFunction(MachineFunction &F);
-    bool doInitialization(Module &M);
-    bool doFinalization(Module &M);
-  };
 } // end of anonymous namespace
 
 /// createDarwinAsmPrinterPass - Returns a pass that prints the PPC assembly
@@ -343,14 +317,6 @@
   return new DarwinAsmPrinter(o, tm);
 }
 
-/// createAIXAsmPrinterPass - Returns a pass that prints the PPC assembly code
-/// for a MachineFunction to the given output stream, in a format that the
-/// AIX 5L assembler can deal with.
-///
-FunctionPass *llvm::createAIXAsmPrinter(std::ostream &o, PPCTargetMachine &tm) {
-  return new AIXAsmPrinter(o, tm);
-}
-
 // Include the auto-generated portion of the assembly writer
 #include "PPCGenAsmWriter.inc"
 
@@ -717,123 +683,3 @@
   return false; // success
 }
 
-/// runOnMachineFunction - This uses the printMachineInstruction()
-/// method to print assembly for each instruction.
-///
-bool AIXAsmPrinter::runOnMachineFunction(MachineFunction &MF) {
-  SetupMachineFunction(MF);
-  
-  // Print out constants referenced by the function
-  EmitConstantPool(MF.getConstantPool());
-
-  // Print out header for the function.
-  O << "\t.csect .text[PR]\n"
-    << "\t.align 2\n"
-    << "\t.globl "  << CurrentFnName << '\n'
-    << "\t.globl ." << CurrentFnName << '\n'
-    << "\t.csect "  << CurrentFnName << "[DS],3\n"
-    << CurrentFnName << ":\n"
-    << "\t.llong ." << CurrentFnName << ", TOC[tc0], 0\n"
-    << "\t.csect .text[PR]\n"
-    << '.' << CurrentFnName << ":\n";
-
-  // Print out code for the function.
-  for (MachineFunction::const_iterator I = MF.begin(), E = MF.end();
-       I != E; ++I) {
-    printBasicBlockLabel(I);
-    O << '\n';
-    for (MachineBasicBlock::const_iterator II = I->begin(), E = I->end();
-      II != E; ++II) {
-      // Print the assembly for the instruction.
-      O << "\t";
-      printMachineInstruction(II);
-    }
-  }
-
-  O << "LT.." << CurrentFnName << ":\n"
-    << "\t.long 0\n"
-    << "\t.byte 0,0,32,65,128,0,0,0\n"
-    << "\t.long LT.." << CurrentFnName << "-." << CurrentFnName << '\n'
-    << "\t.short 3\n"
-    << "\t.byte \"" << CurrentFnName << "\"\n"
-    << "\t.align 2\n";
-
-  // We didn't modify anything.
-  return false;
-}
-
-bool AIXAsmPrinter::doInitialization(Module &M) {
-  SwitchToDataSection("", 0);
-
-  O << "\t.machine \"ppc64\"\n"
-    << "\t.toc\n"
-    << "\t.csect .text[PR]\n";
-
-  // Print out module-level global variables
-  for (Module::const_global_iterator I = M.global_begin(), E = M.global_end();
-       I != E; ++I) {
-    if (!I->hasInitializer())
-      continue;
-
-    std::string Name = I->getName();
-    Constant *C = I->getInitializer();
-    // N.B.: We are defaulting to writable strings
-    if (I->hasExternalLinkage()) {
-      O << "\t.globl " << Name << '\n'
-        << "\t.csect .data[RW],3\n";
-    } else {
-      O << "\t.csect _global.rw_c[RW],3\n";
-    }
-    O << Name << ":\n";
-    EmitGlobalConstant(C);
-  }
-
-  // Output labels for globals
-  if (M.global_begin() != M.global_end()) O << "\t.toc\n";
-  for (Module::const_global_iterator I = M.global_begin(), E = M.global_end();
-       I != E; ++I) {
-    const GlobalVariable *GV = I;
-    // Do not output labels for unused variables
-    if (GV->isExternal() && GV->use_begin() == GV->use_end())
-      continue;
-
-    IncrementFunctionNumber();
-    std::string Name = GV->getName();
-    std::string Label = "LC.." + utostr(getFunctionNumber());
-    GVToLabelMap[GV] = Label;
-    O << Label << ":\n"
-      << "\t.tc " << Name << "[TC]," << Name;
-    if (GV->isExternal()) O << "[RW]";
-    O << '\n';
-   }
-
-  AsmPrinter::doInitialization(M);
-  return false; // success
-}
-
-bool AIXAsmPrinter::doFinalization(Module &M) {
-  const TargetData *TD = TM.getTargetData();
-  // Print out module-level global variables
-  for (Module::const_global_iterator I = M.global_begin(), E = M.global_end();
-       I != E; ++I) {
-    if (I->hasInitializer() || I->hasExternalLinkage())
-      continue;
-
-    std::string Name = I->getName();
-    if (I->hasInternalLinkage()) {
-      O << "\t.lcomm " << Name << ",16,_global.bss_c";
-    } else {
-      O << "\t.comm " << Name << "," << TD->getTypeSize(I->getType())
-        << "," << Log2_32((unsigned)TD->getTypeAlignment(I->getType()));
-    }
-    O << "\t\t" << CommentString << " ";
-    WriteAsOperand(O, I, false, true, &M);
-    O << "\n";
-  }
-
-  O << "_section_.text:\n"
-    << "\t.csect .data[RW],3\n"
-    << "\t.llong _section_.text\n";
-  AsmPrinter::doFinalization(M);
-  return false; // success
-}


Index: llvm/lib/Target/PowerPC/PPCSubtarget.cpp
diff -u llvm/lib/Target/PowerPC/PPCSubtarget.cpp:1.24 llvm/lib/Target/PowerPC/PPCSubtarget.cpp:1.25
--- llvm/lib/Target/PowerPC/PPCSubtarget.cpp:1.24	Fri Jun 16 15:05:06 2006
+++ llvm/lib/Target/PowerPC/PPCSubtarget.cpp	Fri Jul 14 20:24:23 2006
@@ -66,7 +66,6 @@
   , HasAltivec(false)
   , HasFSQRT(false)
   , HasSTFIWX(false)
-  , IsAIX(false)
   , IsDarwin(false) {
 
   // Determine default and user specified characteristics
@@ -102,12 +101,8 @@
   const std::string& TT = M.getTargetTriple();
   if (TT.length() > 5) {
     IsDarwin = TT.find("-darwin") != std::string::npos;
-    if (!IsDarwin)
-      IsAIX = TT.find("-aix") != std::string::npos;
   } else if (TT.empty()) {
-#if defined(_POWER)
-    IsAIX = true;
-#elif defined(__APPLE__)
+#if defined(__APPLE__)
     IsDarwin = true;
 #endif
   }


Index: llvm/lib/Target/PowerPC/PPCSubtarget.h
diff -u llvm/lib/Target/PowerPC/PPCSubtarget.h:1.16 llvm/lib/Target/PowerPC/PPCSubtarget.h:1.17
--- llvm/lib/Target/PowerPC/PPCSubtarget.h:1.16	Fri Jun 16 12:50:12 2006
+++ llvm/lib/Target/PowerPC/PPCSubtarget.h	Fri Jul 14 20:24:23 2006
@@ -39,7 +39,6 @@
   bool HasAltivec;
   bool HasFSQRT;
   bool HasSTFIWX;
-  bool IsAIX;
   bool IsDarwin;
 public:
   /// This constructor initializes the data members to match that
@@ -86,7 +85,6 @@
   bool hasAltivec() const { return HasAltivec; }
   bool isGigaProcessor() const { return IsGigaProcessor; }
   
-  bool isAIX() const { return IsAIX; }
   bool isDarwin() const { return IsDarwin; }
 };
 } // End llvm namespace


Index: llvm/lib/Target/PowerPC/PPCTargetMachine.cpp
diff -u llvm/lib/Target/PowerPC/PPCTargetMachine.cpp:1.97 llvm/lib/Target/PowerPC/PPCTargetMachine.cpp:1.98
--- llvm/lib/Target/PowerPC/PPCTargetMachine.cpp:1.97	Wed Jul 12 15:42:10 2006
+++ llvm/lib/Target/PowerPC/PPCTargetMachine.cpp	Fri Jul 14 20:24:23 2006
@@ -146,12 +146,7 @@
   // Must run branch selection immediately preceding the asm printer
   PM.add(createPPCBranchSelectionPass());
 
-  // Decide which asm printer to use.  If the user has not specified one on
-  // the command line, choose whichever one matches the default (current host).
-  if (Subtarget.isAIX())
-    PM.add(createAIXAsmPrinter(Out, *this));
-  else
-    PM.add(createDarwinAsmPrinter(Out, *this));
+  PM.add(createDarwinAsmPrinter(Out, *this));
 
   PM.add(createMachineCodeDeleter());
   return false;






More information about the llvm-commits mailing list