1
Fork 0
rust/compiler/rustc_codegen_ssa/src/traits/asm.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

71 lines
1.8 KiB
Rust
Raw Normal View History

use super::BackendTypes;
2020-02-17 21:36:01 +00:00
use crate::mir::operand::OperandRef;
2019-02-09 23:31:47 +09:00
use crate::mir::place::PlaceRef;
2020-04-27 23:26:11 +05:30
use rustc_ast::{InlineAsmOptions, InlineAsmTemplatePiece};
2020-02-17 21:36:01 +00:00
use rustc_hir::def_id::DefId;
use rustc_middle::ty::Instance;
use rustc_span::Span;
use rustc_target::asm::InlineAsmRegOrRegClass;
2020-02-17 21:36:01 +00:00
#[derive(Debug)]
pub enum InlineAsmOperandRef<'tcx, B: BackendTypes + ?Sized> {
In {
reg: InlineAsmRegOrRegClass,
value: OperandRef<'tcx, B::Value>,
},
Out {
reg: InlineAsmRegOrRegClass,
late: bool,
place: Option<PlaceRef<'tcx, B::Value>>,
},
InOut {
reg: InlineAsmRegOrRegClass,
late: bool,
in_value: OperandRef<'tcx, B::Value>,
out_place: Option<PlaceRef<'tcx, B::Value>>,
},
Const {
string: String,
},
SymFn {
instance: Instance<'tcx>,
},
SymStatic {
def_id: DefId,
},
Label {
label: B::BasicBlock,
},
2020-02-17 21:36:01 +00:00
}
#[derive(Debug)]
pub enum GlobalAsmOperandRef<'tcx> {
Const { string: String },
SymFn { instance: Instance<'tcx> },
SymStatic { def_id: DefId },
}
pub trait AsmBuilderMethods<'tcx>: BackendTypes {
2020-02-17 21:36:01 +00:00
/// Take an inline assembly expression and splat it out via LLVM
fn codegen_inline_asm(
&mut self,
template: &[InlineAsmTemplatePiece],
operands: &[InlineAsmOperandRef<'tcx, Self>],
options: InlineAsmOptions,
2020-05-26 20:07:59 +01:00
line_spans: &[Span],
instance: Instance<'_>,
dest: Option<Self::BasicBlock>,
catch_funclet: Option<(Self::BasicBlock, Option<&Self::Funclet>)>,
2020-02-17 21:36:01 +00:00
);
}
pub trait AsmMethods<'tcx> {
fn codegen_global_asm(
&self,
template: &[InlineAsmTemplatePiece],
operands: &[GlobalAsmOperandRef<'tcx>],
options: InlineAsmOptions,
line_spans: &[Span],
);
}