[RISCV] Fix mgather -> riscv.masked.strided.load combine not extending indices (...
[llvm-project.git] / llvm / lib / TextAPI / SymbolSet.cpp
blob5b9882dadcdf40ce00951e1ad6f01191bd9176d5
1 //===- lib/TextAPI/SymbolSet.cpp - TAPI Symbol Set ------------*- C++-*----===//
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 //===----------------------------------------------------------------------===//
9 #include "llvm/TextAPI/SymbolSet.h"
11 using namespace llvm;
12 using namespace llvm::MachO;
14 Symbol *SymbolSet::addGlobalImpl(SymbolKind Kind, StringRef Name,
15 SymbolFlags Flags) {
16 Name = copyString(Name);
17 auto Result = Symbols.try_emplace(SymbolsMapKey{Kind, Name}, nullptr);
18 if (Result.second)
19 Result.first->second =
20 new (Allocator) Symbol{Kind, Name, TargetList(), Flags};
21 return Result.first->second;
24 Symbol *SymbolSet::addGlobal(SymbolKind Kind, StringRef Name, SymbolFlags Flags,
25 const Target &Targ) {
26 auto *Sym = addGlobalImpl(Kind, Name, Flags);
27 Sym->addTarget(Targ);
28 return Sym;
31 const Symbol *SymbolSet::findSymbol(SymbolKind Kind, StringRef Name) const {
32 return Symbols.lookup({Kind, Name});