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 auto It = FunctionsInverse.find(Query.Start);
37 if (It.stop() <= Query.End)
38 return *It;
39 return nullptr;
40}
41
43 return FunctionsInverse.lookup(Query, nullptr);
44}
45
48 auto It = BlocksInverse.find(Query.Start);
49 if (It.stop() <= Query.End)
50 return *It;
51 return nullptr;
52}
53
55 return BlocksInverse.lookup(Query, nullptr);
56}
57
60 auto It = InstructionsInverse.find(Query.Start);
61 if (It.stop() <= Query.End)
62 return *It;
63 return nullptr;
64}
65
68 return InstructionsInverse.lookup(Query, nullptr);
69}
70
72 const FileLocRange &Loc) {
73 bool Inserted = Functions.insert({F, Loc}).second;
74 if (Inserted)
75 FunctionsInverse.insert(Loc.Start, Loc.End, F);
76 return Inserted;
77}
78
80 const FileLocRange &Loc) {
81 bool Inserted = Blocks.insert({BB, Loc}).second;
82 if (Inserted)
83 BlocksInverse.insert(Loc.Start, Loc.End, BB);
84 return Inserted;
85}
86
88 const FileLocRange &Loc) {
89 bool Inserted = Instructions.insert({I, Loc}).second;
90 if (Inserted)
91 InstructionsInverse.insert(Loc.Start, Loc.End, I);
92 return Inserted;
93}
94
95} // namespace llvm
#define F(x, y, z)
Definition MD5.cpp:54
#define I(x, y, z)
Definition MD5.cpp:57
BasicBlock * getBlockAtLocation(const FileLocRange &) const
Get the block at the requested location range.
bool addInstructionLocation(Instruction *, const FileLocRange &)
bool addBlockLocation(BasicBlock *, const FileLocRange &)
LLVM_ABI std::optional< FileLocRange > getFunctionLocation(const Function *) const
Function * getFunctionAtLocation(const FileLocRange &) const
Get the function at the requested location range.
LLVM_ABI std::optional< FileLocRange > getInstructionLocation(const Instruction *) const
Instruction * getInstructionAtLocation(const FileLocRange &) const
Get the instruction at the requested location range.
LLVM_ABI 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:42
Struct holding Line:Column location.
Definition FileLoc.h:18