[llvm-commits] CVS: llvm/lib/Target/PowerPC/PPCSubtarget.cpp PPCSubtarget.h PPCTargetAsmInfo.cpp

Bill Wendling isanbard at gmail.com
Tue Jan 16 01:29:38 PST 2007



Changes in directory llvm/lib/Target/PowerPC:

PPCSubtarget.cpp updated: 1.27 -> 1.28
PPCSubtarget.h updated: 1.20 -> 1.21
PPCTargetAsmInfo.cpp updated: 1.12 -> 1.13
---
Log message:

Instead of yet another enum indicating the "assembly language flavor",
just use the one that's in the subtarget.



---
Diffs of the changes:  (+16 -9)

 PPCSubtarget.cpp     |    3 +++
 PPCSubtarget.h       |   13 ++++++++++++-
 PPCTargetAsmInfo.cpp |    9 +--------
 3 files changed, 16 insertions(+), 9 deletions(-)


Index: llvm/lib/Target/PowerPC/PPCSubtarget.cpp
diff -u llvm/lib/Target/PowerPC/PPCSubtarget.cpp:1.27 llvm/lib/Target/PowerPC/PPCSubtarget.cpp:1.28
--- llvm/lib/Target/PowerPC/PPCSubtarget.cpp:1.27	Mon Dec 11 17:22:45 2006
+++ llvm/lib/Target/PowerPC/PPCSubtarget.cpp	Tue Jan 16 03:29:16 2007
@@ -112,6 +112,9 @@
   // Set up darwin-specific properties.
   if (IsDarwin) {
     HasLazyResolverStubs = true;
+    AsmFlavor = NewMnemonic;
+  } else {
+    AsmFlavor = OldMnemonic;
   }
 }
 


Index: llvm/lib/Target/PowerPC/PPCSubtarget.h
diff -u llvm/lib/Target/PowerPC/PPCSubtarget.h:1.20 llvm/lib/Target/PowerPC/PPCSubtarget.h:1.21
--- llvm/lib/Target/PowerPC/PPCSubtarget.h:1.20	Tue Dec 12 14:57:08 2006
+++ llvm/lib/Target/PowerPC/PPCSubtarget.h	Tue Jan 16 03:29:16 2007
@@ -40,6 +40,10 @@
 class TargetMachine;
   
 class PPCSubtarget : public TargetSubtarget {
+public:
+  enum AsmWriterFlavorTy {
+    OldMnemonic, NewMnemonic, Unset
+  };
 protected:
   const TargetMachine &TM;
   
@@ -53,6 +57,9 @@
   /// Which cpu directive was used.
   unsigned DarwinDirective;
 
+  /// AsmFlavor - Which PPC asm dialect to use.
+  AsmWriterFlavorTy AsmFlavor;
+
   /// Used by the ISel to turn in optimizations for POWER4-derived architectures
   bool IsGigaProcessor;
   bool Has64BitSupport;
@@ -120,8 +127,12 @@
   bool hasSTFIWX() const { return HasSTFIWX; }
   bool hasAltivec() const { return HasAltivec; }
   bool isGigaProcessor() const { return IsGigaProcessor; }
-  
+
   bool isDarwin() const { return IsDarwin; }
+
+  unsigned getAsmFlavor() const {
+    return AsmFlavor != Unset ? unsigned(AsmFlavor) : 0;
+  }
 };
 } // End llvm namespace
 


Index: llvm/lib/Target/PowerPC/PPCTargetAsmInfo.cpp
diff -u llvm/lib/Target/PowerPC/PPCTargetAsmInfo.cpp:1.12 llvm/lib/Target/PowerPC/PPCTargetAsmInfo.cpp:1.13
--- llvm/lib/Target/PowerPC/PPCTargetAsmInfo.cpp:1.12	Mon Jan 15 21:42:04 2007
+++ llvm/lib/Target/PowerPC/PPCTargetAsmInfo.cpp	Tue Jan 16 03:29:16 2007
@@ -16,12 +16,6 @@
 #include "llvm/Function.h"
 using namespace llvm;
 
-// ASM variant to use.
-enum {
-  PPC_OLD_MNEMONICS = 0,
-  PPC_NEW_MNEMONICS = 1
-};
-
 PPCTargetAsmInfo::PPCTargetAsmInfo(const PPCTargetMachine &TM) {
   bool isPPC64 = TM.getSubtargetImpl()->isPPC64();
   
@@ -32,7 +26,7 @@
   LCOMMDirective = "\t.lcomm\t";
   InlineAsmStart = "# InlineAsm Start";
   InlineAsmEnd = "# InlineAsm End";
-  AssemblerDialect = PPC_OLD_MNEMONICS;
+  AssemblerDialect = TM.getSubtargetImpl()->getAsmFlavor();
   
   NeedsSet = true;
   AddressSize = isPPC64 ? 8 : 4;
@@ -63,7 +57,6 @@
   UsedDirective = "\t.no_dead_strip\t";
   WeakRefDirective = "\t.weak_reference\t";
   HiddenDirective = "\t.private_extern\t";
-  AssemblerDialect = PPC_NEW_MNEMONICS;
 }
 
 LinuxTargetAsmInfo::LinuxTargetAsmInfo(const PPCTargetMachine &TM)






More information about the llvm-commits mailing list