| commit | 2e8ecf7d5fbb4e0d029b0baf94f57f8161b396be | [log] [tgz] |
|---|---|---|
| author | Lakshay Kumar <lakshayk@nvidia.com> | Mon Sep 01 15:17:15 2025 +0530 |
| committer | GitHub <noreply@github.com> | Mon Sep 01 10:47:15 2025 +0100 |
| tree | 49fb5610a68a0cd682ae9b938c2cb4e0bde507d2 | |
| parent | 020dff4be832e035a24fcdb13e26d7c2e69887eb [diff] |
[llvm-exegesis] [AArch64] Resolving "not all operands are initialized by snippet generator" (#142529) Exegesis for AArch64 arch, before this patch only handles/initialise Immediate and Register Operands. For opcodes requiring rest operand types exegesis exits with Error: `"not all operands are initialised by snippet generator"`. To resolve a given error we have to initialise required operand types. i.e., For `"not all operands are initialised by snippet generator"` init `OPERAND_SHIFT_MSL`, `OPERAND_PCREL`, And For `"targets with target-specific operands should implement this"` init `OPERAND_FIRST_TARGET`. This PR adds support to the following opcodes:- - OPERAND_SHIFT_MSL: `[MOVI|MVNI]_[2s|4s]_msl`. - OPERAND_PCREL: `LDR[R|X|W|SW|D|S|Q]l` - OPERAND_IMPLICIT_IMM_0: `[UMOV|SMOV]v[i8|i16|i32|i64|i8to32|i8to64|i16to32|i32to64|i16to64]_idx0` --- ### [Experiment/Learnings] Moreover, We found out we can similarly omit `OPERAND_UNKNOWN` with immediate value of 0. This brute force fix helps us get major part of (`~1000`) opcodes which throw un-init operands error. But, The correct way to resolve is to introduce `OperandType` in AArch64 tablegen files for opcode which have `OPERND_UNKNOWN` in `AArch64GenInstrInfo.inc`. And add switch case for those `OperandType` in the `randomizeTargetMCOperand()`. As, side-effect to this temporary fix that we explored is listed below system-level instructions throws `illegal instruction` i.e. for`MRS, MSR, MSRpstatesvcrImm1, SYSLxt, SYSxt, UDF`. This patch in `--mode=inverse_throughput` for opcodes `MRS, MSR, MSRpstatesvcrImm1, SYSLxt, SYSxt, UDF` exits with handled error of `snippet crashed while running: Illegal instruction`, they previously used to exits with error `not all operands initialized by snippet generator`. [For completeness] Additionally, exegesis beforehand and with this patch too, throws illegal instruction in throughput mode, for these opcodes too (`APAS, DCPS1, DCPS2, DCPS3, HLT, HVC, SMC, STGM, STZGM`). Will look into them later. --- ### [Summary] Thus, Only introduced changes in implementation of `randomizeTargetMCOperand()` for AArch64 that omitting `OPERAND_SHIFT_MSL`, `OPERAND_PCREL` to an immediate value of 264 and 8 respectively. PS: Omitting `MCOI::OPERAND_FIRST_TARGET`/`llvm:AArch64:OPERAND_IMPLICIT_IMM_0` similarly, to value 0. It was low hanging change thus added in this PR only. For any future operand type of AArch64 if not initialised will exit with error `"Unimplemented operand type: MCOI::OperandType:<#Number>"`.
Welcome to the LLVM project!
This repository contains the source code for LLVM, a toolkit for the construction of highly optimized compilers, optimizers, and run-time environments.
The LLVM project has multiple components. The core of the project is itself called “LLVM”. This contains all of the tools, libraries, and header files needed to process intermediate representations and convert them into object files. Tools include an assembler, disassembler, bitcode analyzer, and bitcode optimizer.
C-like languages use the Clang frontend. This component compiles C, C++, Objective-C, and Objective-C++ code into LLVM bitcode -- and from there into object files, using LLVM.
Other components include: the libc++ C++ standard library, the LLD linker, and more.
Consult the Getting Started with LLVM page for information on building and running LLVM.
For information on how to contribute to the LLVM project, please take a look at the Contributing to LLVM guide.
Join the LLVM Discourse forums, Discord chat, LLVM Office Hours or Regular sync-ups.
The LLVM project has adopted a code of conduct for participants to all modes of communication within the project.