1 //===- HexagonArch.h ------------------------------------------------------===//
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
7 //===----------------------------------------------------------------------===//
9 #ifndef LLVM_LIB_TARGET_HEXAGON_HEXAGONARCH_H
10 #define LLVM_LIB_TARGET_HEXAGON_HEXAGONARCH_H
12 #include "llvm/ADT/ArrayRef.h"
13 #include "llvm/ADT/Optional.h"
14 #include "llvm/ADT/StringRef.h"
15 #include "HexagonDepArch.h"
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; });
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())
35 } // namespace Hexagon
37 #endif // LLVM_LIB_TARGET_HEXAGON_HEXAGONARCH_H