Movatterモバイル変換


[0]ホーム

URL:


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

Generated on Fri Jul 18 2025 11:50:52 for LLVM by doxygen 1.9.6
[8]ページ先頭

©2009-2025 Movatter.jp