]>
Commit | Line | Data |
---|---|---|
a1dfa0c6 | 1 | use super::BackendTypes; |
f9f354fc | 2 | use crate::mir::operand::OperandRef; |
9fa01778 | 3 | use crate::mir::place::PlaceRef; |
3dfed10e | 4 | use rustc_ast::{InlineAsmOptions, InlineAsmTemplatePiece}; |
f9f354fc | 5 | use rustc_hir::def_id::DefId; |
f9f354fc | 6 | use rustc_middle::ty::Instance; |
dfeec247 | 7 | use rustc_span::Span; |
f9f354fc XL |
8 | use rustc_target::asm::InlineAsmRegOrRegClass; |
9 | ||
10 | #[derive(Debug)] | |
11 | pub enum InlineAsmOperandRef<'tcx, B: BackendTypes + ?Sized> { | |
12 | In { | |
13 | reg: InlineAsmRegOrRegClass, | |
14 | value: OperandRef<'tcx, B::Value>, | |
15 | }, | |
16 | Out { | |
17 | reg: InlineAsmRegOrRegClass, | |
18 | late: bool, | |
19 | place: Option<PlaceRef<'tcx, B::Value>>, | |
20 | }, | |
21 | InOut { | |
22 | reg: InlineAsmRegOrRegClass, | |
23 | late: bool, | |
24 | in_value: OperandRef<'tcx, B::Value>, | |
25 | out_place: Option<PlaceRef<'tcx, B::Value>>, | |
26 | }, | |
27 | Const { | |
28 | string: String, | |
29 | }, | |
30 | SymFn { | |
31 | instance: Instance<'tcx>, | |
32 | }, | |
33 | SymStatic { | |
34 | def_id: DefId, | |
35 | }, | |
36 | } | |
7cac9316 | 37 | |
17df50a5 XL |
38 | #[derive(Debug)] |
39 | pub enum GlobalAsmOperandRef { | |
40 | Const { string: String }, | |
41 | } | |
42 | ||
a1dfa0c6 | 43 | pub trait AsmBuilderMethods<'tcx>: BackendTypes { |
f9f354fc XL |
44 | /// Take an inline assembly expression and splat it out via LLVM |
45 | fn codegen_inline_asm( | |
46 | &mut self, | |
47 | template: &[InlineAsmTemplatePiece], | |
48 | operands: &[InlineAsmOperandRef<'tcx, Self>], | |
49 | options: InlineAsmOptions, | |
50 | line_spans: &[Span], | |
3c0e092e | 51 | instance: Instance<'_>, |
a2a8927a | 52 | dest_catch_funclet: Option<(Self::BasicBlock, Self::BasicBlock, Option<&Self::Funclet>)>, |
f9f354fc | 53 | ); |
83c7162d | 54 | } |
a7813a04 | 55 | |
dc9dc135 | 56 | pub trait AsmMethods { |
17df50a5 XL |
57 | fn codegen_global_asm( |
58 | &self, | |
59 | template: &[InlineAsmTemplatePiece], | |
60 | operands: &[GlobalAsmOperandRef], | |
61 | options: InlineAsmOptions, | |
62 | line_spans: &[Span], | |
63 | ); | |
54a0048b | 64 | } |