From 05ae66607fe2aaab786e6444f4b674499fd79319 Mon Sep 17 00:00:00 2001 From: asquared31415 <34665709+asquared31415@users.noreply.github.com> Date: Mon, 8 Mar 2021 12:16:12 -0500 Subject: [PATCH] Move default inline asm dialect to Session --- compiler/rustc_builtin_macros/src/asm.rs | 8 ++------ compiler/rustc_session/src/session.rs | 7 +++++++ 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/compiler/rustc_builtin_macros/src/asm.rs b/compiler/rustc_builtin_macros/src/asm.rs index bb529f9e5c2..8d8b3f4f6aa 100644 --- a/compiler/rustc_builtin_macros/src/asm.rs +++ b/compiler/rustc_builtin_macros/src/asm.rs @@ -12,7 +12,6 @@ use rustc_span::{ BytePos, }; use rustc_span::{InnerSpan, Span}; -use rustc_target::asm::InlineAsmArch; struct AsmArgs { templates: Vec>, @@ -403,6 +402,8 @@ fn expand_preparsed_asm(ecx: &mut ExtCtxt<'_>, sp: Span, args: AsmArgs) -> P, sp: Span, args: AsmArgs) -> P ast::LlvmAsmDialect::Intel, - _ => ast::LlvmAsmDialect::Att, - }; - let snippet = snippet.trim_matches('"'); match default_dialect { ast::LlvmAsmDialect::Intel => { diff --git a/compiler/rustc_session/src/session.rs b/compiler/rustc_session/src/session.rs index a7ceb9e06a5..83ab066c7c3 100644 --- a/compiler/rustc_session/src/session.rs +++ b/compiler/rustc_session/src/session.rs @@ -784,6 +784,13 @@ impl Session { } } + pub fn inline_asm_dialect(&self) -> rustc_ast::LlvmAsmDialect { + match self.asm_arch { + Some(InlineAsmArch::X86 | InlineAsmArch::X86_64) => rustc_ast::LlvmAsmDialect::Intel, + _ => rustc_ast::LlvmAsmDialect::Att, + } + } + pub fn relocation_model(&self) -> RelocModel { self.opts.cg.relocation_model.unwrap_or(self.target.relocation_model) }