libsyntax: Allow selecting intel style asm.
This commit is contained in:
parent
203d691a6b
commit
b867fe41de
@ -104,10 +104,15 @@ pub fn trans_inline_asm(bcx: block, ia: &ast::inline_asm) -> block {
|
||||
T_struct(outputs.map(|o| val_ty(*o)))
|
||||
};
|
||||
|
||||
let dialect = match ia.dialect {
|
||||
ast::asm_att => lib::llvm::AD_ATT,
|
||||
ast::asm_intel => lib::llvm::AD_Intel
|
||||
};
|
||||
|
||||
let r = do str::as_c_str(*ia.asm) |a| {
|
||||
do str::as_c_str(constraints) |c| {
|
||||
// XXX: Allow selection of at&t or intel
|
||||
InlineAsmCall(bcx, a, c, inputs, output, ia.volatile, ia.alignstack, lib::llvm::AD_ATT)
|
||||
InlineAsmCall(bcx, a, c, inputs, output, ia.volatile, ia.alignstack, dialect)
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -934,6 +934,14 @@ fn iter_bytes(&self, +lsb0: bool, f: to_bytes::Cb) {
|
||||
}
|
||||
}
|
||||
|
||||
#[auto_encode]
|
||||
#[auto_decode]
|
||||
#[deriving(Eq)]
|
||||
pub enum asm_dialect {
|
||||
asm_att,
|
||||
asm_intel
|
||||
}
|
||||
|
||||
#[auto_encode]
|
||||
#[auto_decode]
|
||||
#[deriving(Eq)]
|
||||
@ -943,7 +951,8 @@ pub struct inline_asm {
|
||||
inputs: ~[(@~str, @expr)],
|
||||
outputs: ~[(@~str, @expr)],
|
||||
volatile: bool,
|
||||
alignstack: bool
|
||||
alignstack: bool,
|
||||
dialect: asm_dialect
|
||||
}
|
||||
|
||||
#[auto_encode]
|
||||
|
@ -53,6 +53,7 @@ pub fn expand_asm(cx: @ext_ctxt, sp: span, tts: &[ast::token_tree])
|
||||
let mut cons = ~"";
|
||||
let mut volatile = false;
|
||||
let mut alignstack = false;
|
||||
let mut dialect = ast::asm_att;
|
||||
|
||||
let mut state = Asm;
|
||||
loop outer: {
|
||||
@ -125,6 +126,8 @@ pub fn expand_asm(cx: @ext_ctxt, sp: span, tts: &[ast::token_tree])
|
||||
volatile = true;
|
||||
} else if option == ~"alignstack" {
|
||||
alignstack = true;
|
||||
} else if option == ~"intel" {
|
||||
dialect = ast::asm_intel;
|
||||
}
|
||||
|
||||
if *p.token == token::COMMA {
|
||||
@ -169,7 +172,8 @@ pub fn expand_asm(cx: @ext_ctxt, sp: span, tts: &[ast::token_tree])
|
||||
inputs: inputs,
|
||||
outputs: outputs,
|
||||
volatile: volatile,
|
||||
alignstack: alignstack
|
||||
alignstack: alignstack,
|
||||
dialect: dialect
|
||||
}),
|
||||
span: sp
|
||||
})
|
||||
|
@ -561,12 +561,9 @@ fn fold_field_(field: field, fld: @ast_fold) -> field {
|
||||
}
|
||||
expr_inline_asm(a) => {
|
||||
expr_inline_asm(inline_asm {
|
||||
asm: a.asm,
|
||||
clobbers: a.clobbers,
|
||||
inputs: a.inputs.map(|&(c, in)| (c, fld.fold_expr(in))),
|
||||
outputs: a.outputs.map(|&(c, out)| (c, fld.fold_expr(out))),
|
||||
volatile: a.volatile,
|
||||
alignstack: a.alignstack
|
||||
.. a
|
||||
})
|
||||
}
|
||||
expr_mac(ref mac) => expr_mac(fold_mac((*mac))),
|
||||
|
Loading…
Reference in New Issue
Block a user