Introduce TargetType's ELF and Darwin.
authorEvan Cheng <evan.cheng@apple.com>
Fri, 19 Jan 2007 19:22:40 +0000 (19:22 +0000)
committerEvan Cheng <evan.cheng@apple.com>
Fri, 19 Jan 2007 19:22:40 +0000 (19:22 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33363 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/ARM/ARMSubtarget.cpp
lib/Target/ARM/ARMSubtarget.h

index 35bb9accc3507ee46afa767960b60182360101d1..27889c7818daad48e4b058d5ada8407f10871f46 100644 (file)
@@ -22,8 +22,12 @@ static cl::opt<bool> Thumb("enable-thumb",
                            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 @@ ARMSubtarget::ARMSubtarget(const Module &M, const std::string &FS)
   // 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;
index d5c4b5eb0391edee737952591b8d1a39d13c94bf..33e440b0cf411b7b5c453c40c4400addf12bb788 100644 (file)
@@ -37,8 +37,6 @@ protected:
   /// 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 @@ protected:
   unsigned stackAlignment;
 
  public:
+  enum {
+    isELF, isDarwin
+  } TargetType;
+
   /// This constructor initializes the data members to match that
   /// of the specified module.
   ///
@@ -66,7 +68,9 @@ protected:
 
   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; }