LLVM: lib/Target/CSKY/CSKYTargetMachine.cpp Source File (original) (raw)

1

2

3

4

5

6

7

8

9

10

11

12

24#include

25

26using namespace llvm;

27

35

39 std::optionalReloc::Model RM,

40 std::optionalCodeModel::Model CM,

43 RM.value_or(Reloc::Static),

47}

48

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

52 Attribute TuneAttr = F.getFnAttribute("tune-cpu");

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

54

55 std::string CPU =

57 std::string TuneCPU =

59 std::string FS =

61

62 std::string Key = CPU + TuneCPU + FS;

63 auto &I = SubtargetMap[Key];

64 if (I) {

65

66

67

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

70 if (I->useHardFloat() && I->hasAnyFloatExt())

71 errs() << "Hard-float can't be used with current CPU,"

72 " set to Soft-float\n";

73 }

74 return I.get();

75}

76

83

84namespace {

86public:

89

92 }

93

94 void addIRPasses() override;

95 bool addInstSelector() override;

96 void addPreEmitPass() override;

97};

98

99}

100

102 return new CSKYPassConfig(*this, PM);

103}

104

105void CSKYPassConfig::addIRPasses() {

108}

109

110bool CSKYPassConfig::addInstSelector() {

111 addPass(createCSKYISelDag(getCSKYTargetMachine(), getOptLevel()));

112

113 return false;

114}

115

116void CSKYPassConfig::addPreEmitPass() {

118}

LLVM_EXTERNAL_VISIBILITY void LLVMInitializeCSKYTarget()

Definition CSKYTargetMachine.cpp:28

#define LLVM_EXTERNAL_VISIBILITY

const GCNTargetMachine & getTM(const GCNSubtarget *STI)

static TableGen::Emitter::OptClass< SkeletonEmitter > X("gen-skeleton-class", "Generate example skeleton class")

Target-Independent Code Generator Pass Configuration Options pass.

Functions, function parameters, and return types can have attributes to indicate how they should be t...

LLVM_ABI StringRef getValueAsString() const

Return the attribute's value as a string.

bool isValid() const

Return true if the attribute is any kind of attribute.

const CSKYSubtarget * getSubtargetImpl() const =delete

CSKYTargetMachine(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)

Definition CSKYTargetMachine.cpp:36

TargetPassConfig * createPassConfig(PassManagerBase &PM) override

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

Definition CSKYTargetMachine.cpp:101

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

Create the target's instance of MachineFunctionInfo.

Definition CSKYTargetMachine.cpp:77

CodeGenTargetMachineImpl(const Target &T, StringRef DataLayoutString, const Triple &TT, StringRef CPU, StringRef FS, const TargetOptions &Options, Reloc::Model RM, CodeModel::Model CM, CodeGenOptLevel OL)

PassRegistry - This class manages the registration and intitialization of the pass subsystem as appli...

static LLVM_ABI PassRegistry * getPassRegistry()

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

A global registry used in conjunction with static constructors to make pluggable components (like tar...

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 ...

This is an optimization pass for GlobalISel generic memory operations.

void initializeCSKYDAGToDAGISelLegacyPass(PassRegistry &)

void initializeCSKYConstantIslandsPass(PassRegistry &)

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.

CodeGenOptLevel

Code generation optimization level.

LLVM_ATTRIBUTE_VISIBILITY_DEFAULT AnalysisKey InnerAnalysisManagerProxy< AnalysisManagerT, IRUnitT, ExtraArgTs... >::Key

LLVM_ABI raw_fd_ostream & errs()

This returns a reference to a raw_ostream for standard error.

Target & getTheCSKYTarget()

FunctionPass * createCSKYConstantIslandPass()

Returns a pass that converts branches to long branches.

LLVM_ABI FunctionPass * createAtomicExpandLegacyPass()

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

BumpPtrAllocatorImpl<> BumpPtrAllocator

The standard BumpPtrAllocator which just uses the default template parameters.

FunctionPass * createCSKYISelDag(CSKYTargetMachine &TM, CodeGenOptLevel OptLevel)

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...

static FuncInfoTy * create(BumpPtrAllocator &Allocator, const Function &F, const SubtargetTy *STI)

Factory function: default behavior is to call new using the supplied allocator.

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