Skip to content

Commit 7e8d19b

Browse files
committed
Auto merge of #28566 - Ms2ger:AsmDialect, r=sanxiyn
2 parents 5120f4a + 184c8a9 commit 7e8d19b

File tree

7 files changed

+12
-25
lines changed

7 files changed

+12
-25
lines changed

src/librustc_front/hir.rs

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010

1111
// The Rust HIR.
1212

13-
pub use self::AsmDialect::*;
1413
pub use self::BindingMode::*;
1514
pub use self::BinOp_::*;
1615
pub use self::BlockCheckMode::*;
@@ -41,7 +40,7 @@ pub use self::PathParameters::*;
4140

4241
use syntax::codemap::{self, Span, Spanned, DUMMY_SP, ExpnId};
4342
use syntax::abi::Abi;
44-
use syntax::ast::{Name, Ident, NodeId, DUMMY_NODE_ID, TokenTree};
43+
use syntax::ast::{Name, Ident, NodeId, DUMMY_NODE_ID, TokenTree, AsmDialect};
4544
use syntax::ast::{Attribute, Lit, StrStyle, FloatTy, IntTy, UintTy, CrateConfig};
4645
use syntax::owned_slice::OwnedSlice;
4746
use syntax::parse::token::InternedString;
@@ -876,12 +875,6 @@ pub enum Ty_ {
876875
TyInfer,
877876
}
878877

879-
#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug, Copy)]
880-
pub enum AsmDialect {
881-
AsmAtt,
882-
AsmIntel
883-
}
884-
885878
#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)]
886879
pub struct InlineAsm {
887880
pub asm: InternedString,

src/librustc_front/lowering.rs

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -801,7 +801,7 @@ pub fn lower_expr(e: &Expr) -> P<hir::Expr> {
801801
clobbers: clobbers.clone(),
802802
volatile: volatile,
803803
alignstack: alignstack,
804-
dialect: lower_asm_dialect(dialect),
804+
dialect: dialect,
805805
expn_id: expn_id,
806806
}),
807807
ExprStruct(ref path, ref fields, ref maybe_expr) => {
@@ -863,13 +863,6 @@ pub fn lower_capture_clause(c: CaptureClause) -> hir::CaptureClause {
863863
}
864864
}
865865

866-
pub fn lower_asm_dialect(a: AsmDialect) -> hir::AsmDialect {
867-
match a {
868-
AsmAtt => hir::AsmAtt,
869-
AsmIntel => hir::AsmIntel,
870-
}
871-
}
872-
873866
pub fn lower_visibility(v: Visibility) -> hir::Visibility {
874867
match v {
875868
Public => hir::Public,

src/librustc_front/print/pprust.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1539,7 +1539,7 @@ impl<'a> State<'a> {
15391539
if a.alignstack {
15401540
options.push("alignstack");
15411541
}
1542-
if a.dialect == hir::AsmDialect::AsmIntel {
1542+
if a.dialect == ast::AsmDialect::Intel {
15431543
options.push("intel");
15441544
}
15451545

src/librustc_trans/trans/asm.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ use trans::type_::Type;
2222

2323
use rustc_front::hir as ast;
2424
use std::ffi::CString;
25+
use syntax::ast::AsmDialect;
2526
use libc::{c_uint, c_char};
2627

2728
// Take an inline assembly expression and splat it out via LLVM
@@ -105,8 +106,8 @@ pub fn trans_inline_asm<'blk, 'tcx>(bcx: Block<'blk, 'tcx>, ia: &ast::InlineAsm)
105106
};
106107

107108
let dialect = match ia.dialect {
108-
ast::AsmAtt => llvm::AD_ATT,
109-
ast::AsmIntel => llvm::AD_Intel
109+
AsmDialect::Att => llvm::AD_ATT,
110+
AsmDialect::Intel => llvm::AD_Intel
110111
};
111112

112113
let asm = CString::new(ia.asm.as_bytes()).unwrap();

src/libsyntax/ast.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010

1111
// The Rust abstract syntax tree.
1212

13-
pub use self::AsmDialect::*;
1413
pub use self::AttrStyle::*;
1514
pub use self::BindingMode::*;
1615
pub use self::BinOp_::*;
@@ -1440,8 +1439,8 @@ pub enum Ty_ {
14401439

14411440
#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug, Copy)]
14421441
pub enum AsmDialect {
1443-
AsmAtt,
1444-
AsmIntel
1442+
Att,
1443+
Intel,
14451444
}
14461445

14471446
#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)]

src/libsyntax/ext/asm.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ use feature_gate;
2222
use parse::token::{intern, InternedString};
2323
use parse::token;
2424
use ptr::P;
25+
use syntax::ast::AsmDialect;
2526

2627
enum State {
2728
Asm,
@@ -65,7 +66,7 @@ pub fn expand_asm<'cx>(cx: &'cx mut ExtCtxt, sp: Span, tts: &[ast::TokenTree])
6566
let mut clobs = Vec::new();
6667
let mut volatile = false;
6768
let mut alignstack = false;
68-
let mut dialect = ast::AsmAtt;
69+
let mut dialect = AsmDialect::Att;
6970

7071
let mut state = Asm;
7172

@@ -178,7 +179,7 @@ pub fn expand_asm<'cx>(cx: &'cx mut ExtCtxt, sp: Span, tts: &[ast::TokenTree])
178179
} else if option == "alignstack" {
179180
alignstack = true;
180181
} else if option == "intel" {
181-
dialect = ast::AsmIntel;
182+
dialect = AsmDialect::Intel;
182183
} else {
183184
cx.span_warn(p.last_span, "unrecognized option");
184185
}

src/libsyntax/print/pprust.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2209,7 +2209,7 @@ impl<'a> State<'a> {
22092209
if a.alignstack {
22102210
options.push("alignstack");
22112211
}
2212-
if a.dialect == ast::AsmDialect::AsmIntel {
2212+
if a.dialect == ast::AsmDialect::Intel {
22132213
options.push("intel");
22142214
}
22152215

0 commit comments

Comments
 (0)