Files
derek.holloway 7502bf64a4
CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
Flatten subprojects into a single base monorepo
2026-09-02 16:34:47 -07:00

118 lines
3.5 KiB
C++

//===----------------------------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#include "llvm/AsmParser/AsmParserContext.h"
namespace llvm {
std::optional<FileLocRange>
AsmParserContext::getFunctionLocation(const Function *F) const {
if (auto FIt = Functions.find(F); FIt != Functions.end())
return FIt->second;
return std::nullopt;
}
std::optional<FileLocRange>
AsmParserContext::getBlockLocation(const BasicBlock *BB) const {
if (auto BBIt = Blocks.find(BB); BBIt != Blocks.end())
return BBIt->second;
return std::nullopt;
}
std::optional<FileLocRange>
AsmParserContext::getInstructionOrArgumentLocation(const Value *IA) const {
assert(isa<Instruction>(IA) || isa<Argument>(IA));
if (auto IIt = InstructionsAndArguments.find(IA);
IIt != InstructionsAndArguments.end())
return IIt->second;
return std::nullopt;
}
Function *
AsmParserContext::getFunctionAtLocation(const FileLocRange &Query) const {
auto It = FunctionsInverse.find(Query.Start);
if (It.stop() <= Query.End)
return *It;
return nullptr;
}
Function *AsmParserContext::getFunctionAtLocation(const FileLoc &Query) const {
return FunctionsInverse.lookup(Query, nullptr);
}
BasicBlock *
AsmParserContext::getBlockAtLocation(const FileLocRange &Query) const {
auto It = BlocksInverse.find(Query.Start);
if (It.stop() <= Query.End)
return *It;
return nullptr;
}
BasicBlock *AsmParserContext::getBlockAtLocation(const FileLoc &Query) const {
return BlocksInverse.lookup(Query, nullptr);
}
Value *AsmParserContext::getInstructionOrArgumentAtLocation(
const FileLocRange &Query) const {
auto It = InstructionsAndArgumentsInverse.find(Query.Start);
if (It.stop() <= Query.End)
return *It;
return nullptr;
}
Value *AsmParserContext::getInstructionOrArgumentAtLocation(
const FileLoc &Query) const {
return InstructionsAndArgumentsInverse.lookup(Query, nullptr);
}
Value *AsmParserContext::getValueReferencedAtLocation(
const FileLocRange &Query) const {
auto It = ReferencedValues.find(Query.Start);
if (It.stop() <= Query.End)
return *It;
return nullptr;
}
Value *
AsmParserContext::getValueReferencedAtLocation(const FileLoc &Query) const {
return ReferencedValues.lookup(Query, nullptr);
}
bool AsmParserContext::addFunctionLocation(Function *F,
const FileLocRange &Loc) {
bool Inserted = Functions.insert({F, Loc}).second;
if (Inserted)
FunctionsInverse.insert(Loc.Start, Loc.End, F);
return Inserted;
}
bool AsmParserContext::addBlockLocation(BasicBlock *BB,
const FileLocRange &Loc) {
bool Inserted = Blocks.insert({BB, Loc}).second;
if (Inserted)
BlocksInverse.insert(Loc.Start, Loc.End, BB);
return Inserted;
}
bool AsmParserContext::addInstructionOrArgumentLocation(
Value *IA, const FileLocRange &Loc) {
assert(isa<Instruction>(IA) || isa<Argument>(IA));
bool Inserted = InstructionsAndArguments.insert({IA, Loc}).second;
if (Inserted)
InstructionsAndArgumentsInverse.insert(Loc.Start, Loc.End, IA);
return Inserted;
}
bool AsmParserContext::addValueReferenceAtLocation(Value *V,
const FileLocRange &Loc) {
ReferencedValues.insert(Loc.Start, Loc.End, V);
return true;
}
} // namespace llvm