LLVM: lib/IR/MemoryModelRelaxationAnnotations.cpp Source File (original) (raw)
1
2
3
4
5
6
7
8
14
15using namespace llvm;
16
17
18
21
23 if (!MD)
24 return;
25
26
27
28
30 assert(Tuple && "Invalid MMRA structure");
31
32 const auto HandleTagMD = [this](MDNode *TagMD) {
33 Tags.insert({cast(TagMD->getOperand(0))->getString(),
35 };
36
38 HandleTagMD(Tuple);
39 return;
40 }
41
42 for (const MDOperand &Op : Tuple->operands()) {
45 HandleTagMD(MDOp);
46 }
47}
48
51 return Tuple->getNumOperands() == 2 &&
54 }
55 return false;
56}
57
63
66 if (Tags.empty())
67 return nullptr;
68
69 if (Tags.size() == 1)
70 return getTagMD(Ctx, Tags.front());
71
73 for (const auto &Tag : Tags)
76}
77
80
81
82
83
84
85
86
88
89 for (const auto &[P, S] : A) {
91 Result.push_back(getTagMD(Ctx, P, S));
92 }
93 for (const auto &[P, S] : B) {
95 Result.push_back(getTagMD(Ctx, P, S));
96 }
97
99}
100
102 return Tags.count({Prefix, Suffix});
103}
104
106
107
108
109
110
112 for (const auto &[P, S] : Tags)
113 PrefixStatuses[P] |= (Other.hasTag(P, S) || .hasTagWithPrefix(P));
114 for (const auto &[P, S] : Other)
116
117 for (auto &[Prefix, Status] : PrefixStatuses) {
119 return false;
120 }
121
122 return true;
123}
124
126 for (const auto &[P, S] : Tags)
127 if (P == Prefix)
128 return true;
129 return false;
130}
131
133 return Tags.begin();
134}
135
137
139
141
143 bool IsFirst = true;
144
145 for (const auto &[P, S] : Tags) {
146 if (IsFirst)
147 IsFirst = false;
148 else
149 OS << ", ";
150 OS << P << ":" << S;
151 }
152}
153
156
157
158
161 return C->mayReadOrWriteMemory() ||
162 ->getMemoryEffects().doesNotAccessMemory();
163 return false;
164}
165
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
#define LLVM_DUMP_METHOD
Mark debug helper function definitions like dump() that should not be stripped from debug builds.
static bool isReadWriteMemCall(const Instruction &I)
Definition MemoryModelRelaxationAnnotations.cpp:159
This file provides utility for Memory Model Relaxation Annotations (MMRAs).
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
This is an important class for using LLVM in a threaded context.
Tracking metadata reference owned by Metadata.
static LLVM_ABI MDString * get(LLVMContext &Context, StringRef Str)
static MDTuple * get(LLVMContext &Context, ArrayRef< Metadata * > MDs)
void push_back(const T &Elt)
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
StringMap - This is an unconventional map that is specialized for handling keys that are "strings",...
StringRef - Represent a constant reference to a string, i.e.
This class implements an extremely fast bulk output stream that can only output to a stream.
@ C
The default llvm calling convention, compatible with C.
This is an optimization pass for GlobalISel generic memory operations.
LLVM_ABI bool canInstructionHaveMMRAs(const Instruction &I)
Definition MemoryModelRelaxationAnnotations.cpp:166
decltype(auto) dyn_cast(const From &Val)
dyn_cast - Return the argument parameter cast to the specified type.
LLVM_ABI raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
bool isa(const From &Val)
isa - Return true if the parameter to the template is an instance of one of the template type argu...
DWARFExpression::Operation Op
decltype(auto) cast(const From &Val)
cast - Return the argument parameter cast to the specified type.