[PATCH] disabled switching ARM modes in inline asm

Jim Grosbach grosbach at apple.com
Tue Dec 3 11:16:17 PST 2013


On Dec 3, 2013, at 11:12 AM, Greg Fitzgerald <garious at gmail.com> wrote:

> 
>> The compiler must go back to its own state after inline assembly, and err if the user makes it hard.
> 
>  Agreed.  It's easy to detect a missing .arm or .thumb directive.  Not so obvious to me how to detect the missing adr instruction (or equivalent?).  I think a good fix would be to error out if the compiler notices the missing directive (rather than inject it), under the assumption that the missing directive suggests the adr instruction is missing as well.
> 
> 
>> The compiler must detect changes in inline assembly, and record its own state, to be able to do so.
> 
>  Agreed.  SubtargetInfo's FeatureBits looks good for this.

That could get interesting. The feature bits are theoretically ‘const’ at least on a per-function basis (currently, it’s per translation unit, which is definitely wrong). Thumb mode vs. ARM mode really shouldn’t be specified that way at all and should be a separate bit of state. There’s a lot of historical legacy to unravel here to get this right.

> 
> 
>> Forbidding state change altogether is a first approach on correctness, and
>> I'm fine with this patch as it is. For the future, do you plan on implementing
>> a more fine grained approach?
> 
>  I'm not sure.  It's easy to implement but difficult to test.  llvm-objdump needs to respect the ARM-ELF mapping symbols.  I'll take a shot at it today.  I'll report back in a few hours.  If it doesn't go well, I think we should merge this patch, which is about as conservative as it gets.
> 
> 
> ================
> Comment at: include/llvm/MC/MCTargetAsmParser.h:101
> @@ +100,3 @@
> +  /// ParsingInlineGnuAsm - Are we parsing GAS-syntax inline assembly?
> +  bool ParsingInlineGnuAsm;
> +
> ----------------
> Renato Golin wrote:
>> I don't understand why you need this...
> Because the name 'ParsingInlineAsm' was taken for MS-style assembly.
> 
> 
> http://llvm-reviews.chandlerc.com/D2255





More information about the llvm-commits mailing list