Remove decl_macro usage
This reduces the amount of unstable features used by cg_clif
This commit is contained in:
parent
e937265673
commit
cfc1a2cd68
@ -1,16 +1,18 @@
|
||||
macro builtin_functions($register:ident; $(fn $name:ident($($arg_name:ident: $arg_ty:ty),*) -> $ret_ty:ty;)*) {
|
||||
#[cfg(feature = "jit")]
|
||||
#[allow(improper_ctypes)]
|
||||
extern "C" {
|
||||
$(fn $name($($arg_name: $arg_ty),*) -> $ret_ty;)*
|
||||
}
|
||||
|
||||
#[cfg(feature = "jit")]
|
||||
pub(crate) fn $register(builder: &mut cranelift_jit::JITBuilder) {
|
||||
for (name, val) in [$((stringify!($name), $name as *const u8)),*] {
|
||||
builder.symbol(name, val);
|
||||
macro_rules! builtin_functions {
|
||||
($register:ident; $(fn $name:ident($($arg_name:ident: $arg_ty:ty),*) -> $ret_ty:ty;)*) => {
|
||||
#[cfg(feature = "jit")]
|
||||
#[allow(improper_ctypes)]
|
||||
extern "C" {
|
||||
$(fn $name($($arg_name: $arg_ty),*) -> $ret_ty;)*
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "jit")]
|
||||
pub(crate) fn $register(builder: &mut cranelift_jit::JITBuilder) {
|
||||
for (name, val) in [$((stringify!($name), $name as *const u8)),*] {
|
||||
builder.symbol(name, val);
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
builtin_functions! {
|
||||
|
@ -1,46 +1,32 @@
|
||||
//! Codegen of intrinsics. This includes `extern "rust-intrinsic"`, `extern "platform-intrinsic"`
|
||||
//! and LLVM intrinsics that have symbol names starting with `llvm.`.
|
||||
|
||||
mod cpuid;
|
||||
mod llvm;
|
||||
mod simd;
|
||||
|
||||
pub(crate) use cpuid::codegen_cpuid_call;
|
||||
pub(crate) use llvm::codegen_llvm_intrinsic_call;
|
||||
|
||||
use rustc_middle::ty::print::with_no_trimmed_paths;
|
||||
use rustc_middle::ty::subst::SubstsRef;
|
||||
use rustc_span::symbol::{kw, sym, Symbol};
|
||||
|
||||
use crate::prelude::*;
|
||||
use cranelift_codegen::ir::AtomicRmwOp;
|
||||
|
||||
macro intrinsic_pat {
|
||||
macro_rules! intrinsic_pat {
|
||||
(_) => {
|
||||
_
|
||||
},
|
||||
};
|
||||
($name:ident) => {
|
||||
sym::$name
|
||||
},
|
||||
};
|
||||
(kw.$name:ident) => {
|
||||
kw::$name
|
||||
},
|
||||
};
|
||||
($name:literal) => {
|
||||
$name
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
macro intrinsic_arg {
|
||||
(o $fx:expr, $arg:ident) => {},
|
||||
macro_rules! intrinsic_arg {
|
||||
(o $fx:expr, $arg:ident) => {};
|
||||
(c $fx:expr, $arg:ident) => {
|
||||
let $arg = codegen_operand($fx, $arg);
|
||||
},
|
||||
};
|
||||
(v $fx:expr, $arg:ident) => {
|
||||
let $arg = codegen_operand($fx, $arg).load_scalar($fx);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
macro intrinsic_match {
|
||||
macro_rules! intrinsic_match {
|
||||
($fx:expr, $intrinsic:expr, $args:expr,
|
||||
_ => $unknown:block;
|
||||
$(
|
||||
@ -62,6 +48,20 @@
|
||||
}
|
||||
}
|
||||
|
||||
mod cpuid;
|
||||
mod llvm;
|
||||
mod simd;
|
||||
|
||||
pub(crate) use cpuid::codegen_cpuid_call;
|
||||
pub(crate) use llvm::codegen_llvm_intrinsic_call;
|
||||
|
||||
use rustc_middle::ty::print::with_no_trimmed_paths;
|
||||
use rustc_middle::ty::subst::SubstsRef;
|
||||
use rustc_span::symbol::{kw, sym, Symbol};
|
||||
|
||||
use crate::prelude::*;
|
||||
use cranelift_codegen::ir::AtomicRmwOp;
|
||||
|
||||
fn report_atomic_type_validation_error<'tcx>(
|
||||
fx: &mut FunctionCx<'_, '_, 'tcx>,
|
||||
intrinsic: Symbol,
|
||||
|
@ -1,4 +1,4 @@
|
||||
#![feature(rustc_private, decl_macro)]
|
||||
#![feature(rustc_private)]
|
||||
#![cfg_attr(feature = "jit", feature(never_type, vec_into_raw_parts, once_cell))]
|
||||
#![warn(rust_2018_idioms)]
|
||||
#![warn(unused_lifetimes)]
|
||||
|
Loading…
Reference in New Issue
Block a user