LLVM: include/llvm/CodeGen/MachineMemOperand.h Source File (original) (raw)

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15#ifndef LLVM_CODEGEN_MACHINEMEMOPERAND_H

16#define LLVM_CODEGEN_MACHINEMEMOPERAND_H

17

26#include "llvm/IR/Value.h"

30

31namespace llvm {

32

38

39

40

41

43

45

46

48

50

52

58

62 AddrSpace = v ? v->getAddressSpace() : 0;

63 }

64

68

71 int64_t offset = 0,

74 if (V) {

76 AddrSpace = ValPtr->getType()->getPointerAddressSpace();

77 else

79 }

80 }

81

90

91

92

95

96

98

99

101

102

103

106

107

109

110

112

113

116

117

119};

120

121

122

123

124

125

126

127

128

129

131public:

132

134

136

138

140

142

144

146

148

149

150

151

152

157

159 };

160

161private:

162

163 struct MachineAtomicInfo {

164

165 unsigned SSID : 8;

166

167

168 unsigned Ordering : 4;

169

170

171 unsigned FailureOrdering : 4;

172 };

173

174 MachinePointerInfo PtrInfo;

175

176

177

178 LLT MemoryType;

179

180 Flags FlagVals;

181 Align BaseAlign;

182 MachineAtomicInfo AtomicInfo;

183 AAMDNodes AAInfo;

184 const MDNode *Ranges;

185

186public:

187

188

189

190

191

193 MachineMemOperand(MachinePointerInfo PtrInfo, Flags flags, LocationSize TS,

194 Align a, const AAMDNodes &AAInfo = AAMDNodes(),

195 const MDNode *Ranges = nullptr,

200 MachineMemOperand(MachinePointerInfo PtrInfo, Flags flags, LLT type, Align a,

201 const AAMDNodes &AAInfo = AAMDNodes(),

202 const MDNode *Ranges = nullptr,

206

208

209

210

211

212

213

214

215

219

223

224 const void *getOpaqueValue() const { return PtrInfo.V.getOpaqueValue(); }

225

226

228

229

231

232

233

234 int64_t getOffset() const { return PtrInfo.Offset; }

235

236 unsigned getAddrSpace() const { return PtrInfo.getAddrSpace(); }

237

238

239

241

242

244 return MemoryType.isValid()

247 }

248

249

251 return MemoryType.isValid()

254 }

255

257 return MemoryType;

258 }

259

260

261

263

264

265

267

268

270

271

273

274

278

279

280

281

285

286

287

289 return static_cast<AtomicOrdering>(AtomicInfo.FailureOrdering);

290 }

291

292

293

294

298

305

306

307

311

312

313

314

320

321

322

323

325

326

327

328

331 void setOffset(int64_t NewOffset) { PtrInfo.Offset = NewOffset; }

332

333

335 MemoryType = NewTy;

336 }

337

338

340

341

342

347

348

351 return LHS.getValue() == RHS.getValue() &&

352 LHS.getPseudoValue() == RHS.getPseudoValue() &&

353 LHS.getSize() == RHS.getSize() &&

354 LHS.getOffset() == RHS.getOffset() &&

355 LHS.getFlags() == RHS.getFlags() &&

356 LHS.getAAInfo() == RHS.getAAInfo() &&

357 LHS.getRanges() == RHS.getRanges() &&

358 LHS.getAlign() == RHS.getAlign() &&

359 LHS.getAddrSpace() == RHS.getAddrSpace();

360 }

361

364 return !(LHS == RHS);

365 }

366};

367

368}

369

370#endif

const TargetInstrInfo & TII

MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL

Atomic ordering constants.

Implement a low-level type suitable for MachineInstr level instruction selection.

This file provides utility analysis objects describing memory locations.

This file defines the PointerUnion class, which is a discriminated union of pointer types.

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

This is an important class for using LLVM in a threaded context.

static LocationSize precise(uint64_t Value)

static constexpr LocationSize beforeOrAfterPointer()

Any location before or after the base pointer (but still within the underlying object).

The MachineFrameInfo class represents an abstract stack frame until prolog/epilog code is inserted.

A description of a memory reference used in the backend.

Definition MachineMemOperand.h:130

LLT getType() const

Definition MachineMemOperand.h:256

void setType(LLT NewTy)

Reset the tracked memory type.

Definition MachineMemOperand.h:334

LocationSize getSize() const

Return the size in bytes of the memory reference.

Definition MachineMemOperand.h:243

bool isVolatile() const

Definition MachineMemOperand.h:301

AtomicOrdering getFailureOrdering() const

For cmpxchg atomic operations, return the atomic ordering requirements when store does not occur.

Definition MachineMemOperand.h:288

const PseudoSourceValue * getPseudoValue() const

Definition MachineMemOperand.h:220

LLT getMemoryType() const

Return the memory type of the memory reference.

Definition MachineMemOperand.h:240

unsigned getAddrSpace() const

Definition MachineMemOperand.h:236

void clearRanges()

Unset the tracked range metadata.

Definition MachineMemOperand.h:339

LLVM_ABI void print(raw_ostream &OS, ModuleSlotTracker &MST, SmallVectorImpl< StringRef > &SSNs, const LLVMContext &Context, const MachineFrameInfo *MFI, const TargetInstrInfo *TII) const

Support for operator<<.

bool isNonTemporal() const

Definition MachineMemOperand.h:302

bool isUnordered() const

Returns true if this memory operation doesn't have any ordering constraints other than normal aliasin...

Definition MachineMemOperand.h:315

const MDNode * getRanges() const

Return the range tag for the memory reference.

Definition MachineMemOperand.h:272

void setValue(const Value *NewSV)

Change the SourceValue for this MachineMemOperand.

Definition MachineMemOperand.h:329

bool isAtomic() const

Returns true if this operation has an atomic ordering requirement of unordered or higher,...

Definition MachineMemOperand.h:308

LLVM_ABI void refineAlignment(const MachineMemOperand *MMO)

Update this MachineMemOperand to reflect the alignment of MMO, if it has a greater alignment.

SyncScope::ID getSyncScopeID() const

Returns the synchronization scope ID for this memory operation.

Definition MachineMemOperand.h:275

const void * getOpaqueValue() const

Definition MachineMemOperand.h:224

bool isInvariant() const

Definition MachineMemOperand.h:304

friend bool operator!=(const MachineMemOperand &LHS, const MachineMemOperand &RHS)

Definition MachineMemOperand.h:362

LLVM_ABI MachineMemOperand(MachinePointerInfo PtrInfo, Flags flags, LocationSize TS, Align a, const AAMDNodes &AAInfo=AAMDNodes(), const MDNode *Ranges=nullptr, SyncScope::ID SSID=SyncScope::System, AtomicOrdering Ordering=AtomicOrdering::NotAtomic, AtomicOrdering FailureOrdering=AtomicOrdering::NotAtomic)

Construct a MachineMemOperand object with the specified PtrInfo, flags, size, and base alignment.

bool isLoad() const

Definition MachineMemOperand.h:299

AtomicOrdering getMergedOrdering() const

Return a single atomic ordering that is at least as strong as both the success and failure orderings ...

Definition MachineMemOperand.h:295

void setOffset(int64_t NewOffset)

Definition MachineMemOperand.h:331

bool isStore() const

Definition MachineMemOperand.h:300

Flags

Flags values. These may be or'd together.

Definition MachineMemOperand.h:133

@ MOTargetFlag2

Definition MachineMemOperand.h:154

@ MOVolatile

The memory access is volatile.

Definition MachineMemOperand.h:141

@ MODereferenceable

The memory access is dereferenceable (i.e., doesn't trap).

Definition MachineMemOperand.h:145

@ MOLoad

The memory access reads data.

Definition MachineMemOperand.h:137

@ MONonTemporal

The memory access is non-temporal.

Definition MachineMemOperand.h:143

@ MONone

Definition MachineMemOperand.h:135

@ MOInvariant

The memory access always returns the same value (or traps).

Definition MachineMemOperand.h:147

@ MOTargetFlag1

Definition MachineMemOperand.h:153

@ MOTargetFlag3

Definition MachineMemOperand.h:155

@ MOStore

The memory access writes data.

Definition MachineMemOperand.h:139

@ MOTargetFlag4

Definition MachineMemOperand.h:156

AtomicOrdering getSuccessOrdering() const

Return the atomic ordering requirements for this memory operation.

Definition MachineMemOperand.h:282

void setFlags(Flags f)

Bitwise OR the current flags with the given flags.

Definition MachineMemOperand.h:230

const MachinePointerInfo & getPointerInfo() const

Definition MachineMemOperand.h:207

Flags getFlags() const

Return the raw flags of the source value,.

Definition MachineMemOperand.h:227

LLVM_ABI Align getAlign() const

Return the minimum known alignment in bytes of the actual memory reference.

LocationSize getSizeInBits() const

Return the size in bits of the memory reference.

Definition MachineMemOperand.h:250

bool isDereferenceable() const

Definition MachineMemOperand.h:303

friend bool operator==(const MachineMemOperand &LHS, const MachineMemOperand &RHS)

Definition MachineMemOperand.h:349

AAMDNodes getAAInfo() const

Return the AA tags for the memory reference.

Definition MachineMemOperand.h:269

void setValue(const PseudoSourceValue *NewSV)

Definition MachineMemOperand.h:330

const Value * getValue() const

Return the base address of the memory access.

Definition MachineMemOperand.h:216

Align getBaseAlign() const

Return the minimum known alignment in bytes of the base address, without the offset.

Definition MachineMemOperand.h:266

int64_t getOffset() const

For normal values, this is a byte offset added to the base address.

Definition MachineMemOperand.h:234

Manage lifetime of a slot tracker for printing IR.

A discriminated union of two or more pointer types, with the discriminator in the low bit of the poin...

Special value supplied for machine level alias analysis.

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

TargetInstrInfo - Interface to description of machine instruction set.

LLVM Value Representation.

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

unsigned ID

LLVM IR allows to use arbitrary numbers as calling convention identifiers.

@ C

The default llvm calling convention, compatible with C.

@ System

Synchronized with respect to all concurrently executing threads.

This is an optimization pass for GlobalISel generic memory operations.

unsigned getPointerAddressSpace(const Type *T)

auto dyn_cast_if_present(const Y &Val)

dyn_cast_if_present - Functionally identical to dyn_cast, except that a null (or none in the case ...

AtomicOrdering getMergedAtomicOrdering(AtomicOrdering AO, AtomicOrdering Other)

Return a single atomic ordering that is at least as strong as both the AO and Other orderings for an ...

bool isa(const From &Val)

isa - Return true if the parameter to the template is an instance of one of the template type argu...

AtomicOrdering

Atomic ordering for LLVM's memory model.

@ LLVM_MARK_AS_BITMASK_ENUM

decltype(auto) cast(const From &Val)

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

A collection of metadata nodes that might be associated with a memory access used by the alias-analys...

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

This class contains a discriminated union of information about pointers in memory operands,...

Definition MachineMemOperand.h:42

static LLVM_ABI MachinePointerInfo getJumpTable(MachineFunction &MF)

Return a MachinePointerInfo record that refers to a jump table entry.

LLVM_ABI bool isDereferenceable(unsigned Size, LLVMContext &C, const DataLayout &DL) const

Return true if memory region [V, V+Offset+Size) is known to be dereferenceable.

MachinePointerInfo(const PseudoSourceValue *v, int64_t offset=0, uint8_t ID=0)

Definition MachineMemOperand.h:59

LLVM_ABI unsigned getAddrSpace() const

Return the LLVM IR address space number that this pointer points into.

static LLVM_ABI MachinePointerInfo getStack(MachineFunction &MF, int64_t Offset, uint8_t ID=0)

Stack pointer relative access.

uint8_t StackID

Definition MachineMemOperand.h:51

MachinePointerInfo(unsigned AddressSpace=0, int64_t offset=0)

Definition MachineMemOperand.h:65

int64_t Offset

Offset - This is an offset from the base Value*.

Definition MachineMemOperand.h:47

unsigned AddrSpace

Definition MachineMemOperand.h:49

MachinePointerInfo(PointerUnion< const Value *, const PseudoSourceValue * > v, int64_t offset=0, uint8_t ID=0)

Definition MachineMemOperand.h:69

PointerUnion< const Value *, const PseudoSourceValue * > V

This is the IR pointer value for the access, or it is null if unknown.

Definition MachineMemOperand.h:44

static LLVM_ABI MachinePointerInfo getConstantPool(MachineFunction &MF)

Return a MachinePointerInfo record that refers to the constant pool.

MachinePointerInfo getWithOffset(int64_t O) const

Definition MachineMemOperand.h:82

static LLVM_ABI MachinePointerInfo getUnknownStack(MachineFunction &MF)

Stack memory without other information.

static LLVM_ABI MachinePointerInfo getGOT(MachineFunction &MF)

Return a MachinePointerInfo record that refers to a GOT entry.

MachinePointerInfo(const Value *v, int64_t offset=0, uint8_t ID=0)

Definition MachineMemOperand.h:53

static LLVM_ABI MachinePointerInfo getFixedStack(MachineFunction &MF, int FI, int64_t Offset=0)

Return a MachinePointerInfo record that refers to the specified FrameIndex.