LLVM 22.0.0git
LoongArchTargetParser.h
Go to the documentation of this file.
1//==-- LoongArch64TargetParser - Parser for LoongArch64 features --*- 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//===----------------------------------------------------------------------===//
8//
9// This file implements a target parser to recognise LoongArch hardware features
10// such as CPU/ARCH and extension names.
11//
12//===----------------------------------------------------------------------===//
13
14#ifndef LLVM_TARGETPARSER_LOONGARCHTARGETPARSER_H
15#define LLVM_TARGETPARSER_LOONGARCHTARGETPARSER_H
16
19#include <vector>
20
21namespace llvm {
22class StringRef;
23
24namespace LoongArch {
25
27 // 64-bit ISA is available.
28 FK_64BIT = 1 << 1,
29
30 // Single-precision floating-point instructions are available.
31 FK_FP32 = 1 << 2,
32
33 // Double-precision floating-point instructions are available.
34 FK_FP64 = 1 << 3,
35
36 // Loongson SIMD Extension is available.
37 FK_LSX = 1 << 4,
38
39 // Loongson Advanced SIMD Extension is available.
40 FK_LASX = 1 << 5,
41
42 // Loongson Binary Translation Extension is available.
43 FK_LBT = 1 << 6,
44
45 // Loongson Virtualization Extension is available.
46 FK_LVZ = 1 << 7,
47
48 // Allow memory accesses to be unaligned.
49 FK_UAL = 1 << 8,
50
51 // Floating-point approximate reciprocal instructions are available.
52 FK_FRECIPE = 1 << 9,
53
54 // Atomic memory swap and add instructions for byte and half word are
55 // available.
56 FK_LAM_BH = 1 << 10,
57
58 // Atomic memory compare and swap instructions for byte, half word, word and
59 // double word are available.
60 FK_LAMCAS = 1 << 11,
61
62 // Do not generate load-load barrier instructions (dbar 0x700).
63 FK_LD_SEQ_SA = 1 << 12,
64
65 // Assume div.w[u] and mod.w[u] can handle inputs that are not sign-extended.
66 FK_DIV32 = 1 << 13,
67
68 // sc.q is available.
69 FK_SCQ = 1 << 14,
70};
71
76
77enum class ArchKind {
78#define LOONGARCH_ARCH(NAME, KIND, FEATURES) KIND,
79#include "LoongArchTargetParser.def"
80};
87
90LLVM_ABI bool getArchFeatures(StringRef Arch, std::vector<StringRef> &Features);
94
95} // namespace LoongArch
96
97} // namespace llvm
98
99#endif // LLVM_TARGETPARSER_LOONGARCHTARGETPARSER_H
#define LLVM_ABI
Definition Compiler.h:213
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
StringRef - Represent a constant reference to a string, i.e.
Definition StringRef.h:55
LLVM_ABI StringRef getDefaultArch(bool Is64Bit)
LLVM_ABI bool getArchFeatures(StringRef Arch, std::vector< StringRef > &Features)
LLVM_ABI bool isValidCPUName(StringRef TuneCPU)
LLVM_ABI bool isValidFeatureName(StringRef Feature)
LLVM_ABI bool isValidArchName(StringRef Arch)
LLVM_ABI void fillValidCPUList(SmallVectorImpl< StringRef > &Values)
This is an optimization pass for GlobalISel generic memory operations.