rust/compiler
bors b91a3a0560 Auto merge of #132472 - taiki-e:sparc-asm, r=Amanieu
Basic inline assembly support for SPARC and SPARC64

This implements asm_experimental_arch (tracking issue https://github.com/rust-lang/rust/issues/93335) for SPARC and SPARC64.

This PR includes:

- General-purpose registers `r[0-31]` (`reg` register class, LLVM/GCC constraint `r`)
  Supported types: i8, i16, i32, i64 (SPARC64-only)
  Aliases: `g[0-7]` (`r[0-7]`), `o[0-7]` (`r[8-15]`), `l[0-7]` (`r[16-23]`), `i[0-7]` (`r[24-31]`)
- `y` register (clobber-only, needed for clobber_abi)
- preserves_flags: Integer condition codes (`icc`, `xcc`) and floating-point condition codes (`fcc*`)

The following are *not* included:

- 64-bit integer support on SPARC-V8+'s global or out registers (`g[0-7]`, `o[0-7]`): GCC's `h` constraint (it seems that there is no corresponding constraint in LLVM?)
- Floating-point registers (LLVM/GCC constraint `e`/`f`):
  I initially tried to implement this, but postponed it for now because there seemed to be several parts in LLVM that behaved differently than in the LangRef's description.
- clobber_abi: Support for floating-point registers is needed.

Refs:
- LLVM
  - Reserved registers https://github.com/llvm/llvm-project/blob/llvmorg-19.1.0/llvm/lib/Target/Sparc/SparcRegisterInfo.cpp#L52
  - Register definitions https://github.com/llvm/llvm-project/blob/llvmorg-19.1.0/llvm/lib/Target/Sparc/SparcRegisterInfo.td
  - Supported constraints https://llvm.org/docs/LangRef.html#supported-constraint-code-list
- GCC
  - Reserved registers 63b6967b06/gcc/config/sparc/sparc.h (L633-L658)
  - Supported constraints https://gcc.gnu.org/onlinedocs/gcc/Machine-Constraints.html
- SPARC ISA/ABI
  - (64-bit ISA) The SPARC Architecture Manual, Version 9
    (32-bit ISA) The SPARC Architecture Manual, Version 8
    (64-bit ABI) System V Application Binary Interface SPARC Version 9 Processor Supplement, Rev 1.35
    (32-bit ABI) System V Application Binary Interface SPARC Processor Supplement, Third Edition
    The above docs can be downloaded from https://sparc.org/technical-documents
  - (32-bit V8+ ABI) The V8+ Technical Specification
    https://temlib.org/pub/SparcStation/Standards/V8plus.pdf

cc `@thejpster` (sparc-unknown-none-elf target maintainer)
(AFAIK, other sparc/sprac64 targets don't have target maintainers)

r? `@Amanieu`

`@rustbot` label +O-SPARC +A-inline-assembly
2024-11-07 21:07:06 +00:00
..
rustc Remove unused intercrate dependencies 2024-11-07 14:17:16 +00:00
rustc_abi compiler: Lift rustc_target::spec::abi::Abi to rustc_abi::ExternAbi 2024-10-30 22:38:49 -07:00
rustc_arena
rustc_ast Add documentation on ast::Attribute 2024-11-05 16:38:15 +01:00
rustc_ast_ir
rustc_ast_lowering Remove unused intercrate dependencies 2024-11-07 14:17:16 +00:00
rustc_ast_passes Rename the FIXMEs, remove a few that dont matter anymore 2024-11-03 18:59:41 +00:00
rustc_ast_pretty
rustc_attr remove support for extern-block const intrinsics 2024-11-04 23:27:45 +01:00
rustc_baked_icu_data
rustc_borrowck Auto merge of #132580 - compiler-errors:globs, r=Noratrieb 2024-11-05 08:30:56 +00:00
rustc_builtin_macros
rustc_codegen_cranelift remove 'platform-intrinsic' ABI leftovers 2024-11-07 17:42:49 +01:00
rustc_codegen_gcc Basic inline assembly support for SPARC and SPARC64 2024-11-07 21:19:03 +09:00
rustc_codegen_llvm Basic inline assembly support for SPARC and SPARC64 2024-11-07 21:19:03 +09:00
rustc_codegen_ssa Remove unused intercrate dependencies 2024-11-07 14:17:16 +00:00
rustc_const_eval Rollup merge of #132057 - RalfJung:miri-abi-compat, r=wesleywiser 2024-11-07 13:08:27 +01:00
rustc_data_structures
rustc_driver
rustc_driver_impl make time format parsing compiletime 2024-11-03 15:51:39 +03:00
rustc_error_codes Reject generic self types. 2024-10-30 10:48:08 +00:00
rustc_error_messages
rustc_errors Rename target triple to target tuple in many places in the compiler 2024-11-02 21:29:59 +01:00
rustc_expand Rollup merge of #132332 - nnethercote:use-token_descr-more, r=estebank 2024-10-30 06:40:36 +01:00
rustc_feature add new rustc_const_stable_intrinsic attribute for const-stable intrinsics 2024-11-04 23:27:46 +01:00
rustc_fluent_macro
rustc_fs_util
rustc_graphviz
rustc_hir Rollup merge of #132423 - RalfJung:const-eval-align-offset, r=dtolnay 2024-11-03 20:08:13 -08:00
rustc_hir_analysis Rollup merge of #132734 - RalfJung:platform-intrinsic, r=compiler-errors 2024-11-07 18:19:38 +01:00
rustc_hir_pretty compiler: Switch to rustc_abi in hir_pretty, lint_defs, and mir_build 2024-10-30 22:38:49 -07:00
rustc_hir_typeck Remove unused intercrate dependencies 2024-11-07 14:17:16 +00:00
rustc_incremental replace manual time convertions with std ones 2024-11-03 15:51:39 +03:00
rustc_index
rustc_index_macros
rustc_infer Remove unused intercrate dependencies 2024-11-07 14:17:16 +00:00
rustc_interface Rollup merge of #132259 - mrkajetanp:branch-protection-pauth-lr, r=davidtwco 2024-11-05 20:10:49 +01:00
rustc_lexer
rustc_lint Remove unused intercrate dependencies 2024-11-07 14:17:16 +00:00
rustc_lint_defs compiler: Switch to rustc_abi in hir_pretty, lint_defs, and mir_build 2024-10-30 22:38:49 -07:00
rustc_llvm PassWrapper: adapt for new parameter in LLVM 2024-11-05 15:49:37 +11:00
rustc_log
rustc_macros
rustc_metadata ty::KContainer -> ty::AssocItemContainer::K 2024-11-04 04:45:52 +00:00
rustc_middle Rollup merge of #132734 - RalfJung:platform-intrinsic, r=compiler-errors 2024-11-07 18:19:38 +01:00
rustc_mir_build Auto merge of #132580 - compiler-errors:globs, r=Noratrieb 2024-11-05 08:30:56 +00:00
rustc_mir_dataflow compiler: Remove unused rustc_target from Cargo.tomls 2024-11-03 13:38:47 -08:00
rustc_mir_transform compiler: Directly use rustc_abi in mir_transform 2024-11-03 13:38:47 -08:00
rustc_monomorphize compiler: Add rustc_abi to _monomorphize 2024-11-02 20:31:47 -07:00
rustc_next_trait_solver Remove unused intercrate dependencies 2024-11-07 14:17:16 +00:00
rustc_parse Revert "Avoid nested replacement ranges" from #129346. 2024-11-04 15:57:35 +11:00
rustc_parse_format
rustc_passes remove support for extern-block const intrinsics 2024-11-04 23:27:45 +01:00
rustc_pattern_analysis compiler: Remove unused rustc_target from Cargo.tomls 2024-11-03 13:38:47 -08:00
rustc_privacy Merge HostPolarity and BoundConstness 2024-10-30 16:23:16 +00:00
rustc_query_impl
rustc_query_system replace manual time convertions with std ones 2024-11-03 15:51:39 +03:00
rustc_resolve Rollup merge of #132567 - estebank:bad-suggestion, r=Nadrieril 2024-11-05 20:10:51 +01:00
rustc_sanitizers compiler: Add rustc_abi to _sanitizers 2024-11-02 20:31:47 -07:00
rustc_serialize
rustc_session Auto merge of #132664 - matthiaskrgr:rollup-i27nr7i, r=matthiaskrgr 2024-11-06 01:21:42 +00:00
rustc_smir ty::BrK -> ty::BoundRegionKind::K 2024-11-04 04:45:52 +00:00
rustc_span Basic inline assembly support for SPARC and SPARC64 2024-11-07 21:19:03 +09:00
rustc_symbol_mangling ty::BrK -> ty::BoundRegionKind::K 2024-11-04 04:45:52 +00:00
rustc_target Auto merge of #132472 - taiki-e:sparc-asm, r=Amanieu 2024-11-07 21:07:06 +00:00
rustc_trait_selection Remove unused intercrate dependencies 2024-11-07 14:17:16 +00:00
rustc_traits
rustc_transmute
rustc_ty_utils Make fn_abi_sanity_check a bit stricter 2024-11-07 15:54:40 +00:00
rustc_type_ir Rename the FIXMEs, remove a few that dont matter anymore 2024-11-03 18:59:41 +00:00
rustc_type_ir_macros
stable_mir