[llvm] [JITLink][AArch32] Add TableGen Backend for Instr Encodings (PR #76996)

Stefan Gränitz via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 5 05:15:46 PST 2024


================
@@ -0,0 +1,58 @@
+/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\
+|*                                                                            *|
+|* Skeleton data structures                                                   *|
+|*                                                                            *|
+|* Automatically generated file, do not edit!                                 *|
+|*                                                                            *|
+\*===----------------------------------------------------------------------===*/
+
+using namespace llvm::jitlink::aarch32;
+
+namespace llvm {
+namespace jitlink {
+namespace aarch32 {
+template <> struct FixupInfo<Arm_MovwAbsNC> : public FixupInfoArm {
+  static constexpr uint32_t Opcode = 0x3000000;
+  static constexpr uint32_t OpcodeMask = 0xff00000;
+  static constexpr uint32_t ImmMask = 0xf0fff;
+  static constexpr uint32_t RegMask = 0xf000;
+};
----------------
weliveindetail wrote:

These `struct`s are readable and get close to the original definitions. The major drawback is that they are not extensible. The idea behind modelling `FixupInfo` with template specialization was that we can organize arbitrary information by edge kind and assign names. With that we don't have to redeclare magic numbers in the code all the time. I think this extensibility is a property that's worth keeping and it probably means that we cannot generate the structs directly.

https://github.com/llvm/llvm-project/pull/76996


More information about the llvm-commits mailing list