LLVM: lib/Target/Lanai/LanaiTargetObjectFile.cpp Source File (original) (raw)

1

2

3

4

5

6

7

9

17

18using namespace llvm;

19

21 "lanai-ssection-threshold", cl::Hidden,

22 cl::desc("Small data and bss section threshold size (default=0)"),

24

34

35

36

37

43

44

45

46bool LanaiTargetObjectFile::isGlobalInSmallSection(

49

50

51

52

54 return isGlobalInSmallSectionImpl(GO, TM);

55

57}

58

59

60

61bool LanaiTargetObjectFile::isGlobalInSmallSection(const GlobalObject *GO,

64 return isGlobalInSmallSectionImpl(GO, TM);

65}

66

67

68

69

70bool LanaiTargetObjectFile::isGlobalInSmallSectionImpl(

73

74

76

77

78

79

80 if (GVA->getSection().starts_with(".ldata"))

81 return false;

82

84 return true;

85

86 if (GVA->hasLocalLinkage())

87 return false;

88

89 if (((GVA->hasExternalLinkage() && GVA->isDeclaration()) ||

90 GVA->hasCommonLinkage()))

91 return false;

92

93 Type *Ty = GVA->getValueType();

95 GVA->getDataLayout().getTypeAllocSize(Ty));

96}

97

100

101 if (Kind.isBSS() && isGlobalInSmallSection(GO, TM, Kind))

102 return SmallBSSSection;

103 if (Kind.isData() && isGlobalInSmallSection(GO, TM, Kind))

104 return SmallDataSection;

105

106

108}

109

110

115

118 Align &Alignment) const {

120 return SmallDataSection;

121

122

124 Alignment);

125}

MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL

static cl::opt< unsigned > SSThreshold("lanai-ssection-threshold", cl::Hidden, cl::desc("Small data and bss section threshold size (default=0)"), cl::init(0))

static bool isInSmallSection(uint64_t Size)

Definition LanaiTargetObjectFile.cpp:38

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 bool isDeclaration() const

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

bool hasAvailableExternallyLinkage() const

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 LanaiTargetObjectFile.cpp:116

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

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

Definition LanaiTargetObjectFile.cpp:25

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

Definition LanaiTargetObjectFile.cpp:98

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

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

Definition LanaiTargetObjectFile.cpp:111

Context object for machine code objects.

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

MCContext & getContext() const

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

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

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.

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

static SectionKind getKindForGlobal(const GlobalObject *GO, const TargetMachine &TM)

Classify the specified global variable into a set of target independent categories embodied in Sectio...

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

CodeModel::Model getCodeModel() const

Returns the code model.

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.

@ C

The default llvm calling convention, compatible with C.

initializer< Ty > init(const Ty &Val)

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.

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