LLVM 23.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>
30 if (auto IIt = InstructionsAndArguments.find(IA);
31 IIt != InstructionsAndArguments.end())
32 return IIt->second;
33 return std::nullopt;
34}
35
38 auto It = FunctionsInverse.find(Query.Start);
39 if (It.stop() <= Query.End)
40 return *It;
41 return nullptr;
42}
43
45 return FunctionsInverse.lookup(Query, nullptr);
46}
47
50 auto It = BlocksInverse.find(Query.Start);
51 if (It.stop() <= Query.End)
52 return *It;
53 return nullptr;
54}
55
57 return BlocksInverse.lookup(Query, nullptr);
58}
59
61 const FileLocRange &Query) const {
62 auto It = InstructionsAndArgumentsInverse.find(Query.Start);
63 if (It.stop() <= Query.End)
64 return *It;
65 return nullptr;
66}
67
69 const FileLoc &Query) const {
70 return InstructionsAndArgumentsInverse.lookup(Query, nullptr);
71}
72
74 const FileLocRange &Query) const {
75 auto It = ReferencedValues.find(Query.Start);
76 if (It.stop() <= Query.End)
77 return *It;
78 return nullptr;
79}
80
81Value *
83 return ReferencedValues.lookup(Query, nullptr);
84}
85
87 const FileLocRange &Loc) {
88 bool Inserted = Functions.insert({F, Loc}).second;
89 if (Inserted)
90 FunctionsInverse.insert(Loc.Start, Loc.End, F);
91 return Inserted;
92}
93
95 const FileLocRange &Loc) {
96 bool Inserted = Blocks.insert({BB, Loc}).second;
97 if (Inserted)
98 BlocksInverse.insert(Loc.Start, Loc.End, BB);
99 return Inserted;
100}
101
103 Value *IA, const FileLocRange &Loc) {
105 bool Inserted = InstructionsAndArguments.insert({IA, Loc}).second;
106 if (Inserted)
107 InstructionsAndArgumentsInverse.insert(Loc.Start, Loc.End, IA);
108 return Inserted;
109}
110
112 const FileLocRange &Loc) {
113 ReferencedValues.insert(Loc.Start, Loc.End, V);
114 return true;
115}
116
117} // namespace llvm
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
#define F(x, y, z)
Definition MD5.cpp:54
LLVM_ABI BasicBlock * getBlockAtLocation(const FileLocRange &) const
Get the block at the requested location range.
LLVM_ABI bool addValueReferenceAtLocation(Value *, const FileLocRange &)
LLVM_ABI bool addInstructionOrArgumentLocation(Value *, const FileLocRange &)
LLVM_ABI Value * getInstructionOrArgumentAtLocation(const FileLocRange &) const
Get the instruction or function argument at the requested location range.
LLVM_ABI bool addBlockLocation(BasicBlock *, const FileLocRange &)
LLVM_ABI std::optional< FileLocRange > getFunctionLocation(const Function *) const
LLVM_ABI Function * getFunctionAtLocation(const FileLocRange &) const
Get the function at the requested location range.
LLVM_ABI Value * getValueReferencedAtLocation(const FileLoc &) const
Get value referenced at the requested location.
LLVM_ABI std::optional< FileLocRange > getInstructionOrArgumentLocation(const Value *) const
LLVM_ABI std::optional< FileLocRange > getBlockLocation(const BasicBlock *) const
LLVM_ABI bool addFunctionLocation(Function *, const FileLocRange &)
LLVM Basic Block Representation.
Definition BasicBlock.h:62
LLVM Value Representation.
Definition Value.h:75
This is an optimization pass for GlobalISel generic memory operations.
Definition Types.h:26
bool isa(const From &Val)
isa<X> - Return true if the parameter to the template is an instance of one of the template type argu...
Definition Casting.h:547
Struct holding a semiopen range [Start; End)
Definition FileLoc.h:42
Struct holding Line:Column location.
Definition FileLoc.h:18