rust/compiler
Mara Bos 76fa5f25ab
Rollup merge of #78950 - khyperia:spirv-asm, r=Amanieu
Add asm register information for SPIR-V

As discussed in [zulip](https://rust-lang.zulipchat.com/#narrow/stream/182449-t-compiler.2Fhelp/topic/Defining.20asm!.20for.20new.20architecture), we at [rust-gpu](https://github.com/EmbarkStudios/rust-gpu) would like to support `asm!` for our SPIR-V backend. However, we cannot do so purely without frontend support: [this match](d4ea0b3e46/compiler/rustc_target/src/asm/mod.rs (L185)) fails and so `asm!` is not supported ([error reported here](d4ea0b3e46/compiler/rustc_ast_lowering/src/expr.rs (L1095))). To resolve this, we need to stub out register information for SPIR-V to support getting the `asm!` content all the way to [`AsmBuilderMethods::codegen_inline_asm`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_codegen_ssa/traits/trait.AsmBuilderMethods.html#tymethod.codegen_inline_asm), at which point the rust-gpu backend can do all the parsing and codegen that is needed.

This is a pretty weird PR - adding support for a backend that isn't in-tree feels pretty gross to me, but I don't see an easy way around this. ``@Amanieu`` said I should submit it anyway, so, here we are! Let me know if this needs to go through a more formal process (MCP?) and what I should do to help this along.

I based this off the [wasm asm PR](https://github.com/rust-lang/rust/pull/78684), which unfortunately this PR conflicts with that one quite a bit, sorry for any merge conflict pain :(

---

Some open questions:

- What do we call the register class? Some context, SPIR-V is an SSA-based IR, there are "instructions" that create IDs (referred to as `<id>` in the spec), which can be referenced by other instructions. So, `reg` isn't exactly accurate, they're SSA IDs, not re-assignable registers.
- What happens when a SPIR-V register gets to the LLVM backend? Right now it's a `bug!`, but should that be a `sess.fatal()`? I'm not sure if it's even possible to reach that point, maybe there's a check that prevents the `spirv` target from even reaching that codepath.
2020-11-12 19:46:14 +01:00
..
rustc
rustc_apfloat
rustc_arena Fix even more clippy warnings 2020-10-30 10:13:39 -04:00
rustc_ast Rollup merge of #78836 - fanzier:struct-and-slice-destructuring, r=petrochenkov 2020-11-12 19:46:09 +01:00
rustc_ast_lowering Rollup merge of #78836 - fanzier:struct-and-slice-destructuring, r=petrochenkov 2020-11-12 19:46:09 +01:00
rustc_ast_passes Rollup merge of #78836 - fanzier:struct-and-slice-destructuring, r=petrochenkov 2020-11-12 19:46:09 +01:00
rustc_ast_pretty Rollup merge of #78836 - fanzier:struct-and-slice-destructuring, r=petrochenkov 2020-11-12 19:46:09 +01:00
rustc_attr Improve deprecation attribute diagnostic messages. 2020-11-02 13:21:18 +01:00
rustc_builtin_macros Changed unwrap_or to unwrap_or_else in some places. 2020-11-10 20:07:47 -08:00
rustc_codegen_cranelift Changed unwrap_or to unwrap_or_else in some places. 2020-11-10 20:07:47 -08:00
rustc_codegen_llvm Rollup merge of #78950 - khyperia:spirv-asm, r=Amanieu 2020-11-12 19:46:14 +01:00
rustc_codegen_ssa Rollup merge of #78875 - petrochenkov:cleantarg, r=Mark-Simulacrum 2020-11-10 14:45:21 +01:00
rustc_data_structures Move post order walk to iterative approach 2020-10-31 18:52:00 +01:00
rustc_driver Enable thread names in debug logging only for parallel_compiler 2020-11-11 13:28:30 -05:00
rustc_error_codes deny(invalid_codeblock_attributes) 2020-11-05 12:13:28 -05:00
rustc_errors Auto merge of #76931 - oli-obk:const_prop_inline_lint_madness, r=wesleywiser 2020-11-03 16:32:34 +00:00
rustc_expand Rollup merge of #78836 - fanzier:struct-and-slice-destructuring, r=petrochenkov 2020-11-12 19:46:09 +01:00
rustc_feature Add #[cfg(panic = "...")] 2020-11-09 15:30:49 +00:00
rustc_fs_util
rustc_graphviz Rust coverage before splitting instrument_coverage.rs 2020-11-05 18:24:12 -08:00
rustc_hir Rollup merge of #78836 - fanzier:struct-and-slice-destructuring, r=petrochenkov 2020-11-12 19:46:09 +01:00
rustc_hir_pretty Fix even more clippy warnings 2020-10-30 10:13:39 -04:00
rustc_incremental Delete files immediately, instead of collecting into vector 2020-10-28 17:22:10 +01:00
rustc_index
rustc_infer Rollup merge of #76765 - guswynn:async_return, r=tmandry 2020-11-10 14:45:09 +01:00
rustc_interface Add flags customizing behaviour of MIR inlining 2020-11-10 00:00:00 +00:00
rustc_lexer Add back missing comments 2020-10-30 10:13:41 -04:00
rustc_lint Rollup merge of #78710 - petrochenkov:macvisit, r=davidtwco 2020-11-09 19:06:55 +01:00
rustc_lint_defs Rollup merge of #78114 - jyn514:private, r=oli-obk 2020-11-09 01:13:31 +01:00
rustc_llvm Rollup merge of #77950 - arlosi:sha256, r=eddyb 2020-11-03 19:32:26 +01:00
rustc_macros Small cleanup in TypeFoldable derive macro 2020-11-07 18:20:42 +01:00
rustc_metadata Changed unwrap_or to unwrap_or_else in some places. 2020-11-10 20:07:47 -08:00
rustc_middle Auto merge of #78782 - petrochenkov:nodoctok, r=Aaron1011 2020-11-12 00:33:55 +00:00
rustc_mir Rollup merge of #78899 - tmiasko:inline-diverging, r=oli-obk 2020-11-11 20:59:05 +01:00
rustc_mir_build Rollup merge of #78748 - fanzier:tuple-assignment, r=petrochenkov 2020-11-09 01:13:44 +01:00
rustc_parse Rollup merge of #78836 - fanzier:struct-and-slice-destructuring, r=petrochenkov 2020-11-12 19:46:09 +01:00
rustc_parse_format
rustc_passes Rollup merge of #78875 - petrochenkov:cleantarg, r=Mark-Simulacrum 2020-11-10 14:45:21 +01:00
rustc_plugin_impl
rustc_privacy Fix even more URLs 2020-11-05 20:11:29 +01:00
rustc_query_system Fix even more clippy warnings 2020-10-30 10:13:39 -04:00
rustc_resolve Implement destructuring assignment for structs and slices 2020-11-11 12:10:52 +00:00
rustc_save_analysis Implement destructuring assignment for structs and slices 2020-11-11 12:10:52 +00:00
rustc_serialize
rustc_session Rollup merge of #78873 - tmiasko:inline-opts, r=oli-obk 2020-11-11 20:59:03 +01:00
rustc_span Auto merge of #76256 - tgnottingham:issue-74890, r=nikomatsakis 2020-11-12 15:34:09 +00:00
rustc_symbol_mangling u128 truncation and sign extension are not just interpreter related 2020-11-04 13:41:58 +00:00
rustc_target Rollup merge of #78950 - khyperia:spirv-asm, r=Amanieu 2020-11-12 19:46:14 +01:00
rustc_trait_selection Rollup merge of #78832 - lcnr:const-evaluatable-unevaluated, r=oli-obk 2020-11-11 20:59:02 +01:00
rustc_traits Rollup merge of #78502 - matthewjasper:chalkup, r=nikomatsakis 2020-11-09 19:06:46 +01:00
rustc_ty
rustc_typeck Changed unwrap_or to unwrap_or_else in some places. 2020-11-10 20:07:47 -08:00