]> git.proxmox.com Git - rustc.git/blame - compiler/rustc_codegen_ssa/src/traits/asm.rs
New upstream version 1.57.0+dfsg1
[rustc.git] / compiler / rustc_codegen_ssa / src / traits / asm.rs
CommitLineData
a1dfa0c6 1use super::BackendTypes;
f9f354fc 2use crate::mir::operand::OperandRef;
9fa01778 3use crate::mir::place::PlaceRef;
3dfed10e 4use rustc_ast::{InlineAsmOptions, InlineAsmTemplatePiece};
f9f354fc 5use rustc_hir::def_id::DefId;
17df50a5 6use rustc_hir::LlvmInlineAsmInner;
f9f354fc 7use rustc_middle::ty::Instance;
dfeec247 8use rustc_span::Span;
f9f354fc
XL
9use rustc_target::asm::InlineAsmRegOrRegClass;
10
11#[derive(Debug)]
12pub enum InlineAsmOperandRef<'tcx, B: BackendTypes + ?Sized> {
13 In {
14 reg: InlineAsmRegOrRegClass,
15 value: OperandRef<'tcx, B::Value>,
16 },
17 Out {
18 reg: InlineAsmRegOrRegClass,
19 late: bool,
20 place: Option<PlaceRef<'tcx, B::Value>>,
21 },
22 InOut {
23 reg: InlineAsmRegOrRegClass,
24 late: bool,
25 in_value: OperandRef<'tcx, B::Value>,
26 out_place: Option<PlaceRef<'tcx, B::Value>>,
27 },
28 Const {
29 string: String,
30 },
31 SymFn {
32 instance: Instance<'tcx>,
33 },
34 SymStatic {
35 def_id: DefId,
36 },
37}
7cac9316 38
17df50a5
XL
39#[derive(Debug)]
40pub enum GlobalAsmOperandRef {
41 Const { string: String },
42}
43
a1dfa0c6
XL
44pub trait AsmBuilderMethods<'tcx>: BackendTypes {
45 /// Take an inline assembly expression and splat it out via LLVM
ba9703b0 46 fn codegen_llvm_inline_asm(
a1dfa0c6 47 &mut self,
ba9703b0 48 ia: &LlvmInlineAsmInner,
a1dfa0c6
XL
49 outputs: Vec<PlaceRef<'tcx, Self::Value>>,
50 inputs: Vec<Self::Value>,
e1599b0c 51 span: Span,
a1dfa0c6 52 ) -> bool;
f9f354fc
XL
53
54 /// Take an inline assembly expression and splat it out via LLVM
55 fn codegen_inline_asm(
56 &mut self,
57 template: &[InlineAsmTemplatePiece],
58 operands: &[InlineAsmOperandRef<'tcx, Self>],
59 options: InlineAsmOptions,
60 line_spans: &[Span],
61 );
83c7162d 62}
a7813a04 63
dc9dc135 64pub trait AsmMethods {
17df50a5
XL
65 fn codegen_global_asm(
66 &self,
67 template: &[InlineAsmTemplatePiece],
68 operands: &[GlobalAsmOperandRef],
69 options: InlineAsmOptions,
70 line_spans: &[Span],
71 );
54a0048b 72}