mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-06 06:33:24 +00:00
Added -march=thumb; removed -enable-thumb.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34521 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
cdc694440b
commit
04321f70f5
@ -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();
|
||||
|
@ -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.
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user