Skip to content

Cleanup AsmDialect usage. #28566

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Sep 21, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 1 addition & 8 deletions src/librustc_front/hir.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

// The Rust HIR.

pub use self::AsmDialect::*;
pub use self::BindingMode::*;
pub use self::BinOp_::*;
pub use self::BlockCheckMode::*;
Expand Down Expand Up @@ -41,7 +40,7 @@ pub use self::PathParameters::*;

use syntax::codemap::{self, Span, Spanned, DUMMY_SP, ExpnId};
use syntax::abi::Abi;
use syntax::ast::{Name, Ident, NodeId, DUMMY_NODE_ID, TokenTree};
use syntax::ast::{Name, Ident, NodeId, DUMMY_NODE_ID, TokenTree, AsmDialect};
use syntax::ast::{Attribute, Lit, StrStyle, FloatTy, IntTy, UintTy, CrateConfig};
use syntax::owned_slice::OwnedSlice;
use syntax::parse::token::InternedString;
Expand Down Expand Up @@ -876,12 +875,6 @@ pub enum Ty_ {
TyInfer,
}

#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug, Copy)]
pub enum AsmDialect {
AsmAtt,
AsmIntel
}

#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)]
pub struct InlineAsm {
pub asm: InternedString,
Expand Down
9 changes: 1 addition & 8 deletions src/librustc_front/lowering.rs
Original file line number Diff line number Diff line change
Expand Up @@ -801,7 +801,7 @@ pub fn lower_expr(e: &Expr) -> P<hir::Expr> {
clobbers: clobbers.clone(),
volatile: volatile,
alignstack: alignstack,
dialect: lower_asm_dialect(dialect),
dialect: dialect,
expn_id: expn_id,
}),
ExprStruct(ref path, ref fields, ref maybe_expr) => {
Expand Down Expand Up @@ -863,13 +863,6 @@ pub fn lower_capture_clause(c: CaptureClause) -> hir::CaptureClause {
}
}

pub fn lower_asm_dialect(a: AsmDialect) -> hir::AsmDialect {
match a {
AsmAtt => hir::AsmAtt,
AsmIntel => hir::AsmIntel,
}
}

pub fn lower_visibility(v: Visibility) -> hir::Visibility {
match v {
Public => hir::Public,
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_front/print/pprust.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1539,7 +1539,7 @@ impl<'a> State<'a> {
if a.alignstack {
options.push("alignstack");
}
if a.dialect == hir::AsmDialect::AsmIntel {
if a.dialect == ast::AsmDialect::Intel {
options.push("intel");
}

Expand Down
5 changes: 3 additions & 2 deletions src/librustc_trans/trans/asm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ use trans::type_::Type;

use rustc_front::hir as ast;
use std::ffi::CString;
use syntax::ast::AsmDialect;
use libc::{c_uint, c_char};

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

let dialect = match ia.dialect {
ast::AsmAtt => llvm::AD_ATT,
ast::AsmIntel => llvm::AD_Intel
AsmDialect::Att => llvm::AD_ATT,
AsmDialect::Intel => llvm::AD_Intel
};

let asm = CString::new(ia.asm.as_bytes()).unwrap();
Expand Down
5 changes: 2 additions & 3 deletions src/libsyntax/ast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

// The Rust abstract syntax tree.

pub use self::AsmDialect::*;
pub use self::AttrStyle::*;
pub use self::BindingMode::*;
pub use self::BinOp_::*;
Expand Down Expand Up @@ -1440,8 +1439,8 @@ pub enum Ty_ {

#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug, Copy)]
pub enum AsmDialect {
AsmAtt,
AsmIntel
Att,
Intel,
}

#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)]
Expand Down
5 changes: 3 additions & 2 deletions src/libsyntax/ext/asm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ use feature_gate;
use parse::token::{intern, InternedString};
use parse::token;
use ptr::P;
use syntax::ast::AsmDialect;

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

let mut state = Asm;

Expand Down Expand Up @@ -178,7 +179,7 @@ pub fn expand_asm<'cx>(cx: &'cx mut ExtCtxt, sp: Span, tts: &[ast::TokenTree])
} else if option == "alignstack" {
alignstack = true;
} else if option == "intel" {
dialect = ast::AsmIntel;
dialect = AsmDialect::Intel;
} else {
cx.span_warn(p.last_span, "unrecognized option");
}
Expand Down
2 changes: 1 addition & 1 deletion src/libsyntax/print/pprust.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2209,7 +2209,7 @@ impl<'a> State<'a> {
if a.alignstack {
options.push("alignstack");
}
if a.dialect == ast::AsmDialect::AsmIntel {
if a.dialect == ast::AsmDialect::Intel {
options.push("intel");
}

Expand Down