]> git.proxmox.com Git - rustc.git/blame - compiler/rustc_codegen_ssa/src/traits/asm.rs
New upstream version 1.62.1+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;
f9f354fc 6use rustc_middle::ty::Instance;
dfeec247 7use rustc_span::Span;
f9f354fc
XL
8use rustc_target::asm::InlineAsmRegOrRegClass;
9
10#[derive(Debug)]
11pub 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 38#[derive(Debug)]
04454e1e 39pub enum GlobalAsmOperandRef<'tcx> {
17df50a5 40 Const { string: String },
04454e1e
FG
41 SymFn { instance: Instance<'tcx> },
42 SymStatic { def_id: DefId },
17df50a5
XL
43}
44
a1dfa0c6 45pub trait AsmBuilderMethods<'tcx>: BackendTypes {
f9f354fc
XL
46 /// Take an inline assembly expression and splat it out via LLVM
47 fn codegen_inline_asm(
48 &mut self,
49 template: &[InlineAsmTemplatePiece],
50 operands: &[InlineAsmOperandRef<'tcx, Self>],
51 options: InlineAsmOptions,
52 line_spans: &[Span],
3c0e092e 53 instance: Instance<'_>,
a2a8927a 54 dest_catch_funclet: Option<(Self::BasicBlock, Self::BasicBlock, Option<&Self::Funclet>)>,
f9f354fc 55 );
83c7162d 56}
a7813a04 57
04454e1e 58pub trait AsmMethods<'tcx> {
17df50a5
XL
59 fn codegen_global_asm(
60 &self,
61 template: &[InlineAsmTemplatePiece],
04454e1e 62 operands: &[GlobalAsmOperandRef<'tcx>],
17df50a5
XL
63 options: InlineAsmOptions,
64 line_spans: &[Span],
65 );
54a0048b 66}