LLVM  14.0.0git
HexagonArch.h
Go to the documentation of this file.
1 //===- HexagonArch.h ------------------------------------------------------===//
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 
9 #ifndef LLVM_LIB_TARGET_HEXAGON_HEXAGONARCH_H
10 #define LLVM_LIB_TARGET_HEXAGON_HEXAGONARCH_H
11 
12 #include "llvm/ADT/ArrayRef.h"
13 #include "llvm/ADT/Optional.h"
14 #include "llvm/ADT/StringRef.h"
15 #include "HexagonDepArch.h"
16 #include <algorithm>
17 
18 namespace llvm {
19 namespace Hexagon {
20 
21 template <class ArchCont, typename Val>
22 bool ValidArch(ArchCont const &ArchList, Val HexArch) {
23  return std::any_of(std::begin(ArchList), std::end(ArchList),
24  [HexArch](Val V) { return V == HexArch; });
25 }
26 
27 template <class ArchCont, typename Val>
28 llvm::Optional<ArchEnum> GetCpu(ArchCont const &ArchList, Val CPUString) {
30  auto Entry = ArchList.find(CPUString);
31  if (Entry != ArchList.end())
32  Res = Entry->second;
33  return Res;
34 }
35 } // namespace Hexagon
36 } // namespace llvm
37 #endif // LLVM_LIB_TARGET_HEXAGON_HEXAGONARCH_H
llvm
---------------------— PointerInfo ------------------------------------—
Definition: AllocatorList.h:23
Optional.h
StringRef.h
llvm::sys::path::end
const_iterator end(StringRef path)
Get end iterator over path.
Definition: Path.cpp:233
llvm::sys::path::begin
const_iterator begin(StringRef path, Style style=Style::native)
Get begin iterator over path.
Definition: Path.cpp:224
llvm::Optional
Definition: APInt.h:33
llvm::Hexagon::GetCpu
llvm::Optional< ArchEnum > GetCpu(ArchCont const &ArchList, Val CPUString)
Definition: HexagonArch.h:28
ArrayRef.h
llvm::any_of
bool any_of(R &&range, UnaryPredicate P)
Provide wrappers to std::any_of which take ranges instead of having to pass begin/end explicitly.
Definition: STLExtras.h:1541
HexagonDepArch.h
llvm::Hexagon::ValidArch
bool ValidArch(ArchCont const &ArchList, Val HexArch)
Definition: HexagonArch.h:22