LLVM 23.0.0git
AArch64BaseInfo.cpp
Go to the documentation of this file.
1//===-- AArch64BaseInfo.cpp - AArch64 Base encoding information------------===//
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 provides basic encoding and assembly information for AArch64.
10//
11//===----------------------------------------------------------------------===//
12#include "AArch64BaseInfo.h"
15#include "llvm/Support/Regex.h"
16
17using namespace llvm;
18
19namespace llvm {
20 namespace AArch64AT {
21#define GET_ATsList_IMPL
22#include "AArch64GenSystemOperands.inc"
23 }
24}
25
26
27namespace llvm {
28 namespace AArch64DBnXS {
29#define GET_DBnXSsList_IMPL
30#include "AArch64GenSystemOperands.inc"
31 }
32}
33
34namespace llvm {
35 namespace AArch64DB {
36#define GET_DBsList_IMPL
37#include "AArch64GenSystemOperands.inc"
38 }
39}
40
41namespace llvm {
42 namespace AArch64DC {
43#define GET_DCsList_IMPL
44#include "AArch64GenSystemOperands.inc"
45 }
46}
47
48namespace llvm {
49 namespace AArch64IC {
50#define GET_ICsList_IMPL
51#include "AArch64GenSystemOperands.inc"
52 }
53}
54
55namespace llvm {
56 namespace AArch64ISB {
57#define GET_ISBsList_IMPL
58#include "AArch64GenSystemOperands.inc"
59 }
60}
61
62namespace llvm {
63 namespace AArch64PRFM {
64#define GET_PRFMsList_IMPL
65#include "AArch64GenSystemOperands.inc"
66 }
67}
68
69namespace llvm {
70 namespace AArch64SVEPRFM {
71#define GET_SVEPRFMsList_IMPL
72#include "AArch64GenSystemOperands.inc"
73 }
74}
75
76namespace llvm {
77 namespace AArch64RPRFM {
78#define GET_RPRFMsList_IMPL
79#include "AArch64GenSystemOperands.inc"
80 } // namespace AArch64RPRFM
81} // namespace llvm
82
83namespace llvm {
85#define GET_SVEPREDPATsList_IMPL
86#include "AArch64GenSystemOperands.inc"
87 }
88}
89
90namespace llvm {
92#define GET_SVEVECLENSPECIFIERsList_IMPL
93#include "AArch64GenSystemOperands.inc"
94} // namespace AArch64SVEVecLenSpecifier
95} // namespace llvm
96
97namespace llvm {
99#define GET_ExactFPImmsList_IMPL
100#include "AArch64GenSystemOperands.inc"
101 }
102}
103
104namespace llvm {
105 namespace AArch64PState {
106#define GET_PStateImm0_15sList_IMPL
107#include "AArch64GenSystemOperands.inc"
108#define GET_PStateImm0_1sList_IMPL
109#include "AArch64GenSystemOperands.inc"
110 }
111}
112
113namespace llvm {
115#define GET_TINDEX_IMPL
116#include "AArch64GenSystemOperands.inc"
117} // namespace AArch64TIndexHint
118} // namespace llvm
119
120namespace llvm {
121 namespace AArch64SysReg {
122#define GET_SysRegsList_IMPL
123#include "AArch64GenSystemOperands.inc"
124 }
125}
126
128 // Try to parse an S<op0>_<op1>_<Cn>_<Cm>_<op2> register name
129 static const Regex GenericRegPattern("^S([0-3])_([0-7])_C([0-9]|1[0-5])_C([0-9]|1[0-5])_([0-7])$");
130
131 std::string UpperName = Name.upper();
133 if (!GenericRegPattern.match(UpperName, &Ops))
134 return -1;
135
136 uint32_t Op0 = 0, Op1 = 0, CRn = 0, CRm = 0, Op2 = 0;
137 uint32_t Bits;
138 Ops[1].getAsInteger(10, Op0);
139 Ops[2].getAsInteger(10, Op1);
140 Ops[3].getAsInteger(10, CRn);
141 Ops[4].getAsInteger(10, CRm);
142 Ops[5].getAsInteger(10, Op2);
143 Bits = (Op0 << 14) | (Op1 << 11) | (CRn << 7) | (CRm << 3) | Op2;
144
145 return Bits;
146}
147
149 assert(Bits < 0x10000);
150 uint32_t Op0 = (Bits >> 14) & 0x3;
151 uint32_t Op1 = (Bits >> 11) & 0x7;
152 uint32_t CRn = (Bits >> 7) & 0xf;
153 uint32_t CRm = (Bits >> 3) & 0xf;
154 uint32_t Op2 = Bits & 0x7;
155
156 return "S" + utostr(Op0) + "_" + utostr(Op1) + "_C" + utostr(CRn) + "_C" +
157 utostr(CRm) + "_" + utostr(Op2);
158}
159
160namespace llvm {
161namespace AArch64TLBI {
162#define GET_TLBITable_IMPL
163#include "AArch64GenSystemOperands.inc"
164} // namespace AArch64TLBI
165} // namespace llvm
166
167namespace llvm {
168namespace AArch64PLBI {
169#define GET_PLBITable_IMPL
170#include "AArch64GenSystemOperands.inc"
171} // namespace AArch64PLBI
172} // namespace llvm
173
174namespace llvm {
175namespace AArch64TLBIP {
176#define GET_TLBIPTable_IMPL
177#include "AArch64GenSystemOperands.inc"
178} // namespace AArch64TLBIP
179} // namespace llvm
180
181namespace llvm {
182namespace AArch64GIC {
183#define GET_GICTable_IMPL
184#include "AArch64GenSystemOperands.inc"
185} // namespace AArch64GIC
186} // namespace llvm
187
188namespace llvm {
189namespace AArch64GICR {
190#define GET_GICRTable_IMPL
191#include "AArch64GenSystemOperands.inc"
192} // namespace AArch64GICR
193} // namespace llvm
194
195namespace llvm {
196namespace AArch64GSB {
197#define GET_GSBTable_IMPL
198#include "AArch64GenSystemOperands.inc"
199} // namespace AArch64GSB
200} // namespace llvm
201
202namespace llvm {
203 namespace AArch64SVCR {
204#define GET_SVCRsList_IMPL
205#include "AArch64GenSystemOperands.inc"
206 }
207}
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
const AbstractManglingParser< Derived, Alloc >::OperatorInfo AbstractManglingParser< Derived, Alloc >::Ops[]
This file defines the SmallVector class.
This file contains some functions that are useful when dealing with strings.
LLVM_ABI bool match(StringRef String, SmallVectorImpl< StringRef > *Matches=nullptr, std::string *Error=nullptr) const
matches - Match the regex against a given String.
Definition Regex.cpp:83
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
Represent a constant reference to a string, i.e.
Definition StringRef.h:56
uint32_t parseGenericRegister(StringRef Name)
std::string genericRegisterString(uint32_t Bits)
This is an optimization pass for GlobalISel generic memory operations.
std::string utostr(uint64_t X, bool isNeg=false)