1 //===--- ModRef.cpp - Memory effect modeling --------------------*- C++ -*-===//
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
7 //===----------------------------------------------------------------------===//
9 // This file implements ModRef and MemoryEffects misc functions.
11 //===----------------------------------------------------------------------===//
13 #include "llvm/Support/ModRef.h"
14 #include "llvm/ADT/STLExtras.h"
15 #include "llvm/ADT/StringExtras.h"
19 raw_ostream
&llvm::operator<<(raw_ostream
&OS
, ModRefInfo MR
) {
21 case ModRefInfo::NoModRef
:
30 case ModRefInfo::ModRef
:
37 raw_ostream
&llvm::operator<<(raw_ostream
&OS
, MemoryEffects ME
) {
38 interleaveComma(MemoryEffects::locations(), OS
, [&](IRMemLocation Loc
) {
40 case IRMemLocation::ArgMem
:
43 case IRMemLocation::InaccessibleMem
:
44 OS
<< "InaccessibleMem: ";
46 case IRMemLocation::Other
:
50 OS
<< ME
.getModRef(Loc
);
55 raw_ostream
&llvm::operator<<(raw_ostream
&OS
, CaptureComponents CC
) {
56 if (capturesNothing(CC
)) {
62 if (capturesAddressIsNullOnly(CC
))
63 OS
<< LS
<< "address_is_null";
64 else if (capturesAddress(CC
))
65 OS
<< LS
<< "address";
66 if (capturesReadProvenanceOnly(CC
))
67 OS
<< LS
<< "read_provenance";
68 if (capturesFullProvenance(CC
))
69 OS
<< LS
<< "provenance";
74 raw_ostream
&llvm::operator<<(raw_ostream
&OS
, CaptureInfo CI
) {
76 CaptureComponents Other
= CI
.getOtherComponents();
77 CaptureComponents Ret
= CI
.getRetComponents();
80 if (!capturesNothing(Other
) || Other
== Ret
)
83 OS
<< LS
<< "ret: " << Ret
;