diff options
author | Evan Cheng <evan.cheng@apple.com> | 2007-02-23 03:14:31 +0000 |
---|---|---|
committer | Evan Cheng <evan.cheng@apple.com> | 2007-02-23 03:14:31 +0000 |
commit | 04321f70f5075673934d5b1ed3353dd15d911183 (patch) | |
tree | 7b36105632d99b6df27e87824d694611104d8cf1 | |
parent | cdc694440b930e085cfff61fe5a22082ea63a7c0 (diff) |
Added -march=thumb; removed -enable-thumb.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34521 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/Target/ARM/ARMSubtarget.cpp | 10 | ||||
-rw-r--r-- | lib/Target/ARM/ARMSubtarget.h | 2 | ||||
-rw-r--r-- | lib/Target/ARM/ARMTargetMachine.cpp | 33 | ||||
-rw-r--r-- | lib/Target/ARM/ARMTargetMachine.h | 11 |
4 files changed, 36 insertions, 20 deletions
diff --git a/lib/Target/ARM/ARMSubtarget.cpp b/lib/Target/ARM/ARMSubtarget.cpp index 4363697d3e..6db36dff29 100644 --- a/lib/Target/ARM/ARMSubtarget.cpp +++ b/lib/Target/ARM/ARMSubtarget.cpp @@ -14,16 +14,12 @@ #include "ARMSubtarget.h" #include "ARMGenSubtarget.inc" #include "llvm/Module.h" -#include "llvm/Support/CommandLine.h" using namespace llvm; -// FIXME: this is temporary. -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) +ARMSubtarget::ARMSubtarget(const Module &M, const std::string &FS, bool thumb) : ARMArchVersion(V4T) , HasVFP2(false) + , IsThumb(thumb) , UseThumbBacktraces(false) , IsR9Reserved(false) , stackAlignment(4) @@ -36,8 +32,6 @@ ARMSubtarget::ARMSubtarget(const Module &M, const std::string &FS) // Parse features string. ParseSubtargetFeatures(FS, CPU); - IsThumb = Thumb; - // Set the boolean corresponding to the current target triple, or the default // if one cannot be determined, to true. const std::string& TT = M.getTargetTriple(); diff --git a/lib/Target/ARM/ARMSubtarget.h b/lib/Target/ARM/ARMSubtarget.h index 88ceaef7b6..62367cadb9 100644 --- a/lib/Target/ARM/ARMSubtarget.h +++ b/lib/Target/ARM/ARMSubtarget.h @@ -60,7 +60,7 @@ protected: /// This constructor initializes the data members to match that /// of the specified module. /// - ARMSubtarget(const Module &M, const std::string &FS); + ARMSubtarget(const Module &M, const std::string &FS, bool thumb); /// ParseSubtargetFeatures - Parses features string setting specified /// subtarget options. Definition of function is auto generated by tblgen. diff --git a/lib/Target/ARM/ARMTargetMachine.cpp b/lib/Target/ARM/ARMTargetMachine.cpp index 2fa7016085..0b22c15ba3 100644 --- a/lib/Target/ARM/ARMTargetMachine.cpp +++ b/lib/Target/ARM/ARMTargetMachine.cpp @@ -27,21 +27,37 @@ static cl::opt<bool> DisableLdStOpti("disable-arm-loadstore-opti", cl::Hidden, namespace { // Register the target. - RegisterTarget<ARMTargetMachine> X("arm", " ARM"); + RegisterTarget<ARMTargetMachine> X("arm", " ARM"); + RegisterTarget<ThumbTargetMachine> Y("thumb", " Thumb"); } -/// TargetMachine ctor - Create an ILP32 architecture model +/// ThumbTargetMachine - Create an Thumb architecture model. /// -ARMTargetMachine::ARMTargetMachine(const Module &M, const std::string &FS) - : Subtarget(M, FS), +unsigned ThumbTargetMachine::getModuleMatchQuality(const Module &M) { + std::string TT = M.getTargetTriple(); + if (TT.size() >= 6 && std::string(TT.begin(), TT.begin()+6) == "thumb-") + return 20; + + return M.getPointerSize() == Module::Pointer32; +} + +ThumbTargetMachine::ThumbTargetMachine(const Module &M, const std::string &FS) + : ARMTargetMachine(M, FS, true) { +} + +/// TargetMachine ctor - Create an ARM architecture model. +/// +ARMTargetMachine::ARMTargetMachine(const Module &M, const std::string &FS, + bool isThumb) + : Subtarget(M, FS, isThumb), DataLayout(Subtarget.isAPCS_ABI() ? // APCS ABI - (Subtarget.isThumb() ? + (isThumb ? std::string("e-p:32:32-f64:32:32-i64:32:32-" "i16:16:32-i8:8:32-i1:8:32-a:0:32") : std::string("e-p:32:32-f64:32:32-i64:32:32")) : // AAPCS ABI - (Subtarget.isThumb() ? + (isThumb ? std::string("e-p:32:32-f64:64:64-i64:64:64-" "i16:16:32-i8:8:32-i1:8:32-a:0:32") : std::string("e-p:32:32-f64:64:64-i64:64:64"))), @@ -53,10 +69,7 @@ unsigned ARMTargetMachine::getModuleMatchQuality(const Module &M) { if (TT.size() >= 4 && std::string(TT.begin(), TT.begin()+4) == "arm-") return 20; - if (M.getPointerSize() == Module::Pointer32) - return 1; - else - return 0; + return M.getPointerSize() == Module::Pointer32; } diff --git a/lib/Target/ARM/ARMTargetMachine.h b/lib/Target/ARM/ARMTargetMachine.h index 9c888ea395..7f45fb6b6c 100644 --- a/lib/Target/ARM/ARMTargetMachine.h +++ b/lib/Target/ARM/ARMTargetMachine.h @@ -32,7 +32,7 @@ class ARMTargetMachine : public LLVMTargetMachine { ARMInstrInfo InstrInfo; ARMFrameInfo FrameInfo; public: - ARMTargetMachine(const Module &M, const std::string &FS); + ARMTargetMachine(const Module &M, const std::string &FS, bool isThumb = false); virtual const ARMInstrInfo *getInstrInfo() const { return &InstrInfo; } virtual const TargetFrameInfo *getFrameInfo() const { return &FrameInfo; } @@ -52,6 +52,15 @@ public: std::ostream &Out); }; +/// ThumbTargetMachine - Thumb target machine. +/// +class ThumbTargetMachine : public ARMTargetMachine { +public: + ThumbTargetMachine(const Module &M, const std::string &FS); + + static unsigned getModuleMatchQuality(const Module &M); +}; + } // end namespace llvm #endif |