xref: /llvm-project/llvm/lib/Support/ModRef.cpp (revision 0cff3e85db00b5f425cc4ed0d6921445afa891ca)
1 //===--- ModRef.cpp - Memory effect modeling --------------------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 //  This file implements ModRef and MemoryEffects misc functions.
10 //
11 //===----------------------------------------------------------------------===//
12 
13 #include "llvm/Support/ModRef.h"
14 
15 using namespace llvm;
16 
17 raw_ostream &llvm::operator<<(raw_ostream &OS, ModRefInfo MR) {
18   switch (MR) {
19   case ModRefInfo::NoModRef:
20     OS << "NoModRef";
21     break;
22   case ModRefInfo::Ref:
23     OS << "Ref";
24     break;
25   case ModRefInfo::Mod:
26     OS << "Mod";
27     break;
28   case ModRefInfo::ModRef:
29     OS << "ModRef";
30     break;
31   }
32   return OS;
33 }
34 
35 raw_ostream &llvm::operator<<(raw_ostream &OS, MemoryEffects ME) {
36   for (IRMemLocation Loc : MemoryEffects::locations()) {
37     switch (Loc) {
38     case IRMemLocation::ArgMem:
39       OS << "ArgMem: ";
40       break;
41     case IRMemLocation::InaccessibleMem:
42       OS << "InaccessibleMem: ";
43       break;
44     case IRMemLocation::Other:
45       OS << "Other: ";
46       break;
47     }
48     OS << ME.getModRef(Loc) << ", ";
49   }
50   return OS;
51 }
52