LLVM: lib/Target/M68k/M68kTargetMachine.cpp Source File (original) (raw)

1

2

3

4

5

6

7

8

9

10

11

12

13

29#include

30#include

31

32using namespace llvm;

33

34#define DEBUG_TYPE "m68k"

35

44}

45

46namespace {

47

50 std::string Ret = "";

51

52 Ret += "E";

53

54

55 Ret += "-m:e";

56

57

58

59

60

61 Ret += "-p:32:16:32";

62

63

64

65 Ret += "-i8:8:8-i16:16:16-i32:16:32";

66

67

68

69

70 Ret += "-n8:16:32";

71

72 Ret += "-a:0:16-S16";

73

74 return Ret;

75}

76

78 std::optionalReloc::Model RM) {

79

80 if (RM.has_value())

82

83 return *RM;

84}

85

87 bool JIT) {

88 if (!CM) {

92 }

93 return CM.value();

94}

95}

96

100 std::optionalReloc::Model RM,

101 std::optionalCodeModel::Model CM,

107 Subtarget(TT, CPU, FS, *this) {

109}

110

112

115 Attribute CPUAttr = F.getFnAttribute("target-cpu");

116 Attribute FSAttr = F.getFnAttribute("target-features");

117

120

121 auto &I = SubtargetMap[CPU + FS];

122 if (I) {

123

124

125

127 I = std::make_unique(TargetTriple, CPU, FS, *this);

128 }

129 return I.get();

130}

131

135 return M68kMachineFunctionInfo::create(Allocator, F,

137}

138

139

140

141

142

143namespace {

145public:

148

150 return getTM();

151 }

152

154 return *getM68kTargetMachine().getSubtargetImpl();

155 }

156 void addIRPasses() override;

157 bool addIRTranslator() override;

158 bool addLegalizeMachineIR() override;

159 bool addRegBankSelect() override;

160 bool addGlobalInstructionSelect() override;

161 bool addInstSelector() override;

162 void addPreSched2() override;

163 void addPreEmitPass() override;

164};

165}

166

168 return new M68kPassConfig(*this, PM);

169}

170

171void M68kPassConfig::addIRPasses() {

174}

175

176bool M68kPassConfig::addInstSelector() {

177

180 return false;

181}

182

183bool M68kPassConfig::addIRTranslator() {

185 return false;

186}

187

188bool M68kPassConfig::addLegalizeMachineIR() {

190 return false;

191}

192

193bool M68kPassConfig::addRegBankSelect() {

195 return false;

196}

197

198bool M68kPassConfig::addGlobalInstructionSelect() {

200 return false;

201}

202

204

205void M68kPassConfig::addPreEmitPass() {

207}

static Reloc::Model getEffectiveRelocModel(const Triple &TT, std::optional< Reloc::Model > RM)

#define LLVM_EXTERNAL_VISIBILITY

static GCMetadataPrinterRegistry::Add< ErlangGCPrinter > X("erlang", "erlang-compatible garbage collector")

This file declares the IRTranslator pass.

static std::string computeDataLayout()

This file declares the M68k specific subclass of MachineFunctionInfo.

This file declares the M68k specific subclass of TargetSubtargetInfo.

LLVM_EXTERNAL_VISIBILITY void LLVMInitializeM68kTarget()

This file declares the M68k specific subclass of TargetMachine.

This file contains declarations for M68k ELF object file lowering.

This file contains the entry points for global functions defined in the M68k target library,...

This file describes the interface of the MachineFunctionPass responsible for assigning the generic vi...

Target-Independent Code Generator Pass Configuration Options pass.

StringRef getValueAsString() const

Return the attribute's value as a string.

bool isValid() const

Return true if the attribute is any kind of attribute.

Allocate memory in an ever growing pool, as if by bump-pointer.

implements a set of functionality in the TargetMachine class for targets that make use of the indepen...

This pass is responsible for selecting generic machine instructions to target-specific instructions.

~M68kTargetMachine() override

const M68kSubtarget * getSubtargetImpl() const

MachineFunctionInfo * createMachineFunctionInfo(BumpPtrAllocator &Allocator, const Function &F, const TargetSubtargetInfo *STI) const override

Create the target's instance of MachineFunctionInfo.

M68kTargetMachine(const Target &T, const Triple &TT, StringRef CPU, StringRef FS, const TargetOptions &Options, std::optional< Reloc::Model > RM, std::optional< CodeModel::Model > CM, CodeGenOptLevel OL, bool JIT)

TargetPassConfig * createPassConfig(PassManagerBase &PM) override

Create a pass configuration object to be used by addPassToEmitX methods for generating a pipeline of ...

static PassRegistry * getPassRegistry()

getPassRegistry - Access the global registry object, which is automatically initialized at applicatio...

This pass implements the reg bank selector pass used in the GlobalISel pipeline.

StringRef - Represent a constant reference to a string, i.e.

std::string str() const

str - Get the contents as an std::string.

Triple TargetTriple

Triple string, CPU name, and target feature strings the TargetMachine instance is created with.

std::unique_ptr< const MCSubtargetInfo > STI

void resetTargetOptions(const Function &F) const

Reset the target options based on the function's attributes.

Target-Independent Code Generator Pass Configuration Options.

virtual void addIRPasses()

Add common target configurable passes that perform LLVM IR to IR transforms following machine indepen...

TargetSubtargetInfo - Generic base class for all target subtargets.

Target - Wrapper for Target specific information.

Triple - Helper class for working with autoconf configuration names.

PassManagerBase - An abstract interface to allow code to add passes to a pass manager without having ...

#define llvm_unreachable(msg)

Marks that the current location is not supposed to be reachable.

This is an optimization pass for GlobalISel generic memory operations.

void initializeM68kGlobalBaseRegPass(PassRegistry &)

void initializeM68kExpandPseudoPass(PassRegistry &)

void initializeM68kCollapseMOVEMPass(PassRegistry &)

FunctionPass * createM68kGlobalBaseRegPass()

This pass initializes a global base register for PIC on M68k.

CodeModel::Model getEffectiveCodeModel(std::optional< CodeModel::Model > CM, CodeModel::Model Default)

Helper method for getting the code model, returning Default if CM does not have a value.

FunctionPass * createM68kCollapseMOVEMPass()

Finds sequential MOVEM instruction and collapse them into a single one.

FunctionPass * createM68kISelDag(M68kTargetMachine &TM)

This pass converts a legalized DAG into a M68k-specific DAG, ready for instruction scheduling.

CodeGenOptLevel

Code generation optimization level.

void initializeM68kDAGToDAGISelLegacyPass(PassRegistry &)

void initializeGlobalISel(PassRegistry &)

Initialize all passes linked into the GlobalISel library.

Target & getTheM68kTarget()

FunctionPass * createM68kExpandPseudoPass()

Return a Machine IR pass that expands M68k-specific pseudo instructions into a sequence of actual ins...

FunctionPass * createAtomicExpandLegacyPass()

AtomicExpandPass - At IR level this pass replace atomic instructions with __atomic_* library calls,...

Implement std::hash so that hash_code can be used in STL containers.

MachineFunctionInfo - This class can be derived from and used by targets to hold private target-speci...

RegisterTargetMachine - Helper template for registering a target machine implementation,...