rust/tests/ui/feature-gates
Seth Pellegrino 897c7bb23b feat: riscv-interrupt-{m,s} calling conventions
Similar to prior support added for the mips430, avr, and x86 targets
this change implements the rough equivalent of clang's
[`__attribute__((interrupt))`][clang-attr] for riscv targets, enabling
e.g.

```rust
static mut CNT: usize = 0;

pub extern "riscv-interrupt-m" fn isr_m() {
    unsafe {
        CNT += 1;
    }
}
```

to produce highly effective assembly like:

```asm
pub extern "riscv-interrupt-m" fn isr_m() {
420003a0:       1141                    addi    sp,sp,-16
    unsafe {
        CNT += 1;
420003a2:       c62a                    sw      a0,12(sp)
420003a4:       c42e                    sw      a1,8(sp)
420003a6:       3fc80537                lui     a0,0x3fc80
420003aa:       63c52583                lw      a1,1596(a0) # 3fc8063c <_ZN12esp_riscv_rt3CNT17hcec3e3a214887d53E.0>
420003ae:       0585                    addi    a1,a1,1
420003b0:       62b52e23                sw      a1,1596(a0)
    }
}
420003b4:       4532                    lw      a0,12(sp)
420003b6:       45a2                    lw      a1,8(sp)
420003b8:       0141                    addi    sp,sp,16
420003ba:       30200073                mret
```

(disassembly via `riscv64-unknown-elf-objdump -C -S --disassemble ./esp32c3-hal/target/riscv32imc-unknown-none-elf/release/examples/gpio_interrupt`)

This outcome is superior to hand-coded interrupt routines which, lacking
visibility into any non-assembly body of the interrupt handler, have to
be very conservative and save the [entire CPU state to the stack
frame][full-frame-save]. By instead asking LLVM to only save the
registers that it uses, we defer the decision to the tool with the best
context: it can more accurately account for the cost of spills if it
knows that every additional register used is already at the cost of an
implicit spill.

At the LLVM level, this is apparently [implemented by] marking every
register as "[callee-save]," matching the semantics of an interrupt
handler nicely (it has to leave the CPU state just as it found it after
its `{m|s}ret`).

This approach is not suitable for every interrupt handler, as it makes
no attempt to e.g. save the state in a user-accessible stack frame. For
a full discussion of those challenges and tradeoffs, please refer to
[the interrupt calling conventions RFC][rfc].

Inside rustc, this implementation differs from prior art because LLVM
does not expose the "all-saved" function flavor as a calling convention
directly, instead preferring to use an attribute that allows for
differentiating between "machine-mode" and "superivsor-mode" interrupts.

Finally, some effort has been made to guide those who may not yet be
aware of the differences between machine-mode and supervisor-mode
interrupts as to why no `riscv-interrupt` calling convention is exposed
through rustc, and similarly for why `riscv-interrupt-u` makes no
appearance (as it would complicate future LLVM upgrades).

[clang-attr]: https://clang.llvm.org/docs/AttributeReference.html#interrupt-risc-v
[full-frame-save]: 9281af2ecf/src/lib.rs (L440-L469)
[implemented by]: b7fb2a3fec/llvm/lib/Target/RISCV/RISCVRegisterInfo.cpp (L61-L67)
[callee-save]: 973f1fe7a8/llvm/lib/Target/RISCV/RISCVCallingConv.td (L30-L37)
[rfc]: https://github.com/rust-lang/rfcs/pull/3246
2023-08-08 18:09:56 -07:00
..
auxiliary tidy check to find misc files in ui tests, and clean up the results 2023-05-09 20:35:39 -04:00
allow-features-empty.rs
allow-features-empty.stderr
allow-features.rs
allow-features.stderr
bench.rs
bench.stderr
duplicate-features.rs
duplicate-features.stderr
feature-gate-abi_amdgpu_kernel.rs
feature-gate-abi_amdgpu_kernel.stderr
feature-gate-abi_ptx.rs
feature-gate-abi_ptx.stderr
feature-gate-abi_unadjusted.rs
feature-gate-abi_unadjusted.stderr
feature-gate-abi-avr-interrupt.rs
feature-gate-abi-avr-interrupt.stderr
feature-gate-abi-msp430-interrupt.rs
feature-gate-abi-msp430-interrupt.stderr
feature-gate-abi-riscv-interrupt.rs feat: riscv-interrupt-{m,s} calling conventions 2023-08-08 18:09:56 -07:00
feature-gate-abi-riscv-interrupt.stderr feat: riscv-interrupt-{m,s} calling conventions 2023-08-08 18:09:56 -07:00
feature-gate-abi-x86-interrupt.rs
feature-gate-abi-x86-interrupt.stderr
feature-gate-abi.rs
feature-gate-abi.stderr
feature-gate-adt_const_params.rs
feature-gate-adt_const_params.stderr
feature-gate-alloc-error-handler.rs Revert "Remove #[alloc_error_handler] from the compiler and library" 2023-04-25 00:08:35 +02:00
feature-gate-alloc-error-handler.stderr Revert "Remove #[alloc_error_handler] from the compiler and library" 2023-04-25 00:08:35 +02:00
feature-gate-allocator_internals.rs
feature-gate-allocator_internals.stderr
feature-gate-allow-internal-unsafe-nested-macro.rs
feature-gate-allow-internal-unsafe-nested-macro.stderr
feature-gate-allow-internal-unstable-nested-macro.rs
feature-gate-allow-internal-unstable-nested-macro.stderr
feature-gate-allow-internal-unstable-struct.rs
feature-gate-allow-internal-unstable-struct.stderr
feature-gate-allow-internal-unstable.rs
feature-gate-allow-internal-unstable.stderr
feature-gate-arbitrary_self_types-raw-pointer.rs
feature-gate-arbitrary_self_types-raw-pointer.stderr
feature-gate-arbitrary-self-types.rs
feature-gate-arbitrary-self-types.stderr
feature-gate-asm_const.rs
feature-gate-asm_const.stderr
feature-gate-asm_experimental_arch.rs
feature-gate-asm_experimental_arch.stderr
feature-gate-asm_unwind.rs
feature-gate-asm_unwind.stderr
feature-gate-assoc-type-defaults.rs
feature-gate-assoc-type-defaults.stderr
feature-gate-associated_const_equality.rs
feature-gate-associated_const_equality.stderr
feature-gate-associated_type_bounds.rs
feature-gate-associated_type_bounds.stderr
feature-gate-auto-traits.rs
feature-gate-auto-traits.stderr
feature-gate-box_patterns.rs
feature-gate-box_patterns.stderr
feature-gate-builtin_syntax.rs Add feature gate 2023-05-05 21:44:48 +02:00
feature-gate-builtin_syntax.stderr Add feature gate 2023-05-05 21:44:48 +02:00
feature-gate-c_variadic.rs
feature-gate-c_variadic.stderr
feature-gate-cfg_overflow_checks.rs Add support for cfg(overflow_checks) 2023-05-11 18:06:31 +04:00
feature-gate-cfg_overflow_checks.stderr Add support for cfg(overflow_checks) 2023-05-11 18:06:31 +04:00
feature-gate-cfg_sanitize.rs
feature-gate-cfg_sanitize.stderr
feature-gate-cfg-target-abi.rs
feature-gate-cfg-target-abi.stderr
feature-gate-cfg-target-compact.rs
feature-gate-cfg-target-compact.stderr
feature-gate-cfg-target-has-atomic-equal-alignment.rs
feature-gate-cfg-target-has-atomic-equal-alignment.stderr
feature-gate-cfg-target-has-atomic.rs
feature-gate-cfg-target-has-atomic.stderr
feature-gate-cfg-target-thread-local.rs
feature-gate-cfg-target-thread-local.stderr
feature-gate-cfg-version.rs
feature-gate-cfg-version.stderr
feature-gate-cfi_encoding.rs Add cross-language LLVM CFI support to the Rust compiler 2023-05-03 22:41:29 +00:00
feature-gate-cfi_encoding.stderr Add cross-language LLVM CFI support to the Rust compiler 2023-05-03 22:41:29 +00:00
feature-gate-check-cfg.rs
feature-gate-check-cfg.stderr
feature-gate-closure_lifetime_binder.rs
feature-gate-closure_lifetime_binder.stderr
feature-gate-closure_track_caller.rs
feature-gate-closure_track_caller.stderr
feature-gate-collapse_debuginfo.rs
feature-gate-collapse_debuginfo.stderr
feature-gate-compiler-builtins.rs
feature-gate-compiler-builtins.stderr
feature-gate-concat_bytes.rs
feature-gate-concat_bytes.stderr
feature-gate-concat_idents2.rs
feature-gate-concat_idents2.stderr
feature-gate-concat_idents3.rs
feature-gate-concat_idents3.stderr
feature-gate-concat_idents.rs
feature-gate-concat_idents.stderr
feature-gate-const_refs_to_cell.rs
feature-gate-const-indexing.rs
feature-gate-custom_attribute2.rs
feature-gate-custom_attribute2.stderr
feature-gate-custom_attribute.rs
feature-gate-custom_attribute.stderr
feature-gate-custom_mir.rs
feature-gate-custom_mir.stderr
feature-gate-custom_test_frameworks.rs
feature-gate-custom_test_frameworks.stderr
feature-gate-decl_macro.rs
feature-gate-decl_macro.stderr
feature-gate-default_type_parameter_fallback.rs
feature-gate-default_type_parameter_fallback.stderr
feature-gate-deprecated_safe.rs
feature-gate-deprecated_safe.stderr
feature-gate-dispatch-from-dyn-cell.rs
feature-gate-dispatch-from-dyn-cell.stderr
feature-gate-dispatch-from-dyn-missing-impl.rs
feature-gate-dispatch-from-dyn-missing-impl.stderr Note base types of coercion 2023-05-12 00:10:52 +00:00
feature-gate-doc_cfg.rs
feature-gate-doc_cfg.stderr
feature-gate-doc_masked.rs
feature-gate-doc_masked.stderr
feature-gate-doc_notable_trait.rs
feature-gate-doc_notable_trait.stderr
feature-gate-exclusive-range-pattern.rs
feature-gate-exclusive-range-pattern.stderr
feature-gate-exhaustive-patterns.rs
feature-gate-exhaustive-patterns.stderr
feature-gate-explicit_tail_calls.rs Syntatically accept become expressions 2023-06-19 12:54:34 +00:00
feature-gate-explicit_tail_calls.stderr Syntatically accept become expressions 2023-06-19 12:54:34 +00:00
feature-gate-extern_absolute_paths.rs
feature-gate-extern_absolute_paths.stderr adjust smart_resolve_partial_mod_path_errors 2023-07-07 10:19:30 +08:00
feature-gate-extern_prelude.rs
feature-gate-extern_prelude.stderr
feature-gate-extern_types.rs
feature-gate-extern_types.stderr
feature-gate-feature-gate.rs
feature-gate-feature-gate.stderr
feature-gate-ffi_const.rs
feature-gate-ffi_const.stderr
feature-gate-ffi_pure.rs
feature-gate-ffi_pure.stderr
feature-gate-ffi_returns_twice.rs
feature-gate-ffi_returns_twice.stderr
feature-gate-fn_align.rs
feature-gate-fn_align.stderr
feature-gate-format_args_nl.rs
feature-gate-format_args_nl.stderr
feature-gate-fundamental.rs
feature-gate-fundamental.stderr
feature-gate-generators.rs
feature-gate-generators.stderr
feature-gate-generic_arg_infer.normal.stderr
feature-gate-generic_arg_infer.rs Adjust UI tests for unit_bindings 2023-06-12 20:24:48 +08:00
feature-gate-generic_associated_types_extended.rs
feature-gate-generic_associated_types_extended.stderr
feature-gate-impl_trait_in_assoc_type.rs Split out a separate feature gate for impl trait in associated types 2023-04-12 16:17:31 +00:00
feature-gate-impl_trait_in_assoc_type.stderr Split out a separate feature gate for impl trait in associated types 2023-04-12 16:17:31 +00:00
feature-gate-impl_trait_in_fn_trait_return.rs
feature-gate-impl_trait_in_fn_trait_return.stderr
feature-gate-imported_main.rs
feature-gate-imported_main.stderr
feature-gate-inherent_associated_types.rs
feature-gate-inherent_associated_types.stderr
feature-gate-inline_const_pat.rs
feature-gate-inline_const_pat.stderr
feature-gate-inline_const.rs
feature-gate-inline_const.stderr
feature-gate-intrinsics.rs
feature-gate-intrinsics.stderr
feature-gate-is_sorted.rs
feature-gate-is_sorted.stderr
feature-gate-lang-items.rs
feature-gate-lang-items.stderr
feature-gate-large-assignments.rs
feature-gate-large-assignments.stderr
feature-gate-link_cfg.rs
feature-gate-link_cfg.stderr
feature-gate-link_llvm_intrinsics.rs
feature-gate-link_llvm_intrinsics.stderr
feature-gate-linkage.rs
feature-gate-linkage.stderr
feature-gate-lint-reasons.rs
feature-gate-lint-reasons.stderr
feature-gate-log_syntax2.rs
feature-gate-log_syntax2.stderr
feature-gate-log_syntax2.stdout
feature-gate-log_syntax.rs
feature-gate-log_syntax.stderr
feature-gate-log_syntax.stdout
feature-gate-marker_trait_attr.rs
feature-gate-marker_trait_attr.stderr
feature-gate-may-dangle.rs
feature-gate-may-dangle.stderr
feature-gate-min_const_fn.rs
feature-gate-min_const_fn.stderr
feature-gate-more-qualified-paths.rs
feature-gate-more-qualified-paths.stderr
feature-gate-multiple_supertrait_upcastable.rs
feature-gate-multiple_supertrait_upcastable.stderr
feature-gate-naked_functions.rs
feature-gate-naked_functions.stderr
feature-gate-native_link_modifiers_as_needed.rs
feature-gate-native_link_modifiers_as_needed.stderr
feature-gate-needs-allocator.rs
feature-gate-needs-allocator.stderr
feature-gate-negate-unsigned.rs
feature-gate-negate-unsigned.stderr
feature-gate-negative_bounds.rs Implement negative bounds 2023-05-02 22:36:24 +00:00
feature-gate-negative_bounds.stderr Implement negative bounds 2023-05-02 22:36:24 +00:00
feature-gate-never_type.rs
feature-gate-never_type.stderr
feature-gate-no_core.rs
feature-gate-no_core.stderr
feature-gate-no_coverage.rs
feature-gate-no_coverage.stderr
feature-gate-no_sanitize.rs
feature-gate-no_sanitize.stderr
feature-gate-non_exhaustive_omitted_patterns_lint.rs
feature-gate-non_exhaustive_omitted_patterns_lint.stderr
feature-gate-non_lifetime_binders.rs
feature-gate-non_lifetime_binders.stderr
feature-gate-object_safe_for_dispatch.rs
feature-gate-object_safe_for_dispatch.stderr
feature-gate-omit-gdb-pretty-printer-section.rs
feature-gate-omit-gdb-pretty-printer-section.stderr
feature-gate-optimize_attribute.rs
feature-gate-optimize_attribute.stderr
feature-gate-overlapping_marker_traits.rs
feature-gate-overlapping_marker_traits.stderr
feature-gate-precise_pointer_size_matching.rs
feature-gate-precise_pointer_size_matching.stderr
feature-gate-prelude_import.rs
feature-gate-prelude_import.stderr
feature-gate-profiler-runtime.rs
feature-gate-profiler-runtime.stderr
feature-gate-public_private_dependencies.rs
feature-gate-register_tool.rs
feature-gate-register_tool.stderr
feature-gate-repr128.rs
feature-gate-repr128.stderr
feature-gate-repr-simd.rs
feature-gate-repr-simd.stderr
feature-gate-return_position_impl_trait_in_trait.rs
feature-gate-return_position_impl_trait_in_trait.stderr
feature-gate-return_type_notation.cfg_current.stderr Fix associated type suggestion when -Zlower-impl-trait-in-trait-to-assoc-ty 2023-06-23 18:23:52 -03:00
feature-gate-return_type_notation.cfg_next.stderr Fix associated type suggestion when -Zlower-impl-trait-in-trait-to-assoc-ty 2023-06-23 18:23:52 -03:00
feature-gate-return_type_notation.cfg.stderr Mark RPITIT and AFIT as no longer incomplete 2023-05-02 05:04:50 +00:00
feature-gate-return_type_notation.no_current.stderr Fix associated type suggestion when -Zlower-impl-trait-in-trait-to-assoc-ty 2023-06-23 18:23:52 -03:00
feature-gate-return_type_notation.no_next.stderr Fix associated type suggestion when -Zlower-impl-trait-in-trait-to-assoc-ty 2023-06-23 18:23:52 -03:00
feature-gate-return_type_notation.no.stderr Mark RPITIT and AFIT as no longer incomplete 2023-05-02 05:04:50 +00:00
feature-gate-return_type_notation.rs Replace RPITIT current impl with new strategy that lowers as a GAT 2023-07-08 18:21:34 -03:00
feature-gate-rust_cold_cc.rs
feature-gate-rust_cold_cc.stderr
feature-gate-rustc_const_unstable.rs
feature-gate-rustc_const_unstable.stderr
feature-gate-rustc-allow-const-fn-unstable.rs
feature-gate-rustc-allow-const-fn-unstable.stderr
feature-gate-rustc-attrs-1.rs
feature-gate-rustc-attrs-1.stderr
feature-gate-rustc-attrs.rs
feature-gate-rustc-attrs.stderr
feature-gate-rustdoc_internals.rs
feature-gate-rustdoc_internals.stderr
feature-gate-simd-ffi.rs
feature-gate-simd-ffi.stderr
feature-gate-simd.rs
feature-gate-simd.stderr
feature-gate-staged_api.rs
feature-gate-staged_api.stderr
feature-gate-start.rs
feature-gate-start.stderr
feature-gate-stmt_expr_attributes.rs
feature-gate-stmt_expr_attributes.stderr
feature-gate-strict_provenance.rs
feature-gate-strict_provenance.stderr
feature-gate-test_unstable_lint.rs
feature-gate-test_unstable_lint.stderr
feature-gate-thread_local.rs
feature-gate-thread_local.stderr
feature-gate-trace_macros.rs
feature-gate-trace_macros.stderr
feature-gate-trait_upcasting.rs
feature-gate-trait_upcasting.stderr
feature-gate-trait-alias.rs
feature-gate-trait-alias.stderr
feature-gate-transparent_unions.rs
feature-gate-transparent_unions.stderr
feature-gate-trivial_bounds-lint.rs
feature-gate-trivial_bounds.rs
feature-gate-trivial_bounds.stderr
feature-gate-try_blocks.rs
feature-gate-try_blocks.stderr
feature-gate-type_alias_impl_trait.rs Require TAITs to be mentioned in the signatures of functions that register hidden types for them 2023-07-07 13:13:18 +00:00
feature-gate-type_ascription.rs Rip it out 2023-05-01 16:15:13 +08:00
feature-gate-type_ascription.stderr Rip it out 2023-05-01 16:15:13 +08:00
feature-gate-type_privacy_lints.rs privacy: Feature gate new type privacy lints 2023-06-15 21:25:47 +03:00
feature-gate-type_privacy_lints.stderr privacy: Feature gate new type privacy lints 2023-06-15 21:25:47 +03:00
feature-gate-unboxed-closures-manual-impls.rs
feature-gate-unboxed-closures-manual-impls.stderr
feature-gate-unboxed-closures-method-calls.rs
feature-gate-unboxed-closures-method-calls.stderr
feature-gate-unboxed-closures-ufcs-calls.rs
feature-gate-unboxed-closures-ufcs-calls.stderr
feature-gate-unboxed-closures.rs
feature-gate-unboxed-closures.stderr
feature-gate-unix_sigpipe.rs
feature-gate-unix_sigpipe.stderr
feature-gate-unsafe_pin_internals.rs Add internal_features lint 2023-08-03 14:50:50 +02:00
feature-gate-unsafe_pin_internals.stderr Add internal_features lint 2023-08-03 14:50:50 +02:00
feature-gate-unsized_fn_params.rs
feature-gate-unsized_fn_params.stderr
feature-gate-unsized_locals.rs
feature-gate-unsized_locals.stderr
feature-gate-unsized_tuple_coercion.rs
feature-gate-unsized_tuple_coercion.stderr
feature-gate-used_with_arg.rs
feature-gate-used_with_arg.stderr
feature-gate-vectorcall.rs Update tests 2023-04-29 13:01:46 +01:00
feature-gate-vectorcall.stderr
feature-gate-wasm_abi.rs
feature-gate-wasm_abi.stderr
feature-gate-with_negative_coherence.rs
feature-gate-with_negative_coherence.stderr
feature-gate-yeet_expr-in-cfg.rs
feature-gate-yeet_expr-in-cfg.stderr
feature-gate-yeet_expr.rs
feature-gate-yeet_expr.stderr
feature-gated-feature-in-macro-arg.rs
feature-gated-feature-in-macro-arg.stderr
gated-bad-feature.rs
gated-bad-feature.stderr
issue-43106-gating-of-bench.rs
issue-43106-gating-of-bench.stderr
issue-43106-gating-of-builtin-attrs-error.rs
issue-43106-gating-of-builtin-attrs-error.stderr
issue-43106-gating-of-builtin-attrs.rs
issue-43106-gating-of-builtin-attrs.stderr
issue-43106-gating-of-deprecated.rs
issue-43106-gating-of-derive-2.rs
issue-43106-gating-of-derive-2.stderr
issue-43106-gating-of-derive.rs
issue-43106-gating-of-derive.stderr
issue-43106-gating-of-macro_escape.rs
issue-43106-gating-of-macro_escape.stderr
issue-43106-gating-of-macro_use.rs
issue-43106-gating-of-macro_use.stderr
issue-43106-gating-of-proc_macro_derive.rs
issue-43106-gating-of-proc_macro_derive.stderr
issue-43106-gating-of-stable.rs
issue-43106-gating-of-stable.stderr
issue-43106-gating-of-test.rs
issue-43106-gating-of-test.stderr
issue-43106-gating-of-unstable.rs
issue-43106-gating-of-unstable.stderr
issue-49983-see-issue-0.rs
issue-49983-see-issue-0.stderr
print-with-path.cfg.stderr Make --print KIND=PATH unstable 2023-07-27 19:05:17 +02:00
print-with-path.rs Make --print KIND=PATH unstable 2023-07-27 19:05:17 +02:00
print-with-path.target-cpus.stderr Make --print KIND=PATH unstable 2023-07-27 19:05:17 +02:00
print-with-path.target-features.stderr Make --print KIND=PATH unstable 2023-07-27 19:05:17 +02:00
rustc-private.rs
rustc-private.stderr
soft-syntax-gates-with-errors.rs
soft-syntax-gates-with-errors.stderr
soft-syntax-gates-without-errors.rs
soft-syntax-gates-without-errors.stderr
stability-attribute-consistency.rs
stability-attribute-consistency.stderr
stable-features.rs
stable-features.stderr
test-listing-format-json.rs update tests for the test harness's json formatting 2023-04-21 15:34:38 +02:00
test-listing-format-json.run.stderr update tests for the test harness's json formatting 2023-04-21 15:34:38 +02:00
trace_macros-gate.rs
trace_macros-gate.stderr
unknown-feature.rs
unknown-feature.stderr
unstable-attribute-allow-issue-0.rs
unstable-attribute-allow-issue-0.stderr