llvm/llvm/include/llvm/Support/ModRef.h

//===--- ModRef.h - Memory effect modeling ----------------------*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
// Definitions of ModRefInfo and MemoryEffects, which are used to
// describe the memory effects of instructions.
//
//===----------------------------------------------------------------------===//

#ifndef LLVM_SUPPORT_MODREF_H
#define LLVM_SUPPORT_MODREF_H

#include "llvm/ADT/BitmaskEnum.h"
#include "llvm/ADT/Sequence.h"
#include "llvm/Support/raw_ostream.h"

namespace llvm {

/// Flags indicating whether a memory access modifies or references memory.
///
/// This is no access at all, a modification, a reference, or both
/// a modification and a reference.
enum class ModRefInfo : uint8_t {};

[[nodiscard]] inline bool isNoModRef(const ModRefInfo MRI) {}
[[nodiscard]] inline bool isModOrRefSet(const ModRefInfo MRI) {}
[[nodiscard]] inline bool isModAndRefSet(const ModRefInfo MRI) {}
[[nodiscard]] inline bool isModSet(const ModRefInfo MRI) {}
[[nodiscard]] inline bool isRefSet(const ModRefInfo MRI) {}

/// Debug print ModRefInfo.
raw_ostream &operator<<(raw_ostream &OS, ModRefInfo MR);

/// The locations at which a function might access memory.
enum class IRMemLocation {};

template <typename LocationEnum> class MemoryEffectsBase {};

/// Summary of how a function affects memory in the program.
///
/// Loads from constant globals are not considered memory accesses for this
/// interface. Also, functions may freely modify stack space local to their
/// invocation without having to report it through these interfaces.
MemoryEffects;

/// Debug print MemoryEffects.
raw_ostream &operator<<(raw_ostream &OS, MemoryEffects RMRB);

// Legacy alias.
FunctionModRefBehavior;

} // namespace llvm

#endif