mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-13 04:38:24 +00:00
Change TargetAsmInfo to be constructed via TargetRegistry from a Target+Triple
pair instead of from a virtual method on TargetMachine. This cuts the final ties of TargetAsmInfo to TargetMachine, meaning that MC can now use TargetAsmInfo. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78802 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -102,12 +102,8 @@ protected: // Can only create subclasses.
|
|||||||
|
|
||||||
/// AsmInfo - Contains target specific asm information.
|
/// AsmInfo - Contains target specific asm information.
|
||||||
///
|
///
|
||||||
mutable const TargetAsmInfo *AsmInfo;
|
const TargetAsmInfo *AsmInfo;
|
||||||
|
|
||||||
/// createTargetAsmInfo - Create a new instance of target specific asm
|
|
||||||
/// information.
|
|
||||||
virtual const TargetAsmInfo *createTargetAsmInfo() const { return 0; }
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
virtual ~TargetMachine();
|
virtual ~TargetMachine();
|
||||||
|
|
||||||
@ -126,10 +122,7 @@ public:
|
|||||||
|
|
||||||
/// getTargetAsmInfo - Return target specific asm information.
|
/// getTargetAsmInfo - Return target specific asm information.
|
||||||
///
|
///
|
||||||
const TargetAsmInfo *getTargetAsmInfo() const {
|
const TargetAsmInfo *getTargetAsmInfo() const { return AsmInfo; }
|
||||||
if (!AsmInfo) AsmInfo = createTargetAsmInfo();
|
|
||||||
return AsmInfo;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// getSubtarget - This method returns a pointer to the specified type of
|
/// getSubtarget - This method returns a pointer to the specified type of
|
||||||
/// TargetSubtarget. In debug builds, it verifies that the object being
|
/// TargetSubtarget. In debug builds, it verifies that the object being
|
||||||
@ -291,9 +284,8 @@ public:
|
|||||||
///
|
///
|
||||||
class LLVMTargetMachine : public TargetMachine {
|
class LLVMTargetMachine : public TargetMachine {
|
||||||
protected: // Can only create subclasses.
|
protected: // Can only create subclasses.
|
||||||
LLVMTargetMachine(const Target &T, const std::string &TargetTriple)
|
LLVMTargetMachine(const Target &T, const std::string &TargetTriple);
|
||||||
: TargetMachine(T) { }
|
|
||||||
|
|
||||||
/// addCommonCodeGenPasses - Add standard LLVM codegen passes used for
|
/// addCommonCodeGenPasses - Add standard LLVM codegen passes used for
|
||||||
/// both emitting to assembly files or machine code output.
|
/// both emitting to assembly files or machine code output.
|
||||||
///
|
///
|
||||||
|
@ -43,20 +43,22 @@ namespace llvm {
|
|||||||
/// will be zero initialized), and pass that instance to the TargetRegistry as
|
/// will be zero initialized), and pass that instance to the TargetRegistry as
|
||||||
/// part of their initialization.
|
/// part of their initialization.
|
||||||
class Target {
|
class Target {
|
||||||
private:
|
public:
|
||||||
|
friend struct TargetRegistry;
|
||||||
|
|
||||||
typedef unsigned (*TripleMatchQualityFnTy)(const std::string &TT);
|
typedef unsigned (*TripleMatchQualityFnTy)(const std::string &TT);
|
||||||
|
|
||||||
typedef TargetMachine *(*TargetMachineCtorTy)(const Target &,
|
typedef const TargetAsmInfo *(*AsmInfoCtorFnTy)(const Target &T,
|
||||||
const std::string &,
|
const StringRef &TT);
|
||||||
const std::string &);
|
typedef TargetMachine *(*TargetMachineCtorTy)(const Target &T,
|
||||||
|
const std::string &TT,
|
||||||
|
const std::string &Features);
|
||||||
typedef FunctionPass *(*AsmPrinterCtorTy)(formatted_raw_ostream &,
|
typedef FunctionPass *(*AsmPrinterCtorTy)(formatted_raw_ostream &,
|
||||||
TargetMachine &,
|
TargetMachine &,
|
||||||
bool);
|
bool);
|
||||||
typedef TargetAsmParser *(*AsmParserCtorTy)(const Target &,
|
typedef TargetAsmParser *(*AsmParserCtorTy)(const Target &,
|
||||||
MCAsmParser &);
|
MCAsmParser &);
|
||||||
|
private:
|
||||||
friend struct TargetRegistry;
|
|
||||||
|
|
||||||
/// Next - The next registered target in the linked list, maintained by the
|
/// Next - The next registered target in the linked list, maintained by the
|
||||||
/// TargetRegistry.
|
/// TargetRegistry.
|
||||||
Target *Next;
|
Target *Next;
|
||||||
@ -74,6 +76,8 @@ namespace llvm {
|
|||||||
/// HasJIT - Whether this target supports the JIT.
|
/// HasJIT - Whether this target supports the JIT.
|
||||||
bool HasJIT;
|
bool HasJIT;
|
||||||
|
|
||||||
|
AsmInfoCtorFnTy AsmInfoCtorFn;
|
||||||
|
|
||||||
/// TargetMachineCtorFn - Construction function for this target's
|
/// TargetMachineCtorFn - Construction function for this target's
|
||||||
/// TargetMachine, if registered.
|
/// TargetMachine, if registered.
|
||||||
TargetMachineCtorTy TargetMachineCtorFn;
|
TargetMachineCtorTy TargetMachineCtorFn;
|
||||||
@ -107,11 +111,23 @@ namespace llvm {
|
|||||||
/// hasAsmParser - Check if this target supports .s parsing.
|
/// hasAsmParser - Check if this target supports .s parsing.
|
||||||
bool hasAsmParser() const { return AsmParserCtorFn != 0; }
|
bool hasAsmParser() const { return AsmParserCtorFn != 0; }
|
||||||
|
|
||||||
/// createTargetMachine - Create a target specific machine implementation
|
|
||||||
/// for the module \arg M and \arg Triple.
|
/// createAsmInfo - Create a TargetAsmInfo implementation for the specified
|
||||||
|
/// target triple.
|
||||||
|
///
|
||||||
|
/// \arg Triple - This argument is used to determine the target machine
|
||||||
|
/// feature set; it should always be provided. Generally this should be
|
||||||
|
/// either the target triple from the module, or the target triple of the
|
||||||
|
/// host if that does not exist.
|
||||||
|
const TargetAsmInfo *createAsmInfo(const StringRef &Triple) const {
|
||||||
|
if (!AsmInfoCtorFn)
|
||||||
|
return 0;
|
||||||
|
return AsmInfoCtorFn(*this, Triple);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// createTargetMachine - Create a target specific machine implementation
|
||||||
|
/// for the specified \arg Triple.
|
||||||
///
|
///
|
||||||
/// \arg M - This argument is used for some machines to access the target
|
|
||||||
/// data.
|
|
||||||
/// \arg Triple - This argument is used to determine the target machine
|
/// \arg Triple - This argument is used to determine the target machine
|
||||||
/// feature set; it should always be provided. Generally this should be
|
/// feature set; it should always be provided. Generally this should be
|
||||||
/// either the target triple from the module, or the target triple of the
|
/// either the target triple from the module, or the target triple of the
|
||||||
@ -228,7 +244,22 @@ namespace llvm {
|
|||||||
const char *ShortDesc,
|
const char *ShortDesc,
|
||||||
Target::TripleMatchQualityFnTy TQualityFn,
|
Target::TripleMatchQualityFnTy TQualityFn,
|
||||||
bool HasJIT = false);
|
bool HasJIT = false);
|
||||||
|
|
||||||
|
/// RegisterAsmInfo - Register a TargetAsmInfo implementation for the
|
||||||
|
/// given target.
|
||||||
|
///
|
||||||
|
/// Clients are responsible for ensuring that registration doesn't occur
|
||||||
|
/// while another thread is attempting to access the registry. Typically
|
||||||
|
/// this is done by initializing all targets at program startup.
|
||||||
|
///
|
||||||
|
/// @param T - The target being registered.
|
||||||
|
/// @param Fn - A function to construct a TargetAsmInfo for the target.
|
||||||
|
static void RegisterAsmInfo(Target &T, Target::AsmInfoCtorFnTy Fn) {
|
||||||
|
// Ignore duplicate registration.
|
||||||
|
if (!T.AsmInfoCtorFn)
|
||||||
|
T.AsmInfoCtorFn = Fn;
|
||||||
|
}
|
||||||
|
|
||||||
/// RegisterTargetMachine - Register a TargetMachine implementation for the
|
/// RegisterTargetMachine - Register a TargetMachine implementation for the
|
||||||
/// given target.
|
/// given target.
|
||||||
///
|
///
|
||||||
@ -305,6 +336,41 @@ namespace llvm {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/// RegisterAsmInfo - Helper template for registering a target assembly info
|
||||||
|
/// implementation. This invokes the static "Create" method on the class to
|
||||||
|
/// actually do the construction. Usage:
|
||||||
|
///
|
||||||
|
/// extern "C" void LLVMInitializeFooTarget() {
|
||||||
|
/// extern Target TheFooTarget;
|
||||||
|
/// RegisterAsmInfo<FooTargetAsmInfo> X(TheFooTarget);
|
||||||
|
/// }
|
||||||
|
template<class TargetAsmInfoImpl>
|
||||||
|
struct RegisterAsmInfo {
|
||||||
|
RegisterAsmInfo(Target &T) {
|
||||||
|
TargetRegistry::RegisterAsmInfo(T, &Allocator);
|
||||||
|
}
|
||||||
|
private:
|
||||||
|
static const TargetAsmInfo *Allocator(const Target &T, const StringRef &TT){
|
||||||
|
return new TargetAsmInfoImpl(T, TT);
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
/// RegisterAsmInfoFn - Helper template for registering a target assembly info
|
||||||
|
/// implementation. This invokes the specified function to do the
|
||||||
|
/// construction. Usage:
|
||||||
|
///
|
||||||
|
/// extern "C" void LLVMInitializeFooTarget() {
|
||||||
|
/// extern Target TheFooTarget;
|
||||||
|
/// RegisterAsmInfoFn X(TheFooTarget, TheFunction);
|
||||||
|
/// }
|
||||||
|
struct RegisterAsmInfoFn {
|
||||||
|
RegisterAsmInfoFn(Target &T, Target::AsmInfoCtorFnTy Fn) {
|
||||||
|
TargetRegistry::RegisterAsmInfo(T, Fn);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
/// RegisterTargetMachine - Helper template for registering a target machine
|
/// RegisterTargetMachine - Helper template for registering a target machine
|
||||||
/// implementation, for use in the target machine initialization
|
/// implementation, for use in the target machine initialization
|
||||||
/// function. Usage:
|
/// function. Usage:
|
||||||
|
@ -55,6 +55,15 @@ static cl::opt<cl::boolOrDefault>
|
|||||||
EnableFastISelOption("fast-isel", cl::Hidden,
|
EnableFastISelOption("fast-isel", cl::Hidden,
|
||||||
cl::desc("Enable the experimental \"fast\" instruction selector"));
|
cl::desc("Enable the experimental \"fast\" instruction selector"));
|
||||||
|
|
||||||
|
|
||||||
|
LLVMTargetMachine::LLVMTargetMachine(const Target &T,
|
||||||
|
const std::string &TargetTriple)
|
||||||
|
: TargetMachine(T) {
|
||||||
|
AsmInfo = T.createAsmInfo(TargetTriple);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
FileModel::Model
|
FileModel::Model
|
||||||
LLVMTargetMachine::addPassesToEmitFile(PassManagerBase &PM,
|
LLVMTargetMachine::addPassesToEmitFile(PassManagerBase &PM,
|
||||||
formatted_raw_ostream &Out,
|
formatted_raw_ostream &Out,
|
||||||
|
@ -27,10 +27,26 @@ static cl::opt<bool> DisableLdStOpti("disable-arm-loadstore-opti", cl::Hidden,
|
|||||||
static cl::opt<bool> DisableIfConversion("disable-arm-if-conversion",cl::Hidden,
|
static cl::opt<bool> DisableIfConversion("disable-arm-if-conversion",cl::Hidden,
|
||||||
cl::desc("Disable if-conversion pass"));
|
cl::desc("Disable if-conversion pass"));
|
||||||
|
|
||||||
|
static const TargetAsmInfo *createTargetAsmInfo(const Target &T,
|
||||||
|
const StringRef &TT) {
|
||||||
|
Triple TheTriple(TT);
|
||||||
|
switch (TheTriple.getOS()) {
|
||||||
|
case Triple::Darwin:
|
||||||
|
return new ARMDarwinTargetAsmInfo();
|
||||||
|
default:
|
||||||
|
return new ARMELFTargetAsmInfo();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
extern "C" void LLVMInitializeARMTarget() {
|
extern "C" void LLVMInitializeARMTarget() {
|
||||||
// Register the target.
|
// Register the target.
|
||||||
RegisterTargetMachine<ARMTargetMachine> X(TheARMTarget);
|
RegisterTargetMachine<ARMTargetMachine> X(TheARMTarget);
|
||||||
RegisterTargetMachine<ThumbTargetMachine> Y(TheThumbTarget);
|
RegisterTargetMachine<ThumbTargetMachine> Y(TheThumbTarget);
|
||||||
|
|
||||||
|
// Register the target asm info.
|
||||||
|
RegisterAsmInfoFn A(TheARMTarget, createTargetAsmInfo);
|
||||||
|
RegisterAsmInfoFn B(TheThumbTarget, createTargetAsmInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// TargetMachine ctor - Create an ARM architecture model.
|
/// TargetMachine ctor - Create an ARM architecture model.
|
||||||
@ -73,16 +89,6 @@ ThumbTargetMachine::ThumbTargetMachine(const Target &T, const std::string &TT,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const TargetAsmInfo *ARMBaseTargetMachine::createTargetAsmInfo() const {
|
|
||||||
switch (Subtarget.TargetType) {
|
|
||||||
default: llvm_unreachable("Unknown ARM subtarget kind");
|
|
||||||
case ARMSubtarget::isDarwin:
|
|
||||||
return new ARMDarwinTargetAsmInfo();
|
|
||||||
case ARMSubtarget::isELF:
|
|
||||||
return new ARMELFTargetAsmInfo();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Pass Pipeline Configuration
|
// Pass Pipeline Configuration
|
||||||
bool ARMBaseTargetMachine::addInstSelector(PassManagerBase &PM,
|
bool ARMBaseTargetMachine::addInstSelector(PassManagerBase &PM,
|
||||||
|
@ -47,8 +47,6 @@ public:
|
|||||||
return InstrItins;
|
return InstrItins;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual const TargetAsmInfo *createTargetAsmInfo() const;
|
|
||||||
|
|
||||||
// Pass Pipeline Configuration
|
// Pass Pipeline Configuration
|
||||||
virtual bool addInstSelector(PassManagerBase &PM, CodeGenOpt::Level OptLevel);
|
virtual bool addInstSelector(PassManagerBase &PM, CodeGenOpt::Level OptLevel);
|
||||||
virtual bool addPreRegAlloc(PassManagerBase &PM, CodeGenOpt::Level OptLevel);
|
virtual bool addPreRegAlloc(PassManagerBase &PM, CodeGenOpt::Level OptLevel);
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
#include "AlphaTargetAsmInfo.h"
|
#include "AlphaTargetAsmInfo.h"
|
||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
|
|
||||||
AlphaTargetAsmInfo::AlphaTargetAsmInfo() {
|
AlphaTargetAsmInfo::AlphaTargetAsmInfo(const Target &T, const StringRef &TT) {
|
||||||
AlignmentIsInBytes = false;
|
AlignmentIsInBytes = false;
|
||||||
PrivateGlobalPrefix = "$";
|
PrivateGlobalPrefix = "$";
|
||||||
PICJumpTableDirective = ".gprel32";
|
PICJumpTableDirective = ".gprel32";
|
||||||
|
@ -17,9 +17,11 @@
|
|||||||
#include "llvm/Target/TargetAsmInfo.h"
|
#include "llvm/Target/TargetAsmInfo.h"
|
||||||
|
|
||||||
namespace llvm {
|
namespace llvm {
|
||||||
|
class Target;
|
||||||
|
class StringRef;
|
||||||
|
|
||||||
struct AlphaTargetAsmInfo : public TargetAsmInfo {
|
struct AlphaTargetAsmInfo : public TargetAsmInfo {
|
||||||
explicit AlphaTargetAsmInfo();
|
explicit AlphaTargetAsmInfo(const Target &T, const StringRef &TT);
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace llvm
|
} // namespace llvm
|
||||||
|
@ -17,16 +17,12 @@
|
|||||||
#include "llvm/PassManager.h"
|
#include "llvm/PassManager.h"
|
||||||
#include "llvm/Support/FormattedStream.h"
|
#include "llvm/Support/FormattedStream.h"
|
||||||
#include "llvm/Target/TargetRegistry.h"
|
#include "llvm/Target/TargetRegistry.h"
|
||||||
|
|
||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
|
|
||||||
extern "C" void LLVMInitializeAlphaTarget() {
|
extern "C" void LLVMInitializeAlphaTarget() {
|
||||||
// Register the target.
|
// Register the target.
|
||||||
RegisterTargetMachine<AlphaTargetMachine> X(TheAlphaTarget);
|
RegisterTargetMachine<AlphaTargetMachine> X(TheAlphaTarget);
|
||||||
}
|
RegisterAsmInfo<AlphaTargetAsmInfo> Y(TheAlphaTarget);
|
||||||
|
|
||||||
const TargetAsmInfo *AlphaTargetMachine::createTargetAsmInfo() const {
|
|
||||||
return new AlphaTargetAsmInfo();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
AlphaTargetMachine::AlphaTargetMachine(const Target &T, const std::string &TT,
|
AlphaTargetMachine::AlphaTargetMachine(const Target &T, const std::string &TT,
|
||||||
|
@ -34,9 +34,6 @@ class AlphaTargetMachine : public LLVMTargetMachine {
|
|||||||
AlphaSubtarget Subtarget;
|
AlphaSubtarget Subtarget;
|
||||||
AlphaTargetLowering TLInfo;
|
AlphaTargetLowering TLInfo;
|
||||||
|
|
||||||
protected:
|
|
||||||
virtual const TargetAsmInfo *createTargetAsmInfo() const;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
AlphaTargetMachine(const Target &T, const std::string &TT,
|
AlphaTargetMachine(const Target &T, const std::string &TT,
|
||||||
const std::string &FS);
|
const std::string &FS);
|
||||||
|
@ -15,7 +15,8 @@
|
|||||||
|
|
||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
|
|
||||||
BlackfinTargetAsmInfo::BlackfinTargetAsmInfo() {
|
BlackfinTargetAsmInfo::BlackfinTargetAsmInfo(const Target &T,
|
||||||
|
const StringRef &TT) {
|
||||||
GlobalPrefix = "_";
|
GlobalPrefix = "_";
|
||||||
CommentString = "//";
|
CommentString = "//";
|
||||||
}
|
}
|
||||||
|
@ -17,9 +17,11 @@
|
|||||||
#include "llvm/Target/TargetAsmInfo.h"
|
#include "llvm/Target/TargetAsmInfo.h"
|
||||||
|
|
||||||
namespace llvm {
|
namespace llvm {
|
||||||
|
class Target;
|
||||||
|
class StringRef;
|
||||||
|
|
||||||
struct BlackfinTargetAsmInfo : public TargetAsmInfo {
|
struct BlackfinTargetAsmInfo : public TargetAsmInfo {
|
||||||
explicit BlackfinTargetAsmInfo();
|
explicit BlackfinTargetAsmInfo(const Target &T, const StringRef &TT);
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace llvm
|
} // namespace llvm
|
||||||
|
@ -20,10 +20,8 @@ using namespace llvm;
|
|||||||
|
|
||||||
extern "C" void LLVMInitializeBlackfinTarget() {
|
extern "C" void LLVMInitializeBlackfinTarget() {
|
||||||
RegisterTargetMachine<BlackfinTargetMachine> X(TheBlackfinTarget);
|
RegisterTargetMachine<BlackfinTargetMachine> X(TheBlackfinTarget);
|
||||||
}
|
RegisterAsmInfo<BlackfinTargetAsmInfo> Y(TheBlackfinTarget);
|
||||||
|
|
||||||
const TargetAsmInfo* BlackfinTargetMachine::createTargetAsmInfo() const {
|
|
||||||
return new BlackfinTargetAsmInfo();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
BlackfinTargetMachine::BlackfinTargetMachine(const Target &T,
|
BlackfinTargetMachine::BlackfinTargetMachine(const Target &T,
|
||||||
|
@ -29,10 +29,6 @@ namespace llvm {
|
|||||||
BlackfinTargetLowering TLInfo;
|
BlackfinTargetLowering TLInfo;
|
||||||
BlackfinInstrInfo InstrInfo;
|
BlackfinInstrInfo InstrInfo;
|
||||||
TargetFrameInfo FrameInfo;
|
TargetFrameInfo FrameInfo;
|
||||||
|
|
||||||
protected:
|
|
||||||
virtual const TargetAsmInfo *createTargetAsmInfo() const;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
BlackfinTargetMachine(const Target &T, const std::string &TT,
|
BlackfinTargetMachine(const Target &T, const std::string &TT,
|
||||||
const std::string &FS);
|
const std::string &FS);
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
#include "SPUTargetAsmInfo.h"
|
#include "SPUTargetAsmInfo.h"
|
||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
|
|
||||||
SPULinuxTargetAsmInfo::SPULinuxTargetAsmInfo() {
|
SPULinuxTargetAsmInfo::SPULinuxTargetAsmInfo(const Target &T, const StringRef &TT) {
|
||||||
ZeroDirective = "\t.space\t";
|
ZeroDirective = "\t.space\t";
|
||||||
SetDirective = "\t.set";
|
SetDirective = "\t.set";
|
||||||
Data64bitsDirective = "\t.quad\t";
|
Data64bitsDirective = "\t.quad\t";
|
||||||
|
@ -17,9 +17,11 @@
|
|||||||
#include "llvm/Target/TargetAsmInfo.h"
|
#include "llvm/Target/TargetAsmInfo.h"
|
||||||
|
|
||||||
namespace llvm {
|
namespace llvm {
|
||||||
|
class Target;
|
||||||
|
class StringRef;
|
||||||
|
|
||||||
struct SPULinuxTargetAsmInfo : public TargetAsmInfo {
|
struct SPULinuxTargetAsmInfo : public TargetAsmInfo {
|
||||||
explicit SPULinuxTargetAsmInfo();
|
explicit SPULinuxTargetAsmInfo(const Target &T, const StringRef &TT);
|
||||||
};
|
};
|
||||||
} // namespace llvm
|
} // namespace llvm
|
||||||
|
|
||||||
|
@ -25,6 +25,7 @@ using namespace llvm;
|
|||||||
extern "C" void LLVMInitializeCellSPUTarget() {
|
extern "C" void LLVMInitializeCellSPUTarget() {
|
||||||
// Register the target.
|
// Register the target.
|
||||||
RegisterTargetMachine<SPUTargetMachine> X(TheCellSPUTarget);
|
RegisterTargetMachine<SPUTargetMachine> X(TheCellSPUTarget);
|
||||||
|
RegisterAsmInfo<SPULinuxTargetAsmInfo> Y(TheCellSPUTarget);
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::pair<unsigned, int> *
|
const std::pair<unsigned, int> *
|
||||||
@ -33,10 +34,6 @@ SPUFrameInfo::getCalleeSaveSpillSlots(unsigned &NumEntries) const {
|
|||||||
return &LR[0];
|
return &LR[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
const TargetAsmInfo *SPUTargetMachine::createTargetAsmInfo() const {
|
|
||||||
return new SPULinuxTargetAsmInfo();
|
|
||||||
}
|
|
||||||
|
|
||||||
SPUTargetMachine::SPUTargetMachine(const Target &T, const std::string &TT,
|
SPUTargetMachine::SPUTargetMachine(const Target &T, const std::string &TT,
|
||||||
const std::string &FS)
|
const std::string &FS)
|
||||||
: LLVMTargetMachine(T, TT),
|
: LLVMTargetMachine(T, TT),
|
||||||
|
@ -35,10 +35,6 @@ class SPUTargetMachine : public LLVMTargetMachine {
|
|||||||
SPUFrameInfo FrameInfo;
|
SPUFrameInfo FrameInfo;
|
||||||
SPUTargetLowering TLInfo;
|
SPUTargetLowering TLInfo;
|
||||||
InstrItineraryData InstrItins;
|
InstrItineraryData InstrItins;
|
||||||
|
|
||||||
protected:
|
|
||||||
virtual const TargetAsmInfo *createTargetAsmInfo() const;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
SPUTargetMachine(const Target &T, const std::string &TT,
|
SPUTargetMachine(const Target &T, const std::string &TT,
|
||||||
const std::string &FS);
|
const std::string &FS);
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
#define DEBUG_TYPE "asm-printer"
|
#define DEBUG_TYPE "asm-printer"
|
||||||
#include "MSP430.h"
|
#include "MSP430.h"
|
||||||
#include "MSP430InstrInfo.h"
|
#include "MSP430InstrInfo.h"
|
||||||
|
#include "MSP430TargetAsmInfo.h"
|
||||||
#include "MSP430TargetMachine.h"
|
#include "MSP430TargetMachine.h"
|
||||||
#include "llvm/Constants.h"
|
#include "llvm/Constants.h"
|
||||||
#include "llvm/DerivedTypes.h"
|
#include "llvm/DerivedTypes.h"
|
||||||
@ -25,7 +26,6 @@
|
|||||||
#include "llvm/CodeGen/MachineFunctionPass.h"
|
#include "llvm/CodeGen/MachineFunctionPass.h"
|
||||||
#include "llvm/CodeGen/MachineConstantPool.h"
|
#include "llvm/CodeGen/MachineConstantPool.h"
|
||||||
#include "llvm/CodeGen/MachineInstr.h"
|
#include "llvm/CodeGen/MachineInstr.h"
|
||||||
#include "llvm/Target/TargetAsmInfo.h"
|
|
||||||
#include "llvm/Target/TargetData.h"
|
#include "llvm/Target/TargetData.h"
|
||||||
#include "llvm/Target/TargetLoweringObjectFile.h"
|
#include "llvm/Target/TargetLoweringObjectFile.h"
|
||||||
#include "llvm/Target/TargetRegistry.h"
|
#include "llvm/Target/TargetRegistry.h"
|
||||||
@ -246,4 +246,5 @@ extern "C" void LLVMInitializeMSP430Target() {
|
|||||||
// Register the target.
|
// Register the target.
|
||||||
RegisterTargetMachine<MSP430TargetMachine> X(TheMSP430Target);
|
RegisterTargetMachine<MSP430TargetMachine> X(TheMSP430Target);
|
||||||
RegisterAsmPrinter<MSP430AsmPrinter> Y(TheMSP430Target);
|
RegisterAsmPrinter<MSP430AsmPrinter> Y(TheMSP430Target);
|
||||||
|
RegisterAsmInfo<MSP430TargetAsmInfo> Z(TheMSP430Target);
|
||||||
}
|
}
|
||||||
|
@ -14,6 +14,6 @@
|
|||||||
#include "MSP430TargetAsmInfo.h"
|
#include "MSP430TargetAsmInfo.h"
|
||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
|
|
||||||
MSP430TargetAsmInfo::MSP430TargetAsmInfo() {
|
MSP430TargetAsmInfo::MSP430TargetAsmInfo(const Target &T, const StringRef &TT) {
|
||||||
AlignmentIsInBytes = false;
|
AlignmentIsInBytes = false;
|
||||||
}
|
}
|
||||||
|
@ -17,8 +17,10 @@
|
|||||||
#include "llvm/Target/TargetAsmInfo.h"
|
#include "llvm/Target/TargetAsmInfo.h"
|
||||||
|
|
||||||
namespace llvm {
|
namespace llvm {
|
||||||
|
class Target;
|
||||||
|
class StringRef;
|
||||||
struct MSP430TargetAsmInfo : public TargetAsmInfo {
|
struct MSP430TargetAsmInfo : public TargetAsmInfo {
|
||||||
explicit MSP430TargetAsmInfo();
|
explicit MSP430TargetAsmInfo(const Target &T, const StringRef &TT);
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace llvm
|
} // namespace llvm
|
||||||
|
@ -29,9 +29,6 @@ MSP430TargetMachine::MSP430TargetMachine(const Target &T,
|
|||||||
InstrInfo(*this), TLInfo(*this),
|
InstrInfo(*this), TLInfo(*this),
|
||||||
FrameInfo(TargetFrameInfo::StackGrowsDown, 2, -2) { }
|
FrameInfo(TargetFrameInfo::StackGrowsDown, 2, -2) { }
|
||||||
|
|
||||||
const TargetAsmInfo *MSP430TargetMachine::createTargetAsmInfo() const {
|
|
||||||
return new MSP430TargetAsmInfo();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool MSP430TargetMachine::addInstSelector(PassManagerBase &PM,
|
bool MSP430TargetMachine::addInstSelector(PassManagerBase &PM,
|
||||||
CodeGenOpt::Level OptLevel) {
|
CodeGenOpt::Level OptLevel) {
|
||||||
|
@ -37,9 +37,6 @@ class MSP430TargetMachine : public LLVMTargetMachine {
|
|||||||
// any MSP430 specific FrameInfo class.
|
// any MSP430 specific FrameInfo class.
|
||||||
TargetFrameInfo FrameInfo;
|
TargetFrameInfo FrameInfo;
|
||||||
|
|
||||||
protected:
|
|
||||||
virtual const TargetAsmInfo *createTargetAsmInfo() const;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
MSP430TargetMachine(const Target &T, const std::string &TT,
|
MSP430TargetMachine(const Target &T, const std::string &TT,
|
||||||
const std::string &FS);
|
const std::string &FS);
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
#include "MipsTargetAsmInfo.h"
|
#include "MipsTargetAsmInfo.h"
|
||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
|
|
||||||
MipsTargetAsmInfo::MipsTargetAsmInfo() {
|
MipsTargetAsmInfo::MipsTargetAsmInfo(const Target &T, const StringRef &TT) {
|
||||||
AlignmentIsInBytes = false;
|
AlignmentIsInBytes = false;
|
||||||
COMMDirectiveTakesAlignment = true;
|
COMMDirectiveTakesAlignment = true;
|
||||||
Data16bitsDirective = "\t.half\t";
|
Data16bitsDirective = "\t.half\t";
|
||||||
|
@ -17,9 +17,12 @@
|
|||||||
#include "llvm/Target/TargetAsmInfo.h"
|
#include "llvm/Target/TargetAsmInfo.h"
|
||||||
|
|
||||||
namespace llvm {
|
namespace llvm {
|
||||||
|
class Target;
|
||||||
|
class StringRef;
|
||||||
|
|
||||||
class MipsTargetAsmInfo : public TargetAsmInfo {
|
class MipsTargetAsmInfo : public TargetAsmInfo {
|
||||||
public:
|
public:
|
||||||
explicit MipsTargetAsmInfo();
|
explicit MipsTargetAsmInfo(const Target &T, const StringRef &TT);
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace llvm
|
} // namespace llvm
|
||||||
|
@ -22,10 +22,8 @@ extern "C" void LLVMInitializeMipsTarget() {
|
|||||||
// Register the target.
|
// Register the target.
|
||||||
RegisterTargetMachine<MipsTargetMachine> X(TheMipsTarget);
|
RegisterTargetMachine<MipsTargetMachine> X(TheMipsTarget);
|
||||||
RegisterTargetMachine<MipselTargetMachine> Y(TheMipselTarget);
|
RegisterTargetMachine<MipselTargetMachine> Y(TheMipselTarget);
|
||||||
}
|
RegisterAsmInfo<MipsTargetAsmInfo> A(TheMipsTarget);
|
||||||
|
RegisterAsmInfo<MipsTargetAsmInfo> B(TheMipselTarget);
|
||||||
const TargetAsmInfo *MipsTargetMachine::createTargetAsmInfo() const {
|
|
||||||
return new MipsTargetAsmInfo();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// DataLayout --> Big-endian, 32-bit pointer/ABI/alignment
|
// DataLayout --> Big-endian, 32-bit pointer/ABI/alignment
|
||||||
|
@ -30,10 +30,6 @@ namespace llvm {
|
|||||||
MipsInstrInfo InstrInfo;
|
MipsInstrInfo InstrInfo;
|
||||||
TargetFrameInfo FrameInfo;
|
TargetFrameInfo FrameInfo;
|
||||||
MipsTargetLowering TLInfo;
|
MipsTargetLowering TLInfo;
|
||||||
|
|
||||||
protected:
|
|
||||||
virtual const TargetAsmInfo *createTargetAsmInfo() const;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
MipsTargetMachine(const Target &T, const std::string &TT,
|
MipsTargetMachine(const Target &T, const std::string &TT,
|
||||||
const std::string &FS, bool isLittle);
|
const std::string &FS, bool isLittle);
|
||||||
|
@ -480,4 +480,7 @@ extern "C" void LLVMInitializePIC16Target() {
|
|||||||
RegisterTargetMachine<CooperTargetMachine> B(TheCooperTarget);
|
RegisterTargetMachine<CooperTargetMachine> B(TheCooperTarget);
|
||||||
RegisterAsmPrinter<PIC16AsmPrinter> C(ThePIC16Target);
|
RegisterAsmPrinter<PIC16AsmPrinter> C(ThePIC16Target);
|
||||||
RegisterAsmPrinter<PIC16AsmPrinter> D(TheCooperTarget);
|
RegisterAsmPrinter<PIC16AsmPrinter> D(TheCooperTarget);
|
||||||
|
|
||||||
|
RegisterAsmInfo<PIC16TargetAsmInfo> E(ThePIC16Target);
|
||||||
|
RegisterAsmInfo<PIC16TargetAsmInfo> F(TheCooperTarget);
|
||||||
}
|
}
|
||||||
|
@ -19,8 +19,7 @@
|
|||||||
#include "PIC16ISelLowering.h"
|
#include "PIC16ISelLowering.h"
|
||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
|
|
||||||
PIC16TargetAsmInfo::
|
PIC16TargetAsmInfo::PIC16TargetAsmInfo(const Target &T, const StringRef &TT) {
|
||||||
PIC16TargetAsmInfo() {
|
|
||||||
CommentString = ";";
|
CommentString = ";";
|
||||||
GlobalPrefix = PAN::getTagName(PAN::PREFIX_SYMBOL);
|
GlobalPrefix = PAN::getTagName(PAN::PREFIX_SYMBOL);
|
||||||
GlobalDirective = "\tglobal\t";
|
GlobalDirective = "\tglobal\t";
|
||||||
|
@ -17,12 +17,15 @@
|
|||||||
#include "llvm/Target/TargetAsmInfo.h"
|
#include "llvm/Target/TargetAsmInfo.h"
|
||||||
|
|
||||||
namespace llvm {
|
namespace llvm {
|
||||||
|
class Target;
|
||||||
|
class StringRef;
|
||||||
|
|
||||||
class PIC16TargetAsmInfo : public TargetAsmInfo {
|
class PIC16TargetAsmInfo : public TargetAsmInfo {
|
||||||
const char *RomData8bitsDirective;
|
const char *RomData8bitsDirective;
|
||||||
const char *RomData16bitsDirective;
|
const char *RomData16bitsDirective;
|
||||||
const char *RomData32bitsDirective;
|
const char *RomData32bitsDirective;
|
||||||
public:
|
public:
|
||||||
PIC16TargetAsmInfo();
|
PIC16TargetAsmInfo(const Target &T, const StringRef &TT);
|
||||||
|
|
||||||
virtual const char *getDataASDirective(unsigned size, unsigned AS) const;
|
virtual const char *getDataASDirective(unsigned size, unsigned AS) const;
|
||||||
};
|
};
|
||||||
|
@ -36,10 +36,6 @@ CooperTargetMachine::CooperTargetMachine(const Target &T, const std::string &TT,
|
|||||||
: PIC16TargetMachine(T, TT, FS, true) {}
|
: PIC16TargetMachine(T, TT, FS, true) {}
|
||||||
|
|
||||||
|
|
||||||
const TargetAsmInfo *PIC16TargetMachine::createTargetAsmInfo() const {
|
|
||||||
return new PIC16TargetAsmInfo();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool PIC16TargetMachine::addInstSelector(PassManagerBase &PM,
|
bool PIC16TargetMachine::addInstSelector(PassManagerBase &PM,
|
||||||
CodeGenOpt::Level OptLevel) {
|
CodeGenOpt::Level OptLevel) {
|
||||||
// Install an instruction selector.
|
// Install an instruction selector.
|
||||||
|
@ -37,9 +37,6 @@ class PIC16TargetMachine : public LLVMTargetMachine {
|
|||||||
// any PIC16 specific FrameInfo class.
|
// any PIC16 specific FrameInfo class.
|
||||||
TargetFrameInfo FrameInfo;
|
TargetFrameInfo FrameInfo;
|
||||||
|
|
||||||
protected:
|
|
||||||
virtual const TargetAsmInfo *createTargetAsmInfo() const;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
PIC16TargetMachine(const Target &T, const std::string &TT,
|
PIC16TargetMachine(const Target &T, const std::string &TT,
|
||||||
const std::string &FS, bool Cooper = false);
|
const std::string &FS, bool Cooper = false);
|
||||||
|
@ -20,17 +20,25 @@
|
|||||||
#include "llvm/Support/FormattedStream.h"
|
#include "llvm/Support/FormattedStream.h"
|
||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
|
|
||||||
|
static const TargetAsmInfo *createTargetAsmInfo(const Target &T,
|
||||||
|
const StringRef &TT) {
|
||||||
|
Triple TheTriple(TT);
|
||||||
|
bool isPPC64 = TheTriple.getArch() == Triple::ppc64;
|
||||||
|
if (TheTriple.getOS() == Triple::Darwin)
|
||||||
|
return new PPCDarwinTargetAsmInfo(isPPC64);
|
||||||
|
return new PPCLinuxTargetAsmInfo(isPPC64);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
extern "C" void LLVMInitializePowerPCTarget() {
|
extern "C" void LLVMInitializePowerPCTarget() {
|
||||||
// Register the targets
|
// Register the targets
|
||||||
RegisterTargetMachine<PPC32TargetMachine> A(ThePPC32Target);
|
RegisterTargetMachine<PPC32TargetMachine> A(ThePPC32Target);
|
||||||
RegisterTargetMachine<PPC64TargetMachine> B(ThePPC64Target);
|
RegisterTargetMachine<PPC64TargetMachine> B(ThePPC64Target);
|
||||||
|
|
||||||
|
RegisterAsmInfoFn C(ThePPC32Target, createTargetAsmInfo);
|
||||||
|
RegisterAsmInfoFn D(ThePPC64Target, createTargetAsmInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
const TargetAsmInfo *PPCTargetMachine::createTargetAsmInfo() const {
|
|
||||||
if (Subtarget.isDarwin())
|
|
||||||
return new PPCDarwinTargetAsmInfo(Subtarget.isPPC64());
|
|
||||||
return new PPCLinuxTargetAsmInfo(Subtarget.isPPC64());
|
|
||||||
}
|
|
||||||
|
|
||||||
PPCTargetMachine::PPCTargetMachine(const Target &T, const std::string &TT,
|
PPCTargetMachine::PPCTargetMachine(const Target &T, const std::string &TT,
|
||||||
const std::string &FS, bool is64Bit)
|
const std::string &FS, bool is64Bit)
|
||||||
|
@ -39,9 +39,6 @@ class PPCTargetMachine : public LLVMTargetMachine {
|
|||||||
InstrItineraryData InstrItins;
|
InstrItineraryData InstrItins;
|
||||||
PPCMachOWriterInfo MachOWriterInfo;
|
PPCMachOWriterInfo MachOWriterInfo;
|
||||||
|
|
||||||
protected:
|
|
||||||
virtual const TargetAsmInfo *createTargetAsmInfo() const;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
PPCTargetMachine(const Target &T, const std::string &TT,
|
PPCTargetMachine(const Target &T, const std::string &TT,
|
||||||
const std::string &FS, bool is64Bit);
|
const std::string &FS, bool is64Bit);
|
||||||
|
@ -15,7 +15,8 @@
|
|||||||
#include "llvm/ADT/SmallVector.h"
|
#include "llvm/ADT/SmallVector.h"
|
||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
|
|
||||||
SparcELFTargetAsmInfo::SparcELFTargetAsmInfo() {
|
SparcELFTargetAsmInfo::SparcELFTargetAsmInfo(const Target &T,
|
||||||
|
const StringRef &TT) {
|
||||||
Data16bitsDirective = "\t.half\t";
|
Data16bitsDirective = "\t.half\t";
|
||||||
Data32bitsDirective = "\t.word\t";
|
Data32bitsDirective = "\t.word\t";
|
||||||
Data64bitsDirective = 0; // .xword is only supported by V9.
|
Data64bitsDirective = 0; // .xword is only supported by V9.
|
||||||
|
@ -17,9 +17,10 @@
|
|||||||
#include "llvm/Target/TargetAsmInfo.h"
|
#include "llvm/Target/TargetAsmInfo.h"
|
||||||
|
|
||||||
namespace llvm {
|
namespace llvm {
|
||||||
|
class Target;
|
||||||
|
class StringRef;
|
||||||
struct SparcELFTargetAsmInfo : public TargetAsmInfo {
|
struct SparcELFTargetAsmInfo : public TargetAsmInfo {
|
||||||
explicit SparcELFTargetAsmInfo();
|
explicit SparcELFTargetAsmInfo(const Target &T, const StringRef &TT);
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace llvm
|
} // namespace llvm
|
||||||
|
@ -20,11 +20,8 @@ using namespace llvm;
|
|||||||
extern "C" void LLVMInitializeSparcTarget() {
|
extern "C" void LLVMInitializeSparcTarget() {
|
||||||
// Register the target.
|
// Register the target.
|
||||||
RegisterTargetMachine<SparcTargetMachine> X(TheSparcTarget);
|
RegisterTargetMachine<SparcTargetMachine> X(TheSparcTarget);
|
||||||
}
|
RegisterAsmInfo<SparcELFTargetAsmInfo> Y(TheSparcTarget);
|
||||||
|
|
||||||
const TargetAsmInfo *SparcTargetMachine::createTargetAsmInfo() const {
|
|
||||||
// FIXME: Handle Solaris subtarget someday :)
|
|
||||||
return new SparcELFTargetAsmInfo();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// SparcTargetMachine ctor - Create an ILP32 architecture model
|
/// SparcTargetMachine ctor - Create an ILP32 architecture model
|
||||||
|
@ -29,10 +29,6 @@ class SparcTargetMachine : public LLVMTargetMachine {
|
|||||||
SparcTargetLowering TLInfo;
|
SparcTargetLowering TLInfo;
|
||||||
SparcInstrInfo InstrInfo;
|
SparcInstrInfo InstrInfo;
|
||||||
TargetFrameInfo FrameInfo;
|
TargetFrameInfo FrameInfo;
|
||||||
|
|
||||||
protected:
|
|
||||||
virtual const TargetAsmInfo *createTargetAsmInfo() const;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
SparcTargetMachine(const Target &T, const std::string &TT,
|
SparcTargetMachine(const Target &T, const std::string &TT,
|
||||||
const std::string &FS);
|
const std::string &FS);
|
||||||
|
@ -14,7 +14,8 @@
|
|||||||
#include "SystemZTargetAsmInfo.h"
|
#include "SystemZTargetAsmInfo.h"
|
||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
|
|
||||||
SystemZTargetAsmInfo::SystemZTargetAsmInfo() {
|
SystemZTargetAsmInfo::SystemZTargetAsmInfo(const Target &T,
|
||||||
|
const StringRef &TT) {
|
||||||
AlignmentIsInBytes = true;
|
AlignmentIsInBytes = true;
|
||||||
|
|
||||||
PrivateGlobalPrefix = ".L";
|
PrivateGlobalPrefix = ".L";
|
||||||
|
@ -17,9 +17,11 @@
|
|||||||
#include "llvm/Target/TargetAsmInfo.h"
|
#include "llvm/Target/TargetAsmInfo.h"
|
||||||
|
|
||||||
namespace llvm {
|
namespace llvm {
|
||||||
|
class Target;
|
||||||
|
class StringRef;
|
||||||
|
|
||||||
struct SystemZTargetAsmInfo : public TargetAsmInfo {
|
struct SystemZTargetAsmInfo : public TargetAsmInfo {
|
||||||
explicit SystemZTargetAsmInfo();
|
explicit SystemZTargetAsmInfo(const Target &T, const StringRef &TT);
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace llvm
|
} // namespace llvm
|
||||||
|
@ -6,9 +6,6 @@
|
|||||||
// License. See LICENSE.TXT for details.
|
// License. See LICENSE.TXT for details.
|
||||||
//
|
//
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
//
|
|
||||||
//
|
|
||||||
//===----------------------------------------------------------------------===//
|
|
||||||
|
|
||||||
#include "SystemZTargetAsmInfo.h"
|
#include "SystemZTargetAsmInfo.h"
|
||||||
#include "SystemZTargetMachine.h"
|
#include "SystemZTargetMachine.h"
|
||||||
@ -20,10 +17,7 @@ using namespace llvm;
|
|||||||
extern "C" void LLVMInitializeSystemZTarget() {
|
extern "C" void LLVMInitializeSystemZTarget() {
|
||||||
// Register the target.
|
// Register the target.
|
||||||
RegisterTargetMachine<SystemZTargetMachine> X(TheSystemZTarget);
|
RegisterTargetMachine<SystemZTargetMachine> X(TheSystemZTarget);
|
||||||
}
|
RegisterAsmInfo<SystemZTargetAsmInfo> Y(TheSystemZTarget);
|
||||||
|
|
||||||
const TargetAsmInfo *SystemZTargetMachine::createTargetAsmInfo() const {
|
|
||||||
return new SystemZTargetAsmInfo();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// SystemZTargetMachine ctor - Create an ILP64 architecture model
|
/// SystemZTargetMachine ctor - Create an ILP64 architecture model
|
||||||
|
@ -36,10 +36,6 @@ class SystemZTargetMachine : public LLVMTargetMachine {
|
|||||||
// SystemZ does not have any call stack frame, therefore not having
|
// SystemZ does not have any call stack frame, therefore not having
|
||||||
// any SystemZ specific FrameInfo class.
|
// any SystemZ specific FrameInfo class.
|
||||||
TargetFrameInfo FrameInfo;
|
TargetFrameInfo FrameInfo;
|
||||||
|
|
||||||
protected:
|
|
||||||
virtual const TargetAsmInfo *createTargetAsmInfo() const;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
SystemZTargetMachine(const Target &T, const std::string &TT,
|
SystemZTargetMachine(const Target &T, const std::string &TT,
|
||||||
const std::string &FS);
|
const std::string &FS);
|
||||||
|
@ -13,6 +13,7 @@
|
|||||||
|
|
||||||
#include "X86TargetAsmInfo.h"
|
#include "X86TargetAsmInfo.h"
|
||||||
#include "X86TargetMachine.h"
|
#include "X86TargetMachine.h"
|
||||||
|
#include "llvm/ADT/Triple.h"
|
||||||
#include "llvm/Support/CommandLine.h"
|
#include "llvm/Support/CommandLine.h"
|
||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
|
|
||||||
@ -42,12 +43,11 @@ static const char *const x86_asm_table[] = {
|
|||||||
"{cc}", "cc",
|
"{cc}", "cc",
|
||||||
0,0};
|
0,0};
|
||||||
|
|
||||||
X86DarwinTargetAsmInfo::X86DarwinTargetAsmInfo(const X86TargetMachine &TM) {
|
X86DarwinTargetAsmInfo::X86DarwinTargetAsmInfo(const Triple &Triple) {
|
||||||
AsmTransCBE = x86_asm_table;
|
AsmTransCBE = x86_asm_table;
|
||||||
AssemblerDialect = AsmWriterFlavor;
|
AssemblerDialect = AsmWriterFlavor;
|
||||||
|
|
||||||
const X86Subtarget *Subtarget = &TM.getSubtarget<X86Subtarget>();
|
bool is64Bit = Triple.getArch() == Triple::x86_64;
|
||||||
bool is64Bit = Subtarget->is64Bit();
|
|
||||||
|
|
||||||
TextAlignFillValue = 0x90;
|
TextAlignFillValue = 0x90;
|
||||||
|
|
||||||
@ -55,7 +55,7 @@ X86DarwinTargetAsmInfo::X86DarwinTargetAsmInfo(const X86TargetMachine &TM) {
|
|||||||
Data64bitsDirective = 0; // we can't emit a 64-bit unit
|
Data64bitsDirective = 0; // we can't emit a 64-bit unit
|
||||||
|
|
||||||
// Leopard and above support aligned common symbols.
|
// Leopard and above support aligned common symbols.
|
||||||
COMMDirectiveTakesAlignment = (Subtarget->getDarwinVers() >= 9);
|
COMMDirectiveTakesAlignment = Triple.getDarwinMajorNumber() >= 9;
|
||||||
|
|
||||||
if (is64Bit) {
|
if (is64Bit) {
|
||||||
PersonalityPrefix = "";
|
PersonalityPrefix = "";
|
||||||
@ -76,7 +76,7 @@ X86DarwinTargetAsmInfo::X86DarwinTargetAsmInfo(const X86TargetMachine &TM) {
|
|||||||
AbsoluteEHSectionOffsets = false;
|
AbsoluteEHSectionOffsets = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
X86ELFTargetAsmInfo::X86ELFTargetAsmInfo(const X86TargetMachine &TM) {
|
X86ELFTargetAsmInfo::X86ELFTargetAsmInfo(const Triple &Triple) {
|
||||||
AsmTransCBE = x86_asm_table;
|
AsmTransCBE = x86_asm_table;
|
||||||
AssemblerDialect = AsmWriterFlavor;
|
AssemblerDialect = AsmWriterFlavor;
|
||||||
|
|
||||||
@ -97,17 +97,17 @@ X86ELFTargetAsmInfo::X86ELFTargetAsmInfo(const X86TargetMachine &TM) {
|
|||||||
AbsoluteEHSectionOffsets = false;
|
AbsoluteEHSectionOffsets = false;
|
||||||
|
|
||||||
// On Linux we must declare when we can use a non-executable stack.
|
// On Linux we must declare when we can use a non-executable stack.
|
||||||
if (TM.getSubtarget<X86Subtarget>().isLinux())
|
if (Triple.getOS() == Triple::Linux)
|
||||||
NonexecutableStackDirective = "\t.section\t.note.GNU-stack,\"\",@progbits";
|
NonexecutableStackDirective = "\t.section\t.note.GNU-stack,\"\",@progbits";
|
||||||
}
|
}
|
||||||
|
|
||||||
X86COFFTargetAsmInfo::X86COFFTargetAsmInfo(const X86TargetMachine &TM) {
|
X86COFFTargetAsmInfo::X86COFFTargetAsmInfo(const Triple &Triple) {
|
||||||
AsmTransCBE = x86_asm_table;
|
AsmTransCBE = x86_asm_table;
|
||||||
AssemblerDialect = AsmWriterFlavor;
|
AssemblerDialect = AsmWriterFlavor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
X86WinTargetAsmInfo::X86WinTargetAsmInfo(const X86TargetMachine &TM) {
|
X86WinTargetAsmInfo::X86WinTargetAsmInfo(const Triple &Triple) {
|
||||||
AsmTransCBE = x86_asm_table;
|
AsmTransCBE = x86_asm_table;
|
||||||
AssemblerDialect = AsmWriterFlavor;
|
AssemblerDialect = AsmWriterFlavor;
|
||||||
|
|
||||||
|
@ -14,27 +14,27 @@
|
|||||||
#ifndef X86TARGETASMINFO_H
|
#ifndef X86TARGETASMINFO_H
|
||||||
#define X86TARGETASMINFO_H
|
#define X86TARGETASMINFO_H
|
||||||
|
|
||||||
#include "X86TargetMachine.h"
|
|
||||||
#include "llvm/Target/TargetAsmInfo.h"
|
#include "llvm/Target/TargetAsmInfo.h"
|
||||||
#include "llvm/Target/COFFTargetAsmInfo.h"
|
#include "llvm/Target/COFFTargetAsmInfo.h"
|
||||||
#include "llvm/Target/DarwinTargetAsmInfo.h"
|
#include "llvm/Target/DarwinTargetAsmInfo.h"
|
||||||
|
|
||||||
namespace llvm {
|
namespace llvm {
|
||||||
|
class Triple;
|
||||||
|
|
||||||
struct X86DarwinTargetAsmInfo : public DarwinTargetAsmInfo {
|
struct X86DarwinTargetAsmInfo : public DarwinTargetAsmInfo {
|
||||||
explicit X86DarwinTargetAsmInfo(const X86TargetMachine &TM);
|
explicit X86DarwinTargetAsmInfo(const Triple &Triple);
|
||||||
};
|
};
|
||||||
|
|
||||||
struct X86ELFTargetAsmInfo : public TargetAsmInfo {
|
struct X86ELFTargetAsmInfo : public TargetAsmInfo {
|
||||||
explicit X86ELFTargetAsmInfo(const X86TargetMachine &TM);
|
explicit X86ELFTargetAsmInfo(const Triple &Triple);
|
||||||
};
|
};
|
||||||
|
|
||||||
struct X86COFFTargetAsmInfo : public COFFTargetAsmInfo {
|
struct X86COFFTargetAsmInfo : public COFFTargetAsmInfo {
|
||||||
explicit X86COFFTargetAsmInfo(const X86TargetMachine &TM);
|
explicit X86COFFTargetAsmInfo(const Triple &Triple);
|
||||||
};
|
};
|
||||||
|
|
||||||
struct X86WinTargetAsmInfo : public TargetAsmInfo {
|
struct X86WinTargetAsmInfo : public TargetAsmInfo {
|
||||||
explicit X86WinTargetAsmInfo(const X86TargetMachine &TM);
|
explicit X86WinTargetAsmInfo(const Triple &Triple);
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace llvm
|
} // namespace llvm
|
||||||
|
@ -22,26 +22,33 @@
|
|||||||
#include "llvm/Target/TargetRegistry.h"
|
#include "llvm/Target/TargetRegistry.h"
|
||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
|
|
||||||
|
static const TargetAsmInfo *createTargetAsmInfo(const Target &T,
|
||||||
|
const StringRef &TT) {
|
||||||
|
Triple TheTriple(TT);
|
||||||
|
switch (TheTriple.getOS()) {
|
||||||
|
case Triple::Darwin:
|
||||||
|
return new X86DarwinTargetAsmInfo(TheTriple);
|
||||||
|
case Triple::MinGW32:
|
||||||
|
case Triple::MinGW64:
|
||||||
|
case Triple::Cygwin:
|
||||||
|
return new X86COFFTargetAsmInfo(TheTriple);
|
||||||
|
case Triple::Win32:
|
||||||
|
return new X86WinTargetAsmInfo(TheTriple);
|
||||||
|
default:
|
||||||
|
return new X86ELFTargetAsmInfo(TheTriple);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
extern "C" void LLVMInitializeX86Target() {
|
extern "C" void LLVMInitializeX86Target() {
|
||||||
// Register the target.
|
// Register the target.
|
||||||
RegisterTargetMachine<X86_32TargetMachine> X(TheX86_32Target);
|
RegisterTargetMachine<X86_32TargetMachine> X(TheX86_32Target);
|
||||||
RegisterTargetMachine<X86_64TargetMachine> Y(TheX86_64Target);
|
RegisterTargetMachine<X86_64TargetMachine> Y(TheX86_64Target);
|
||||||
|
|
||||||
|
// Register the target asm info.
|
||||||
|
RegisterAsmInfoFn A(TheX86_32Target, createTargetAsmInfo);
|
||||||
|
RegisterAsmInfoFn B(TheX86_64Target, createTargetAsmInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
const TargetAsmInfo *X86TargetMachine::createTargetAsmInfo() const {
|
|
||||||
switch (Subtarget.TargetType) {
|
|
||||||
default: llvm_unreachable("unknown subtarget type");
|
|
||||||
case X86Subtarget::isDarwin:
|
|
||||||
return new X86DarwinTargetAsmInfo(*this);
|
|
||||||
case X86Subtarget::isELF:
|
|
||||||
return new X86ELFTargetAsmInfo(*this);
|
|
||||||
case X86Subtarget::isMingw:
|
|
||||||
case X86Subtarget::isCygwin:
|
|
||||||
return new X86COFFTargetAsmInfo(*this);
|
|
||||||
case X86Subtarget::isWindows:
|
|
||||||
return new X86WinTargetAsmInfo(*this);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
X86_32TargetMachine::X86_32TargetMachine(const Target &T, const std::string &TT,
|
X86_32TargetMachine::X86_32TargetMachine(const Target &T, const std::string &TT,
|
||||||
const std::string &FS)
|
const std::string &FS)
|
||||||
|
@ -38,9 +38,6 @@ class X86TargetMachine : public LLVMTargetMachine {
|
|||||||
X86ELFWriterInfo ELFWriterInfo;
|
X86ELFWriterInfo ELFWriterInfo;
|
||||||
Reloc::Model DefRelocModel; // Reloc model before it's overridden.
|
Reloc::Model DefRelocModel; // Reloc model before it's overridden.
|
||||||
|
|
||||||
protected:
|
|
||||||
virtual const TargetAsmInfo *createTargetAsmInfo() const;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
X86TargetMachine(const Target &T, const std::string &TT,
|
X86TargetMachine(const Target &T, const std::string &TT,
|
||||||
const std::string &FS, bool is64Bit);
|
const std::string &FS, bool is64Bit);
|
||||||
|
@ -16,6 +16,7 @@
|
|||||||
#include "XCore.h"
|
#include "XCore.h"
|
||||||
#include "XCoreInstrInfo.h"
|
#include "XCoreInstrInfo.h"
|
||||||
#include "XCoreSubtarget.h"
|
#include "XCoreSubtarget.h"
|
||||||
|
#include "XCoreTargetAsmInfo.h"
|
||||||
#include "XCoreTargetMachine.h"
|
#include "XCoreTargetMachine.h"
|
||||||
#include "llvm/Constants.h"
|
#include "llvm/Constants.h"
|
||||||
#include "llvm/DerivedTypes.h"
|
#include "llvm/DerivedTypes.h"
|
||||||
@ -26,7 +27,6 @@
|
|||||||
#include "llvm/CodeGen/MachineFunctionPass.h"
|
#include "llvm/CodeGen/MachineFunctionPass.h"
|
||||||
#include "llvm/CodeGen/MachineConstantPool.h"
|
#include "llvm/CodeGen/MachineConstantPool.h"
|
||||||
#include "llvm/CodeGen/MachineInstr.h"
|
#include "llvm/CodeGen/MachineInstr.h"
|
||||||
#include "llvm/Target/TargetAsmInfo.h"
|
|
||||||
#include "llvm/Target/TargetData.h"
|
#include "llvm/Target/TargetData.h"
|
||||||
#include "llvm/Target/TargetLoweringObjectFile.h"
|
#include "llvm/Target/TargetLoweringObjectFile.h"
|
||||||
#include "llvm/Target/TargetRegistry.h"
|
#include "llvm/Target/TargetRegistry.h"
|
||||||
@ -380,4 +380,5 @@ bool XCoreAsmPrinter::doInitialization(Module &M) {
|
|||||||
extern "C" void LLVMInitializeXCoreTarget() {
|
extern "C" void LLVMInitializeXCoreTarget() {
|
||||||
RegisterTargetMachine<XCoreTargetMachine> X(TheXCoreTarget);
|
RegisterTargetMachine<XCoreTargetMachine> X(TheXCoreTarget);
|
||||||
RegisterAsmPrinter<XCoreAsmPrinter> Y(TheXCoreTarget);
|
RegisterAsmPrinter<XCoreAsmPrinter> Y(TheXCoreTarget);
|
||||||
|
RegisterAsmInfo<XCoreTargetAsmInfo> Z(TheXCoreTarget);
|
||||||
}
|
}
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
#include "XCoreTargetAsmInfo.h"
|
#include "XCoreTargetAsmInfo.h"
|
||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
|
|
||||||
XCoreTargetAsmInfo::XCoreTargetAsmInfo() {
|
XCoreTargetAsmInfo::XCoreTargetAsmInfo(const Target &T, const StringRef &TT) {
|
||||||
SupportsDebugInformation = true;
|
SupportsDebugInformation = true;
|
||||||
Data16bitsDirective = "\t.short\t";
|
Data16bitsDirective = "\t.short\t";
|
||||||
Data32bitsDirective = "\t.long\t";
|
Data32bitsDirective = "\t.long\t";
|
||||||
|
@ -17,9 +17,11 @@
|
|||||||
#include "llvm/Target/TargetAsmInfo.h"
|
#include "llvm/Target/TargetAsmInfo.h"
|
||||||
|
|
||||||
namespace llvm {
|
namespace llvm {
|
||||||
|
class Target;
|
||||||
|
class StringRef;
|
||||||
class XCoreTargetAsmInfo : public TargetAsmInfo {
|
class XCoreTargetAsmInfo : public TargetAsmInfo {
|
||||||
public:
|
public:
|
||||||
explicit XCoreTargetAsmInfo();
|
explicit XCoreTargetAsmInfo(const Target &T, const StringRef &TT);
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace llvm
|
} // namespace llvm
|
||||||
|
@ -17,10 +17,6 @@
|
|||||||
#include "llvm/PassManager.h"
|
#include "llvm/PassManager.h"
|
||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
|
|
||||||
const TargetAsmInfo *XCoreTargetMachine::createTargetAsmInfo() const {
|
|
||||||
return new XCoreTargetAsmInfo();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// XCoreTargetMachine ctor - Create an ILP32 architecture model
|
/// XCoreTargetMachine ctor - Create an ILP32 architecture model
|
||||||
///
|
///
|
||||||
XCoreTargetMachine::XCoreTargetMachine(const Target &T, const std::string &TT,
|
XCoreTargetMachine::XCoreTargetMachine(const Target &T, const std::string &TT,
|
||||||
|
@ -29,10 +29,6 @@ class XCoreTargetMachine : public LLVMTargetMachine {
|
|||||||
XCoreInstrInfo InstrInfo;
|
XCoreInstrInfo InstrInfo;
|
||||||
XCoreFrameInfo FrameInfo;
|
XCoreFrameInfo FrameInfo;
|
||||||
XCoreTargetLowering TLInfo;
|
XCoreTargetLowering TLInfo;
|
||||||
|
|
||||||
protected:
|
|
||||||
virtual const TargetAsmInfo *createTargetAsmInfo() const;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
XCoreTargetMachine(const Target &T, const std::string &TT,
|
XCoreTargetMachine(const Target &T, const std::string &TT,
|
||||||
const std::string &FS);
|
const std::string &FS);
|
||||||
|
Reference in New Issue
Block a user