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 #include "llvm/ADT/STLExtras.h" 15 16 using namespace llvm; 17 18 raw_ostream &llvm::operator<<(raw_ostream &OS, ModRefInfo MR) { 19 switch (MR) { 20 case ModRefInfo::NoModRef: 21 OS << "NoModRef"; 22 break; 23 case ModRefInfo::Ref: 24 OS << "Ref"; 25 break; 26 case ModRefInfo::Mod: 27 OS << "Mod"; 28 break; 29 case ModRefInfo::ModRef: 30 OS << "ModRef"; 31 break; 32 } 33 return OS; 34 } 35 36 raw_ostream &llvm::operator<<(raw_ostream &OS, MemoryEffects ME) { 37 interleaveComma(MemoryEffects::locations(), OS, [&](IRMemLocation Loc) { 38 switch (Loc) { 39 case IRMemLocation::ArgMem: 40 OS << "ArgMem: "; 41 break; 42 case IRMemLocation::InaccessibleMem: 43 OS << "InaccessibleMem: "; 44 break; 45 case IRMemLocation::Other: 46 OS << "Other: "; 47 break; 48 } 49 OS << ME.getModRef(Loc); 50 }); 51 return OS; 52 } 53