1c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot//==- llvm/CodeGen/MachineMemOperand.h - MachineMemOperand class -*- C++ -*-==// 2c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot// 3c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot// The LLVM Compiler Infrastructure 4c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot// 5c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot// This file is distributed under the University of Illinois Open Source 6c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot// License. See LICENSE.TXT for details. 7c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot// 8c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot//===----------------------------------------------------------------------===// 9c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot// 10c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot// This file contains the declaration of the MachineMemOperand class, which is a 11c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot// description of a memory reference. It is used to help track dependencies 12c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot// in the backend. 13c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot// 14c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot//===----------------------------------------------------------------------===// 15c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot 16c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot#ifndef LLVM_CODEGEN_MACHINEMEMOPERAND_H 17c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot#define LLVM_CODEGEN_MACHINEMEMOPERAND_H 18c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot 19c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot#include "llvm/ADT/BitmaskEnum.h" 20c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot#include "llvm/ADT/PointerUnion.h" 21c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot#include "llvm/CodeGen/PseudoSourceValue.h" 22c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot#include "llvm/IR/Instructions.h" 23c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot#include "llvm/IR/Metadata.h" 24c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot#include "llvm/IR/Value.h" // PointerLikeTypeTraits<Value*> 25c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot#include "llvm/Support/AtomicOrdering.h" 26c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot#include "llvm/Support/DataTypes.h" 27c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot 28c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robotnamespace llvm { 29c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot 30c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robotclass FoldingSetNodeID; 31c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robotclass MDNode; 32c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robotclass raw_ostream; 33c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robotclass MachineFunction; 34c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robotclass ModuleSlotTracker; 35c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot 36c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot/// This class contains a discriminated union of information about pointers in 37c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot/// memory operands, relating them back to LLVM IR or to virtual locations (such 38c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot/// as frame indices) that are exposed during codegen. 39c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robotstruct MachinePointerInfo { 40c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot /// This is the IR pointer value for the access, or it is null if unknown. 41c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot /// If this is null, then the access is to a pointer in the default address 42c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot /// space. 43c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot PointerUnion<const Value *, const PseudoSourceValue *> V; 44c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot 45c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot /// Offset - This is an offset from the base Value*. 46c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot int64_t Offset; 47c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot 48c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot explicit MachinePointerInfo(const Value *v = nullptr, int64_t offset = 0) 49c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot : V(v), Offset(offset) {} 50c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot 51c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot explicit MachinePointerInfo(const PseudoSourceValue *v, 52c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot int64_t offset = 0) 53c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot : V(v), Offset(offset) {} 54c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot 55c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot MachinePointerInfo getWithOffset(int64_t O) const { 56c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot if (V.isNull()) return MachinePointerInfo(); 57c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot if (V.is<const Value*>()) 58c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot return MachinePointerInfo(V.get<const Value*>(), Offset+O); 59c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot return MachinePointerInfo(V.get<const PseudoSourceValue*>(), Offset+O); 60c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot } 61c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot 62c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot /// Return the LLVM IR address space number that this pointer points into. 63c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot unsigned getAddrSpace() const; 64c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot 65c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot /// Return a MachinePointerInfo record that refers to the constant pool. 66c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot static MachinePointerInfo getConstantPool(MachineFunction &MF); 67c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot 68c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot /// Return a MachinePointerInfo record that refers to the specified 69c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot /// FrameIndex. 70c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot static MachinePointerInfo getFixedStack(MachineFunction &MF, int FI, 71c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot int64_t Offset = 0); 72c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot 73c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot /// Return a MachinePointerInfo record that refers to a jump table entry. 74c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot static MachinePointerInfo getJumpTable(MachineFunction &MF); 75c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot 76c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot /// Return a MachinePointerInfo record that refers to a GOT entry. 77c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot static MachinePointerInfo getGOT(MachineFunction &MF); 78c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot 79c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot /// Stack pointer relative access. 80c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot static MachinePointerInfo getStack(MachineFunction &MF, int64_t Offset); 81c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot}; 82c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot 83c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot 84c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot//===----------------------------------------------------------------------===// 85c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot/// A description of a memory reference used in the backend. 86c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot/// Instead of holding a StoreInst or LoadInst, this class holds the address 87c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot/// Value of the reference along with a byte size and offset. This allows it 88c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot/// to describe lowered loads and stores. Also, the special PseudoSourceValue 89c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot/// objects can be used to represent loads and stores to memory locations 90c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot/// that aren't explicit in the regular LLVM IR. 91c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot/// 92c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robotclass MachineMemOperand { 93c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robotpublic: 94c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot /// Flags values. These may be or'd together. 95c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot enum Flags : uint16_t { 96c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot // No flags set. 97c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot MONone = 0, 98c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot /// The memory access reads data. 99c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot MOLoad = 1u << 0, 100c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot /// The memory access writes data. 101c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot MOStore = 1u << 1, 102c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot /// The memory access is volatile. 103c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot MOVolatile = 1u << 2, 104c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot /// The memory access is non-temporal. 105c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot MONonTemporal = 1u << 3, 106c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot /// The memory access is dereferenceable (i.e., doesn't trap). 107c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot MODereferenceable = 1u << 4, 108c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot /// The memory access always returns the same value (or traps). 109c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot MOInvariant = 1u << 5, 110c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot 111c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot // Reserved for use by target-specific passes. 112c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot MOTargetFlag1 = 1u << 6, 113c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot MOTargetFlag2 = 1u << 7, 114c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot MOTargetFlag3 = 1u << 8, 115c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot 116c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot LLVM_MARK_AS_BITMASK_ENUM(/* LargestFlag = */ MOTargetFlag3) 117c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot }; 118c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot 119c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robotprivate: 120c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot /// Atomic information for this memory operation. 121c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot struct MachineAtomicInfo { 122c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot /// Synchronization scope for this memory operation. 123c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot unsigned SynchScope : 1; // enum SynchronizationScope 124c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot /// Atomic ordering requirements for this memory operation. For cmpxchg 125c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot /// atomic operations, atomic ordering requirements when store occurs. 126c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot unsigned Ordering : 4; // enum AtomicOrdering 127c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot /// For cmpxchg atomic operations, atomic ordering requirements when store 128c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot /// does not occur. 129c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot unsigned FailureOrdering : 4; // enum AtomicOrdering 130c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot }; 131c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot 132c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot MachinePointerInfo PtrInfo; 133c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot uint64_t Size; 134c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot Flags FlagVals; 135c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot uint16_t BaseAlignLog2; // log_2(base_alignment) + 1 136c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot MachineAtomicInfo AtomicInfo; 137c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot AAMDNodes AAInfo; 138c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot const MDNode *Ranges; 139c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot 140c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robotpublic: 141c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot /// Construct a MachineMemOperand object with the specified PtrInfo, flags, 142c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot /// size, and base alignment. For atomic operations the synchronization scope 143c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot /// and atomic ordering requirements must also be specified. For cmpxchg 144c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot /// atomic operations the atomic ordering requirements when store does not 145c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot /// occur must also be specified. 146c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot MachineMemOperand(MachinePointerInfo PtrInfo, Flags flags, uint64_t s, 147c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot unsigned base_alignment, 148c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot const AAMDNodes &AAInfo = AAMDNodes(), 149c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot const MDNode *Ranges = nullptr, 150c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot SynchronizationScope SynchScope = CrossThread, 151c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot AtomicOrdering Ordering = AtomicOrdering::NotAtomic, 152c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot AtomicOrdering FailureOrdering = AtomicOrdering::NotAtomic); 153c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot 154c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot const MachinePointerInfo &getPointerInfo() const { return PtrInfo; } 155c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot 156c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot /// Return the base address of the memory access. This may either be a normal 157c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot /// LLVM IR Value, or one of the special values used in CodeGen. 158c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot /// Special values are those obtained via 159c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot /// PseudoSourceValue::getFixedStack(int), PseudoSourceValue::getStack, and 160c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot /// other PseudoSourceValue member functions which return objects which stand 161c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot /// for frame/stack pointer relative references and other special references 162c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot /// which are not representable in the high-level IR. 163c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot const Value *getValue() const { return PtrInfo.V.dyn_cast<const Value*>(); } 164c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot 165c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot const PseudoSourceValue *getPseudoValue() const { 166c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot return PtrInfo.V.dyn_cast<const PseudoSourceValue*>(); 167c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot } 168c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot 169c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot const void *getOpaqueValue() const { return PtrInfo.V.getOpaqueValue(); } 170c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot 171c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot /// Return the raw flags of the source value, \see Flags. 172c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot Flags getFlags() const { return FlagVals; } 173c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot 174c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot /// Bitwise OR the current flags with the given flags. 175c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot void setFlags(Flags f) { FlagVals |= f; } 176c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot 177c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot /// For normal values, this is a byte offset added to the base address. 178c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot /// For PseudoSourceValue::FPRel values, this is the FrameIndex number. 179c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot int64_t getOffset() const { return PtrInfo.Offset; } 180c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot 181c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot unsigned getAddrSpace() const { return PtrInfo.getAddrSpace(); } 182c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot 183c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot /// Return the size in bytes of the memory reference. 184c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot uint64_t getSize() const { return Size; } 185c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot 186c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot /// Return the minimum known alignment in bytes of the actual memory 187c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot /// reference. 188c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot uint64_t getAlignment() const; 189c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot 190c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot /// Return the minimum known alignment in bytes of the base address, without 191c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot /// the offset. 192c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot uint64_t getBaseAlignment() const { return (1u << BaseAlignLog2) >> 1; } 193c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot 194c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot /// Return the AA tags for the memory reference. 195c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot AAMDNodes getAAInfo() const { return AAInfo; } 196c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot 197c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot /// Return the range tag for the memory reference. 198c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot const MDNode *getRanges() const { return Ranges; } 199c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot 200c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot /// Return the synchronization scope for this memory operation. 201c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot SynchronizationScope getSynchScope() const { 202c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot return static_cast<SynchronizationScope>(AtomicInfo.SynchScope); 203c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot } 204c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot 205c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot /// Return the atomic ordering requirements for this memory operation. For 206c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot /// cmpxchg atomic operations, return the atomic ordering requirements when 207c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot /// store occurs. 208c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot AtomicOrdering getOrdering() const { 209c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot return static_cast<AtomicOrdering>(AtomicInfo.Ordering); 210c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot } 211c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot 212c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot /// For cmpxchg atomic operations, return the atomic ordering requirements 213c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot /// when store does not occur. 214c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot AtomicOrdering getFailureOrdering() const { 215c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot return static_cast<AtomicOrdering>(AtomicInfo.FailureOrdering); 216c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot } 217c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot 218c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot bool isLoad() const { return FlagVals & MOLoad; } 219c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot bool isStore() const { return FlagVals & MOStore; } 220c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot bool isVolatile() const { return FlagVals & MOVolatile; } 221c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot bool isNonTemporal() const { return FlagVals & MONonTemporal; } 222c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot bool isDereferenceable() const { return FlagVals & MODereferenceable; } 223c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot bool isInvariant() const { return FlagVals & MOInvariant; } 224c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot 225c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot /// Returns true if this operation has an atomic ordering requirement of 226c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot /// unordered or higher, false otherwise. 227c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot bool isAtomic() const { return getOrdering() != AtomicOrdering::NotAtomic; } 228c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot 229c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot /// Returns true if this memory operation doesn't have any ordering 230c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot /// constraints other than normal aliasing. Volatile and atomic memory 231c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot /// operations can't be reordered. 232c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot /// 233c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot /// Currently, we don't model the difference between volatile and atomic 234c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot /// operations. They should retain their ordering relative to all memory 235c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot /// operations. 236c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot bool isUnordered() const { return !isVolatile(); } 237c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot 238c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot /// Update this MachineMemOperand to reflect the alignment of MMO, if it has a 239c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot /// greater alignment. This must only be used when the new alignment applies 240c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot /// to all users of this MachineMemOperand. 241c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot void refineAlignment(const MachineMemOperand *MMO); 242c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot 243c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot /// Change the SourceValue for this MachineMemOperand. This should only be 244c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot /// used when an object is being relocated and all references to it are being 245c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot /// updated. 246c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot void setValue(const Value *NewSV) { PtrInfo.V = NewSV; } 247c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot void setValue(const PseudoSourceValue *NewSV) { PtrInfo.V = NewSV; } 248c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot void setOffset(int64_t NewOffset) { PtrInfo.Offset = NewOffset; } 249c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot 250c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot /// Profile - Gather unique data for the object. 251c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot /// 252c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot void Profile(FoldingSetNodeID &ID) const; 253c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot 254c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot /// Support for operator<<. 255c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot /// @{ 256c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot void print(raw_ostream &OS) const; 257c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot void print(raw_ostream &OS, ModuleSlotTracker &MST) const; 258c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot /// @} 259c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot 260c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot friend bool operator==(const MachineMemOperand &LHS, 261c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot const MachineMemOperand &RHS) { 262c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot return LHS.getValue() == RHS.getValue() && 263c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot LHS.getPseudoValue() == RHS.getPseudoValue() && 264c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot LHS.getSize() == RHS.getSize() && 265c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot LHS.getOffset() == RHS.getOffset() && 266c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot LHS.getFlags() == RHS.getFlags() && 267c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot LHS.getAAInfo() == RHS.getAAInfo() && 268c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot LHS.getRanges() == RHS.getRanges() && 269c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot LHS.getAlignment() == RHS.getAlignment() && 270c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot LHS.getAddrSpace() == RHS.getAddrSpace(); 271c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot } 272c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot 273c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot friend bool operator!=(const MachineMemOperand &LHS, 274c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot const MachineMemOperand &RHS) { 275c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot return !(LHS == RHS); 276c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot } 277c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot}; 278c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot 279c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robotinline raw_ostream &operator<<(raw_ostream &OS, const MachineMemOperand &MRO) { 280c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot MRO.print(OS); 281c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot return OS; 282c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot} 283c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot 284c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot} // End llvm namespace 285c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot 286c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot#endif 287