diff options
| author | Gus Caplan <me@gus.host> | 2020-11-02 14:59:45 -0600 |
|---|---|---|
| committer | Gus Caplan <me@gus.host> | 2020-12-01 12:18:21 -0600 |
| commit | d9f237caa6a90fd6581124a3627af55e9c2a0f22 (patch) | |
| tree | 6e30789de9d739fb7387b88ebc093a6c764253e0 /compiler/rustc_target/src/asm/wasm.rs | |
| parent | 8a929386588be941659f4b6f454d200253b2eadc (diff) | |
| download | rust-d9f237caa6a90fd6581124a3627af55e9c2a0f22.tar.gz rust-d9f237caa6a90fd6581124a3627af55e9c2a0f22.zip | |
Add wasm32 support to inline asm
Diffstat (limited to 'compiler/rustc_target/src/asm/wasm.rs')
| -rw-r--r-- | compiler/rustc_target/src/asm/wasm.rs | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/compiler/rustc_target/src/asm/wasm.rs b/compiler/rustc_target/src/asm/wasm.rs new file mode 100644 index 00000000000..1b33f8f9632 --- /dev/null +++ b/compiler/rustc_target/src/asm/wasm.rs @@ -0,0 +1,46 @@ +use super::{InlineAsmArch, InlineAsmType}; +use rustc_macros::HashStable_Generic; + +def_reg_class! { + Wasm WasmInlineAsmRegClass { + local, + } +} + +impl WasmInlineAsmRegClass { + pub fn valid_modifiers(self, _arch: super::InlineAsmArch) -> &'static [char] { + &[] + } + + pub fn suggest_class(self, _arch: InlineAsmArch, _ty: InlineAsmType) -> Option<Self> { + None + } + + pub fn suggest_modifier( + self, + _arch: InlineAsmArch, + _ty: InlineAsmType, + ) -> Option<(char, &'static str)> { + None + } + + pub fn default_modifier(self, _arch: InlineAsmArch) -> Option<(char, &'static str)> { + None + } + + pub fn supported_types( + self, + _arch: InlineAsmArch, + ) -> &'static [(InlineAsmType, Option<&'static str>)] { + match self { + Self::local => { + types! { _: I8, I16, I32, I64, F32, F64; } + } + } + } +} + +def_regs! { + // WebAssembly doesn't have registers. + Wasm WasmInlineAsmReg WasmInlineAsmRegClass {} +} |
