LLVM 20.0.0git
ModRef.cpp
Go to the documentation of this file.
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"
16
17using namespace llvm;
18
20 switch (MR) {
21 case ModRefInfo::NoModRef:
22 OS << "NoModRef";
23 break;
24 case ModRefInfo::Ref:
25 OS << "Ref";
26 break;
27 case ModRefInfo::Mod:
28 OS << "Mod";
29 break;
30 case ModRefInfo::ModRef:
31 OS << "ModRef";
32 break;
33 }
34 return OS;
35}
36
39 switch (Loc) {
40 case IRMemLocation::ArgMem:
41 OS << "ArgMem: ";
42 break;
43 case IRMemLocation::InaccessibleMem:
44 OS << "InaccessibleMem: ";
45 break;
46 case IRMemLocation::Other:
47 OS << "Other: ";
48 break;
49 }
50 OS << ME.getModRef(Loc);
51 });
52 return OS;
53}
54
56 if (capturesNothing(CC)) {
57 OS << "none";
58 return OS;
59 }
60
61 ListSeparator LS;
63 OS << LS << "address_is_null";
64 else if (capturesAddress(CC))
65 OS << LS << "address";
67 OS << LS << "read_provenance";
69 OS << LS << "provenance";
70
71 return OS;
72}
73
75 ListSeparator LS;
78
79 OS << "captures(";
80 if (!capturesNothing(Other) || Other == Ret)
81 OS << LS << Other;
82 if (Other != Ret)
83 OS << LS << "ret: " << Ret;
84 OS << ")";
85 return OS;
86}
std::optional< std::vector< StOtherPiece > > Other
Definition: ELFYAML.cpp:1315
This file contains some templates that are useful if you are working with the STL at all.
raw_pwrite_stream & OS
This file contains some functions that are useful when dealing with strings.
Represents which components of the pointer may be captured in which location.
Definition: ModRef.h:318
CaptureComponents getOtherComponents() const
Get components potentially captured through locations other than the return value.
Definition: ModRef.h:338
CaptureComponents getRetComponents() const
Get components potentially captured by the return value.
Definition: ModRef.h:334
ModRefInfo getModRef(Location Loc) const
Get ModRefInfo for the given Location.
Definition: ModRef.h:165
static auto locations()
Returns iterator over all supported location kinds.
Definition: ModRef.h:95
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition: raw_ostream.h:52
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
bool capturesReadProvenanceOnly(CaptureComponents CC)
Definition: ModRef.h:303
bool capturesAddressIsNullOnly(CaptureComponents CC)
Definition: ModRef.h:295
bool capturesAddress(CaptureComponents CC)
Definition: ModRef.h:299
void interleaveComma(const Container &c, StreamT &os, UnaryFunctor each_fn)
Definition: STLExtras.h:2207
bool capturesFullProvenance(CaptureComponents CC)
Definition: ModRef.h:308
CaptureComponents
Components of the pointer that may be captured.
Definition: ModRef.h:277
ModRefInfo
Flags indicating whether a memory access modifies or references memory.
Definition: ModRef.h:27
IRMemLocation
The locations at which a function might access memory.
Definition: ModRef.h:59
raw_ostream & operator<<(raw_ostream &OS, const APFixedPoint &FX)
Definition: APFixedPoint.h:303
bool capturesNothing(CaptureComponents CC)
Definition: ModRef.h:287