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"

29

30namespace llvm {

31

32class MDNode;

33class raw_ostream;

34class MachineFunction;

35class ModuleSlotTracker;

36class TargetInstrInfo;

37

38

39

40

42

44

45

47

49

51

55 AddrSpace = v ? v->getType()->getPointerAddressSpace() : 0;

56 }

57

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

62 }

63

67

70 int64_t offset = 0,

73 if (V) {

74 if (const auto *ValPtr = dyn_cast_if_present<const Value *>(V))

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

76 else

77 AddrSpace = cast<const PseudoSourceValue *>(V)->getAddressSpace();

78 }

79 }

80

84 if (isa<const Value *>(V))

88 }

89

90

91

94

95

97

98

100

101

102

105

106

108

109

111

112

115

116

118};

119

120

121

122

123

124

125

126

127

128

130public:

131

133

135

137

139

141

143

145

147

148

149

150

151

156

158 };

159

160private:

161

162 struct MachineAtomicInfo {

163

164 unsigned SSID : 8;

165

166

167 unsigned Ordering : 4;

168

169

170 unsigned FailureOrdering : 4;

171 };

172

173 MachinePointerInfo PtrInfo;

174

175

176

177 LLT MemoryType;

178

180 Align BaseAlign;

181 MachineAtomicInfo AtomicInfo;

182 AAMDNodes AAInfo;

183 const MDNode *Ranges;

184

185public:

186

187

188

189

190

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

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

193 const MDNode *Ranges = nullptr,

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

198 const AAMDNodes &AAInfo = AAMDNodes(),

199 const MDNode *Ranges = nullptr,

203

205

206

207

208

209

210

211

212

214 return dyn_cast_if_present<const Value *>(PtrInfo.V);

215 }

216

218 return dyn_cast_if_present<const PseudoSourceValue *>(PtrInfo.V);

219 }

220

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

222

223

225

226

228

229

230

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

232

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

234

235

236

238

239

241 return MemoryType.isValid()

244 }

245

246

248 return MemoryType.isValid()

251 }

252

254 return MemoryType;

255 }

256

257

258

260

261

262

264

265

267

268

270

271

274 }

275

276

277

278

281 }

282

283

284

287 }

288

289

290

291

294 }

295

302

303

304

307 }

308

309

310

311

316 }

317

318

319

320

322

323

324

325

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

329

330

332 MemoryType = NewTy;

333 }

334

335

337

338

339

343

344

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

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

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

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

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

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

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

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

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

356 }

357

360 return !(LHS == RHS);

361 }

362};

363

364}

365

366#endif

MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL

Atomic ordering constants.

const HexagonInstrInfo * TII

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.

void setType(LLT NewTy)

Reset the tracked memory type.

LocationSize getSize() const

Return the size in bytes of the memory reference.

AtomicOrdering getFailureOrdering() const

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

const PseudoSourceValue * getPseudoValue() const

LLT getMemoryType() const

Return the memory type of the memory reference.

unsigned getAddrSpace() const

void clearRanges()

Unset the tracked range metadata.

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

bool isUnordered() const

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

const MDNode * getRanges() const

Return the range tag for the memory reference.

void setValue(const Value *NewSV)

Change the SourceValue for this MachineMemOperand.

bool isAtomic() const

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

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.

const void * getOpaqueValue() const

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

AtomicOrdering getMergedOrdering() const

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

void setOffset(int64_t NewOffset)

Flags

Flags values. These may be or'd together.

@ MOVolatile

The memory access is volatile.

@ MODereferenceable

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

@ MOLoad

The memory access reads data.

@ MONonTemporal

The memory access is non-temporal.

@ MOInvariant

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

@ MOStore

The memory access writes data.

AtomicOrdering getSuccessOrdering() const

Return the atomic ordering requirements for this memory operation.

void setFlags(Flags f)

Bitwise OR the current flags with the given flags.

const MachinePointerInfo & getPointerInfo() const

Flags getFlags() const

Return the raw flags of the source value,.

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.

bool isDereferenceable() const

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

AAMDNodes getAAInfo() const

Return the AA tags for the memory reference.

void setValue(const PseudoSourceValue *NewSV)

const Value * getValue() const

Return the base address of the memory access.

Align getBaseAlign() const

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

int64_t getOffset() const

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

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

bool isNull() const

Test if the pointer held in the union is null, regardless of which type it is.

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.

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

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

AtomicOrdering

Atomic ordering for LLVM's memory model.

@ LLVM_MARK_AS_BITMASK_ENUM

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

static MachinePointerInfo getJumpTable(MachineFunction &MF)

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

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)

unsigned getAddrSpace() const

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

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

Stack pointer relative access.

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

int64_t Offset

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

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

PointerUnion< const Value *, const PseudoSourceValue * > V

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

static MachinePointerInfo getConstantPool(MachineFunction &MF)

Return a MachinePointerInfo record that refers to the constant pool.

MachinePointerInfo getWithOffset(int64_t O) const

static MachinePointerInfo getUnknownStack(MachineFunction &MF)

Stack memory without other information.

static 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)

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

Return a MachinePointerInfo record that refers to the specified FrameIndex.