summary refs log tree commit diff
path: root/src/libsyntax/ext
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2013-03-28 18:18:46 -0700
committerbors <bors@rust-lang.org>2013-03-28 18:18:46 -0700
commitf81459211d0cf2738ed02f5c7fe24f56c8032960 (patch)
treed67a85c098dd7a2af05bd4ef4a3155f115565169 /src/libsyntax/ext
parent943d7adedc2401b54e103ea3635d0e50b1822d5a (diff)
parenta3996c1626003472437b9c29e179583daf9e53bf (diff)
downloadrust-f81459211d0cf2738ed02f5c7fe24f56c8032960.tar.gz
rust-f81459211d0cf2738ed02f5c7fe24f56c8032960.zip
auto merge of #5593 : luqmana/rust/inline-asm, r=catamorphism
Clean things up a bit. Also, allow selecting intel syntax in addition to the default AT&T dialect.
Diffstat (limited to 'src/libsyntax/ext')
-rw-r--r--src/libsyntax/ext/asm.rs16
1 files changed, 13 insertions, 3 deletions
diff --git a/src/libsyntax/ext/asm.rs b/src/libsyntax/ext/asm.rs
index a014d8ccb8b..b070948d405 100644
--- a/src/libsyntax/ext/asm.rs
+++ b/src/libsyntax/ext/asm.rs
@@ -53,13 +53,14 @@ 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: {
         match state {
             Asm => {
                 asm = expr_to_str(cx, p.parse_expr(),
-                                ~"inline assembly must be a string literal.");
+                                  ~"inline assembly must be a string literal.");
             }
             Outputs => {
                 while *p.token != token::EOF &&
@@ -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 {
@@ -163,8 +166,15 @@ pub fn expand_asm(cx: @ext_ctxt, sp: span, tts: &[ast::token_tree])
     MRExpr(@ast::expr {
         id: cx.next_id(),
         callee_id: cx.next_id(),
-        node: ast::expr_inline_asm(@asm, inputs, outputs,
-                                   @cons, volatile, alignstack),
+        node: ast::expr_inline_asm(ast::inline_asm {
+            asm: @asm,
+            clobbers: @cons,
+            inputs: inputs,
+            outputs: outputs,
+            volatile: volatile,
+            alignstack: alignstack,
+            dialect: dialect
+        }),
         span: sp
     })
 }