[cfe-commits] [PATCH] MS style inline assembly support

Chad Rosier mcrosier at apple.com
Fri Jun 8 15:58:15 PDT 2012


On Jun 8, 2012, at 1:42 PM, Eli Friedman wrote:

> On Fri, Jun 8, 2012 at 11:52 AM, Chad Rosier <mcrosier at apple.com> wrote:
>> The attached patch etches out a new code path for MS style inline assembly in the Parser, Sema, AST, and CodeGen.  This is _largely_ a WIP!
>> 
>> The idea is to translate the MS style inline assembly into IR that is equivalent to the GNU style inline assembly.  That way the backend doesn't need to be modified (nor does our assembler implementation).  I was hoping to make further progress on this today, so please take a look if you have a quick second.
> 
> You'll need to extend LLVM IR and the backend slightly so that it can
> perform MS-style operand interpolation ("8(%esp)" vs. "[esp+8]", for
> example); otherwise, that seems feasible.

Ok.

> Various review comments:
> 
> Please don't use StringLiteral for any of the pieces of MS inline
> assembly; they're not actually written as strings in the source, so
> using it here is confusing.

Agreed; just a gross simplification to get things going.

> 
> +  /** \brief A MS inline assembly statement extension.
> +   */
> +  CXCursor_MSAsmStmt                     = 216,
> +
>   /** \brief Objective-C's overall @try- at catch-@finally statement.
>    */
> -  CXCursor_ObjCAtTryStmt                 = 216,
> +  CXCursor_ObjCAtTryStmt                 = 217,
> 
> Please don't renumber the CXCursor enum; just add an entry at the end.

Will do.

> 
> In MSAsmStmt, does it actually make sense to talk in terms of "input
> operands" and "output operands"?  For GNU-style inline asm, the
> distinction makes sense because there are actually two separate lists
> in the source code, but as far as I can tell the distinction isn't
> useful here.

Agreed.

> I think it's important to figure out a design for how we keep track of
> source locations though the AST and IRGen before you get too much
> further because rewriting your data structures later on will be a
> pain.

I'll fix the suggestions above and then start on this.

> Instead of comments like "FIXME: MS style inline asm still a WIP",
> please use something more specific, like "serialization for MS-style
> inline asm not yet implemented".

Will do.

> 
> -Eli




More information about the cfe-commits mailing list