LLVM 22.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) {
22 OS << "NoModRef";
23 break;
24 case ModRefInfo::Ref:
25 OS << "Ref";
26 break;
27 case ModRefInfo::Mod:
28 OS << "Mod";
29 break;
31 OS << "ModRef";
32 break;
33 }
34 return OS;
35}
36
39 switch (Loc) {
41 OS << "ArgMem: ";
42 break;
44 OS << "InaccessibleMem: ";
45 break;
47 OS << "ErrnoMem: ";
48 break;
50 OS << "Other: ";
51 break;
52 }
53 OS << ME.getModRef(Loc);
54 });
55 return OS;
56}
57
59 if (capturesNothing(CC)) {
60 OS << "none";
61 return OS;
62 }
63
66 OS << LS << "address_is_null";
67 else if (capturesAddress(CC))
68 OS << LS << "address";
70 OS << LS << "read_provenance";
72 OS << LS << "provenance";
73
74 return OS;
75}
76
81
82 OS << "captures(";
83 if (!capturesNothing(Other) || Other == Ret)
84 OS << LS << Other;
85 if (Other != Ret)
86 OS << LS << "ret: " << Ret;
87 OS << ")";
88 return OS;
89}
This file contains some templates that are useful if you are working with the STL at all.
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:354
CaptureComponents getOtherComponents() const
Get components potentially captured through locations other than the return value.
Definition ModRef.h:386
CaptureComponents getRetComponents() const
Get components potentially captured by the return value.
Definition ModRef.h:382
A helper class to return the specified delimiter string after the first invocation of operator String...
ModRefInfo getModRef(Location Loc) const
Get ModRefInfo for the given Location.
Definition ModRef.h:188
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition raw_ostream.h:53
This is an optimization pass for GlobalISel generic memory operations.
bool capturesReadProvenanceOnly(CaptureComponents CC)
Definition ModRef.h:331
bool capturesAddressIsNullOnly(CaptureComponents CC)
Definition ModRef.h:323
bool capturesAddress(CaptureComponents CC)
Definition ModRef.h:327
void interleaveComma(const Container &c, StreamT &os, UnaryFunctor each_fn)
Definition STLExtras.h:2233
MemoryEffectsBase< IRMemLocation > MemoryEffects
Summary of how a function affects memory in the program.
Definition ModRef.h:296
bool capturesFullProvenance(CaptureComponents CC)
Definition ModRef.h:336
CaptureComponents
Components of the pointer that may be captured.
Definition ModRef.h:305
ModRefInfo
Flags indicating whether a memory access modifies or references memory.
Definition ModRef.h:28
@ Ref
The access may reference the value stored in memory.
Definition ModRef.h:32
@ ModRef
The access may reference and may modify the value stored in memory.
Definition ModRef.h:36
@ Mod
The access may modify the value stored in memory.
Definition ModRef.h:34
@ NoModRef
The access neither references nor modifies the value stored in memory.
Definition ModRef.h:30
IRMemLocation
The locations at which a function might access memory.
Definition ModRef.h:60
@ ErrnoMem
Errno memory.
Definition ModRef.h:66
@ ArgMem
Access to memory via argument pointers.
Definition ModRef.h:62
@ Other
Any other memory.
Definition ModRef.h:68
@ InaccessibleMem
Memory that is inaccessible via LLVM IR.
Definition ModRef.h:64
raw_ostream & operator<<(raw_ostream &OS, const APFixedPoint &FX)
bool capturesNothing(CaptureComponents CC)
Definition ModRef.h:315