[llvm-commits] CVS: llvm/lib/Target/ARM/ARMSubtarget.h ARMSubtarget.cpp

Evan Cheng evan.cheng at apple.com
Fri Jan 19 11:22:55 PST 2007



Changes in directory llvm/lib/Target/ARM:

ARMSubtarget.h updated: 1.1 -> 1.2
ARMSubtarget.cpp updated: 1.1 -> 1.2
---
Log message:

Introduce TargetType's ELF and Darwin.

---
Diffs of the changes:  (+17 -8)

 ARMSubtarget.cpp |   15 ++++++++++-----
 ARMSubtarget.h   |   10 +++++++---
 2 files changed, 17 insertions(+), 8 deletions(-)


Index: llvm/lib/Target/ARM/ARMSubtarget.h
diff -u llvm/lib/Target/ARM/ARMSubtarget.h:1.1 llvm/lib/Target/ARM/ARMSubtarget.h:1.2
--- llvm/lib/Target/ARM/ARMSubtarget.h:1.1	Fri Jan 19 01:51:42 2007
+++ llvm/lib/Target/ARM/ARMSubtarget.h	Fri Jan 19 13:22:40 2007
@@ -37,8 +37,6 @@
   /// IsThumb - True if we are in thumb mode, false if in ARM mode.
   bool IsThumb;
 
-  bool IsDarwin;
-  
   /// UseThumbBacktraces - True if we use thumb style backtraces.
   bool UseThumbBacktraces;
 
@@ -50,6 +48,10 @@
   unsigned stackAlignment;
 
  public:
+  enum {
+    isELF, isDarwin
+  } TargetType;
+
   /// This constructor initializes the data members to match that
   /// of the specified module.
   ///
@@ -66,7 +68,9 @@
 
   bool hasVFP2() const { return HasVFP2; }
   
-  bool isDarwin() const { return IsDarwin; }
+  bool isTargetDarwin() const { return TargetType == isDarwin; }
+  bool isTargetELF() const { return TargetType == isELF; }
+
   bool isThumb() const { return IsThumb; }
 
   bool useThumbBacktraces() const { return UseThumbBacktraces; }


Index: llvm/lib/Target/ARM/ARMSubtarget.cpp
diff -u llvm/lib/Target/ARM/ARMSubtarget.cpp:1.1 llvm/lib/Target/ARM/ARMSubtarget.cpp:1.2
--- llvm/lib/Target/ARM/ARMSubtarget.cpp:1.1	Fri Jan 19 01:51:42 2007
+++ llvm/lib/Target/ARM/ARMSubtarget.cpp	Fri Jan 19 13:22:40 2007
@@ -22,8 +22,12 @@
                            cl::desc("Switch to thumb mode in ARM backend"));
 
 ARMSubtarget::ARMSubtarget(const Module &M, const std::string &FS)
-  : ARMArchVersion(V4T), HasVFP2(false), IsDarwin(false),
-    UseThumbBacktraces(false), IsR9Reserved(false), stackAlignment(8) {
+  : ARMArchVersion(V4T)
+  , HasVFP2(false)
+  , UseThumbBacktraces(false)
+  , IsR9Reserved(false)
+  , stackAlignment(8)
+  , TargetType(isELF) { // Default to ELF unless otherwise specified.
 
   // Determine default and user specified characteristics
   std::string CPU = "generic";
@@ -37,14 +41,15 @@
   // if one cannot be determined, to true.
   const std::string& TT = M.getTargetTriple();
   if (TT.length() > 5) {
-    IsDarwin = TT.find("-darwin") != std::string::npos;
+    if (TT.find("-darwin") != std::string::npos)
+      TargetType = isDarwin;
   } else if (TT.empty()) {
 #if defined(__APPLE__)
-    IsDarwin = true;
+    TargetType = isDarwin;
 #endif
   }
 
-  if (IsDarwin) {
+  if (isTargetDarwin()) {
     UseThumbBacktraces = true;
     IsR9Reserved = true;
     stackAlignment = 4;






More information about the llvm-commits mailing list