LLVM: lib/Target/RISCV/RISCVTargetObjectFile.cpp Source File (original) (raw)

1

2

3

4

5

6

7

8

17

18using namespace llvm;

19

24

28

31

36 SmallRODataSection =

46}

47

57

58

59

60

62

63

64 return Size > 0 && Size <= SSThreshold;

65}

66

67

68

71

73 if (!GVA)

74 return false;

75

76

79

80

81

82 if (Section == ".sdata" || Section == ".sbss")

83 return true;

84

85

86

87 return false;

88 }

89

92 return false;

93

95

96

97

98 if (!Ty->isSized())

99 return false;

100

103}

104

107

109

110

111

112 bool EmitUniquedSection = TM.getDataSections() && !GO->hasSection();

113

114 if (Kind.isBSS()) {

115 if (EmitUniquedSection) {

117 Name.append(GO->getName());

120 }

121

122 return SmallBSSSection;

123 }

124

125 if (Kind.isData()) {

126 if (EmitUniquedSection) {

128 Name.append(GO->getName());

131 }

132

133 return SmallDataSection;

134 }

135 }

136

137

139}

140

144 M.getModuleFlagsMetadata(ModuleFlags);

145

146 for (const auto &MFE : ModuleFlags) {

148 if (Key == "SmallDataLimit") {

150 break;

151 }

152 }

153}

154

155

160

163 Align &Alignment) const {

165 if (Kind.isMergeableConst4())

166 return SmallROData4Section;

167 if (Kind.isMergeableConst8())

168 return SmallROData8Section;

169 if (Kind.isMergeableConst16())

170 return SmallROData16Section;

171 if (Kind.isMergeableConst32())

172 return SmallROData32Section;

173

174

175 return SmallRODataSection;

176 }

177

178

180 Alignment);

181}

MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL

Module.h This file contains the declarations for the Module class.

This is an important base class in LLVM.

A parsed version of the target data layout string in and methods for querying it.

LLVM_ABI TypeSize getTypeAllocSize(Type *Ty) const

Returns the offset in bytes between successive objects of the specified type, including alignment pad...

StringRef getSection() const

Get the custom section of this global if it has one.

bool hasSection() const

Check if this global has a custom object file section.

bool hasExternalLinkage() const

LLVM_ABI bool isDeclaration() const

Return true if the primary definition of this global value is outside of the current translation unit...

LLVM_ABI const DataLayout & getDataLayout() const

Get the data layout of the module this global belongs to.

bool hasCommonLinkage() const

Type * getValueType() const

static const MCBinaryExpr * createAdd(const MCExpr *LHS, const MCExpr *RHS, MCContext &Ctx, SMLoc Loc=SMLoc())

static LLVM_ABI const MCConstantExpr * create(int64_t Value, MCContext &Ctx, bool PrintInHex=false, unsigned SizeInBytes=0)

Context object for machine code objects.

MCSectionELF * getELFSection(const Twine &Section, unsigned Type, unsigned Flags)

Base class for the full range of assembler expressions which are needed for parsing.

MCContext & getContext() const

Instances of this class represent a uniqued identifier for a section in the current translation unit.

static const MCSpecifierExpr * create(const MCExpr *Expr, Spec S, MCContext &Ctx, SMLoc Loc=SMLoc())

Streaming machine code generation interface.

static const MCSymbolRefExpr * create(const MCSymbol *Symbol, MCContext &Ctx, SMLoc Loc=SMLoc())

MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...

int64_t getConstant() const

This class contains meta information specific to a module.

A Module instance is used to store all the information related to an LLVM module.

bool isGlobalInSmallSection(const GlobalObject *GO, const TargetMachine &TM) const

Return true if this global address should be placed into small data/bss section.

Definition RISCVTargetObjectFile.cpp:69

MCSection * SelectSectionForGlobal(const GlobalObject *GO, SectionKind Kind, const TargetMachine &TM) const override

Definition RISCVTargetObjectFile.cpp:105

void getModuleMetadata(Module &M) override

Get the module-level metadata that the platform cares about.

Definition RISCVTargetObjectFile.cpp:141

MCSection * getSectionForConstant(const DataLayout &DL, SectionKind Kind, const Constant *C, Align &Alignment) const override

Given a constant with the SectionKind, return a section that it should be placed in.

Definition RISCVTargetObjectFile.cpp:161

bool isInSmallSection(uint64_t Size) const

Definition RISCVTargetObjectFile.cpp:61

void Initialize(MCContext &Ctx, const TargetMachine &TM) override

This method must be called before any actual lowering is done.

Definition RISCVTargetObjectFile.cpp:25

unsigned getTextSectionAlignment() const override

Definition RISCVTargetObjectFile.cpp:20

bool isConstantInSmallSection(const DataLayout &DL, const Constant *CN) const

Return true if this constant should be placed into small data section.

Definition RISCVTargetObjectFile.cpp:156

const MCExpr * getIndirectSymViaGOTPCRel(const GlobalValue *GV, const MCSymbol *Sym, const MCValue &MV, int64_t Offset, MachineModuleInfo *MMI, MCStreamer &Streamer) const override

Get the target specific PC relative GOT entry relocation.

Definition RISCVTargetObjectFile.cpp:48

unsigned getTextSectionAlignment() const override

SectionKind - This is a simple POD value that classifies the properties of a section.

SmallString - A SmallString is just a SmallVector with methods and accessors that make it work better...

This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.

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

void Initialize(MCContext &Ctx, const TargetMachine &TM) override

This method must be called before any actual lowering is done.

MCSection * getSectionForConstant(const DataLayout &DL, SectionKind Kind, const Constant *C, Align &Alignment) const override

Given a constant with the SectionKind, return a section that it should be placed in.

void getModuleMetadata(Module &M) override

Get the module-level metadata that the platform cares about.

MCSection * SelectSectionForGlobal(const GlobalObject *GO, SectionKind Kind, const TargetMachine &TM) const override

bool SupportIndirectSymViaGOTPCRel

uint32_t PLTPCRelativeSpecifier

Primary interface to the complete machine description for the target machine.

The instances of the Type class are immutable: once they are created, they are never changed.

Type * getType() const

All values are typed, get the type of this value.

LLVM_ABI StringRef getName() const

Return a constant reference to the value's name.

@ C

The default llvm calling convention, compatible with C.

std::enable_if_t< detail::IsValidPointer< X, Y >::value, X * > extract(Y &&MD)

Extract a Value from Metadata.

This is an optimization pass for GlobalISel generic memory operations.

decltype(auto) dyn_cast(const From &Val)

dyn_cast - Return the argument parameter cast to the specified type.

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

This struct is a compact representation of a valid (non-zero power of two) alignment.