LLVM: include/llvm/MC/MCLinkerOptimizationHint.h Source File (original) (raw)

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16#ifndef LLVM_MC_MCLINKEROPTIMIZATIONHINT_H

17#define LLVM_MC_MCLINKEROPTIMIZATIONHINT_H

18

23#include

24#include

25

26namespace llvm {

27

32

33

44

48

52

54#define MCLOHCaseNameToId(Name) .Case(#Name, MCLOH_ ## Name)

65#undef MCLOHCaseNameToId

66}

67

69#define MCLOHCaseIdToName(Name) case MCLOH_ ## Name: return StringRef(#Name);

70 switch (Kind) {

79 }

81#undef MCLOHCaseIdToName

82}

83

85 switch (Kind) {

86

91 return 2;

92

97 return 3;

98 }

99 return -1;

100}

101

102

105

106

108

109

110

111

114

115public:

117

119 : Kind(Kind), Args(Args.begin(), Args.end()) {

121 }

122

124

126

127

128

130

131

132

135};

136

138

139 mutable uint64_t EmitSize = 0;

140

141

143

144public:

146

148

149

151 return Directives;

152 }

153

154

155

159

160

163 if (!EmitSize) {

165 EmitSize += D.getEmitSize(Asm, ObjWriter);

166 }

167 return EmitSize;

168 }

169

170

171

174 D.emit(Asm, ObjWriter);

175 }

176

178 Directives.clear();

179 EmitSize = 0;

180 }

181};

182

183

186

187}

188

189#endif

assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")

static GCRegistry::Add< StatepointGC > D("statepoint-example", "an example strategy for statepoint")

#define MCLOHCaseIdToName(Name)

#define MCLOHCaseNameToId(Name)

This file defines the SmallVector class.

This file implements the StringSwitch template, which mimics a switch() statement whose cases are str...

void emit(const MCAssembler &Asm, MachObjectWriter &ObjWriter) const

Emit all Linker Optimization Hint in one big table.

Definition MCLinkerOptimizationHint.h:172

SmallVectorImpl< MCLOHDirective > LOHDirectives

Definition MCLinkerOptimizationHint.h:145

const LOHDirectives & getDirectives() const

Const accessor to the directives.

Definition MCLinkerOptimizationHint.h:150

uint64_t getEmitSize(const MCAssembler &Asm, const MachObjectWriter &ObjWriter) const

Get the size of the directives if emitted.

Definition MCLinkerOptimizationHint.h:161

void addDirective(MCLOHType Kind, const MCLOHDirective::LOHArgs &Args)

Add the directive of the given kind Kind with the given arguments Args to the container.

Definition MCLinkerOptimizationHint.h:156

void reset()

Definition MCLinkerOptimizationHint.h:177

Store Linker Optimization Hint information (LOH).

Definition MCLinkerOptimizationHint.h:103

LLVM_ABI uint64_t getEmitSize(const MCAssembler &Asm, const MachObjectWriter &ObjWriter) const

Get the size in bytes of this directive if emitted in ObjWriter with the given Layout.

const LOHArgs & getArgs() const

Definition MCLinkerOptimizationHint.h:125

LLVM_ABI void emit(const MCAssembler &Asm, MachObjectWriter &ObjWriter) const

Emit this directive as: <kind, numArgs, addr1, ..., addrN>

MCLOHType getKind() const

Definition MCLinkerOptimizationHint.h:123

MCLOHDirective(MCLOHType Kind, const LOHArgs &Args)

Definition MCLinkerOptimizationHint.h:118

SmallVectorImpl< MCSymbol * > LOHArgs

Definition MCLinkerOptimizationHint.h:116

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

This class consists of common code factored out of the SmallVector class to reduce code duplication b...

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.

A switch()-like statement whose cases are string literals.

This class implements an extremely fast bulk output stream that can only output to a stream.

This is an optimization pass for GlobalISel generic memory operations.

static int MCLOHNameToId(StringRef Name)

Definition MCLinkerOptimizationHint.h:53

static StringRef MCLOHDirectiveName()

Definition MCLinkerOptimizationHint.h:45

static bool isValidMCLOHType(unsigned Kind)

Definition MCLinkerOptimizationHint.h:49

MCLOHDirective::LOHArgs MCLOHArgs

Definition MCLinkerOptimizationHint.h:184

static int MCLOHIdToNbArgs(MCLOHType Kind)

Definition MCLinkerOptimizationHint.h:84

MCLOHType

Linker Optimization Hint Type.

Definition MCLinkerOptimizationHint.h:34

@ MCLOH_AdrpAddLdr

Adrp _v@PAGE -> Add _v@PAGEOFF -> Ldr.

Definition MCLinkerOptimizationHint.h:37

@ MCLOH_AdrpLdrGotStr

Adrp _v@GOTPAGE -> Ldr _v@GOTPAGEOFF -> Str.

Definition MCLinkerOptimizationHint.h:40

@ MCLOH_AdrpLdrGotLdr

Adrp _v@GOTPAGE -> Ldr _v@GOTPAGEOFF -> Ldr.

Definition MCLinkerOptimizationHint.h:38

@ MCLOH_AdrpLdrGot

Adrp _v@GOTPAGE -> Ldr _v@GOTPAGEOFF.

Definition MCLinkerOptimizationHint.h:42

@ MCLOH_AdrpLdr

Adrp _v@PAGE -> Ldr _v@PAGEOFF.

Definition MCLinkerOptimizationHint.h:36

@ MCLOH_AdrpAdd

Adrp _v@PAGE -> Add _v@PAGEOFF.

Definition MCLinkerOptimizationHint.h:41

@ MCLOH_AdrpAddStr

Adrp _v@PAGE -> Add _v@PAGEOFF -> Str.

Definition MCLinkerOptimizationHint.h:39

@ MCLOH_AdrpAdrp

Adrp xY, _v1@PAGE -> Adrp xY, _v2@PAGE.

Definition MCLinkerOptimizationHint.h:35

MCLOHContainer::LOHDirectives MCLOHDirectives

Definition MCLinkerOptimizationHint.h:185

static StringRef MCLOHIdToName(MCLOHType Kind)

Definition MCLinkerOptimizationHint.h:68