LLVM 22.0.0git
AsmParserContext.cpp
Go to the documentation of this file.
1//===----------------------------------------------------------------------===//
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
10
11namespace llvm {
12
13std::optional<FileLocRange>
15 if (auto FIt = Functions.find(F); FIt != Functions.end())
16 return FIt->second;
17 return std::nullopt;
18}
19
20std::optional<FileLocRange>
22 if (auto BBIt = Blocks.find(BB); BBIt != Blocks.end())
23 return BBIt->second;
24 return std::nullopt;
25}
26
27std::optional<FileLocRange>
29 if (auto IIt = Instructions.find(I); IIt != Instructions.end())
30 return IIt->second;
31 return std::nullopt;
32}
33
36 for (auto &[F, Loc] : Functions) {
37 if (Loc.contains(Query))
38 return F;
39 }
40 return nullptr;
41}
42
46
49 for (auto &[BB, Loc] : Blocks) {
50 if (Loc.contains(Query))
51 return BB;
52 }
53 return nullptr;
54}
55
57 return getBlockAtLocation(FileLocRange(Query, Query));
58}
59
62 for (auto &[I, Loc] : Instructions) {
63 if (Loc.contains(Query))
64 return I;
65 }
66 return nullptr;
67}
68
73
75 const FileLocRange &Loc) {
76 return Functions.insert({F, Loc}).second;
77}
78
80 const FileLocRange &Loc) {
81 return Blocks.insert({BB, Loc}).second;
82}
83
85 const FileLocRange &Loc) {
86 return Instructions.insert({I, Loc}).second;
87}
88
89} // namespace llvm
#define F(x, y, z)
Definition MD5.cpp:55
#define I(x, y, z)
Definition MD5.cpp:58
BasicBlock * getBlockAtLocation(const FileLocRange &) const
Get the block at the requested location range.
bool addInstructionLocation(Instruction *, const FileLocRange &)
bool addBlockLocation(BasicBlock *, const FileLocRange &)
std::optional< FileLocRange > getFunctionLocation(const Function *) const
Function * getFunctionAtLocation(const FileLocRange &) const
Get the function at the requested location range.
std::optional< FileLocRange > getInstructionLocation(const Instruction *) const
Instruction * getInstructionAtLocation(const FileLocRange &) const
Get the instruction at the requested location range.
std::optional< FileLocRange > getBlockLocation(const BasicBlock *) const
bool addFunctionLocation(Function *, const FileLocRange &)
LLVM Basic Block Representation.
Definition BasicBlock.h:62
This is an optimization pass for GlobalISel generic memory operations.
Struct holding a semiopen range [Start; End)
Definition FileLoc.h:37
Struct holding Line:Column location.
Definition FileLoc.h:18