28#ifndef __ARCH_ARM_AAPCS64_HH__
29#define __ARCH_ARM_AAPCS64_HH__
81template <
typename T,
typename Enabled=
void>
84template <
typename E,
size_t N>
86 typename
std::enable_if_t<
87 (std::is_integral_v<E> || std::is_floating_point_v<E>) &&
88 (sizeof(E) * N == 8 || sizeof(E) * N == 16)>> :
99template <
typename T,
typename Enabled=
void>
104 (std::is_array_v<T> || std::is_class_v<T> || std::is_union_v<T>) &&
108 !IsAapcs64ShortVectorV<T>
109 >> :
public std::true_type
124template <
typename T,
typename Enabled=
void>
127template <
typename E,
size_t N>
129 typename
std::enable_if_t<std::is_floating_point_v<E> && N <= 4>> :
130 public std::true_type
140template <
typename T,
typename Enabled=
void>
143template <
typename E,
size_t N>
145 typename
std::enable_if_t<IsAapcs64ShortVectorV<E> && N <= 4>> :
146 public std::true_type
153template <
typename T,
typename Enabled=
void>
158 IsAapcs64HfaV<T> || IsAapcs64HvaV<T>>> :
159 public std::true_type
167 template <
typename T>
172 size_t align = std::max<size_t>(8,
alignof(T));
174 size_t size =
roundUp(
sizeof(T), 8);
195template <
typename Float>
197 std::is_floating_point_v<Float> || IsAapcs64ShortVectorV<Float>>> :
207 return vc.
as<Float>()[0];
214template <
typename Float>
216 std::is_floating_point_v<Float> || IsAapcs64ShortVectorV<Float>>>
224 reg.as<Float>()[0] =
f;
235template <
typename Integer>
237 std::is_integral_v<Integer> && (sizeof(Integer) <= 8)>> :
253template <
typename Integer>
255 std::is_integral_v<Integer> && (sizeof(Integer) > 8)>> :
261 if (
alignof(Integer) == 16 && (state.
ngrn % 2))
264 if (
sizeof(Integer) == 16 && state.
ngrn + 1 <= state.
MAX_GRN) {
278template <
typename Integer>
280 std::is_integral_v<Integer> && (sizeof(Integer) <= 8)>>
289template <
typename Integer>
291 std::is_integral_v<Integer> && (sizeof(Integer) > 8)>>
310template <
typename E,
size_t N>
313template <
typename HA>
321 constexpr size_t Count =
sizeof(HA) /
sizeof(Elem);
325 for (
int i = 0;
i < Count;
i++)
337template <
typename HA>
344 constexpr size_t Count =
sizeof(HA) /
sizeof(Elem);
346 for (
int i = 0;
i < Count;
i++)
356template <
typename Composite>
358 IsAapcs64CompositeV<Composite> && !IsAapcs64HxaV<Composite>>> :
364 if (
sizeof(Composite) > 16) {
375 size_t bytes =
sizeof(Composite);
376 using Chunk = uint64_t;
378 const size_t chunk_size =
sizeof(Chunk);
379 const size_t regs = (bytes + chunk_size - 1) / chunk_size;
383 std::align_val_t align {
alignof(Composite)};
384 auto buf = std::unique_ptr<uint8_t[]>(
new (align) uint8_t[bytes]);
385 for (
int i = 0;
i < regs;
i++) {
388 size_t to_copy = std::min(bytes, chunk_size);
389 memcpy(buf.get() +
i * chunk_size, &
val, to_copy);
402template <
typename Composite>
404 IsAapcs64CompositeV<Composite> && !IsAapcs64HxaV<Composite>>>
409 if (
sizeof(Composite) > 16) {
418 size_t bytes =
sizeof(Composite);
419 using Chunk = uint64_t;
421 const int chunk_size =
sizeof(Chunk);
422 const int regs = (bytes + chunk_size - 1) / chunk_size;
425 uint8_t *buf = (uint8_t *)&
cp;
426 for (
int i = 0;
i < regs;
i++) {
427 size_t to_copy = std::min<size_t>(bytes, chunk_size);
430 memcpy(&
val, buf, to_copy);
Register ID: describe an architectural register with its class and index.
ThreadContext is the external interface to all thread state for anything outside of the CPU.
virtual RegVal getReg(const RegId ®) const
virtual void setReg(const RegId ®, RegVal val)
VecElem * as()
View interposers.
static constexpr T roundUp(const T &val, const U &align)
This function is used to align addresses in memory.
static RegId x(unsigned index)
ByteOrder byteOrder(const ThreadContext *tc)
constexpr RegClass intRegClass
gem5::VecRegContainer< NumVecElemPerVecReg *sizeof(VecElem)> VecRegContainer
constexpr RegClass vecRegClass
constexpr bool IsAapcs64CompositeV
constexpr bool IsAapcs64HvaV
constexpr bool IsAapcs64HfaV
constexpr bool IsAapcs64HxaV
constexpr bool IsAapcs64ShortVectorV
Copyright (c) 2024 Arm Limited All rights reserved.
ProxyPtr< T, SETranslatingPortProxy > VPtr
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
T gtoh(T value, ByteOrder guest_byte_order)
T htog(T value, ByteOrder guest_byte_order)
ConstProxyPtr< T, SETranslatingPortProxy > ConstVPtr
Overload hash function for BasicBlockRange type.
State(const ThreadContext *tc)
static T loadFromStack(ThreadContext *tc, Aapcs64::State &state)
static Composite get(ThreadContext *tc, Aapcs64::State &state)
static Float get(ThreadContext *tc, Aapcs64::State &state)
static HA get(ThreadContext *tc, Aapcs64::State &state)
static Integer get(ThreadContext *tc, Aapcs64::State &state)
static Integer get(ThreadContext *tc, Aapcs64::State &state)
static void store(ThreadContext *tc, const Composite &c)
static void store(ThreadContext *tc, const Float &f)
static HA store(ThreadContext *tc, const HA &ha)
static void store(ThreadContext *tc, const Integer &i)
static void store(ThreadContext *tc, const Integer &i)