]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm-project/llvm/lib/Target/Hexagon/HexagonArch.h
Merge ^/head r363583 through r364040.
[FreeBSD/FreeBSD.git] / contrib / llvm-project / llvm / lib / Target / Hexagon / HexagonArch.h
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) {
29   llvm::Optional<ArchEnum> Res;
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