[PATCH] Inserting directives directly after inline asm blocks

Rafael EspĂ­ndola rafael.espindola at gmail.com
Thu Apr 25 17:06:37 PDT 2013


On 25 April 2013 18:03, Jack Carter <Jack.Carter at imgtec.com> wrote:
> I think I see the confusion.
>
> The code I am adding really codegen producing something to the .s file just like the .set noreorder we do at the beginning of a function and .set reorder we do at the end of a function. It has nothing to do with the MC layer.

It is passing via MC, but it is doing it the wrong way.


> The only reason I needed to expose AsmPrinter::EmitInlineAsm() and make a Mips derived class of it was to alert when to generate the directives. Maybe there is another way to detect this, but this seemed the most obvious.
>
> Can I check it in ;-)

NO.

Lets go again, from the use case down. A user writes C code with
inline assembly. He can

* rely on the historical behavior of reorder being the default.
* change the mode to reorder or noreorder using assembly directives.

That is why you need to wrap the inline assembly, to make sure the
user expectations are true at the beginning on the inline asm and
llvm's codegen assumptions are true at the end. That part is correct.

The problem is that you are only doing it when printing assembly, not
when when going directly to an object file. That means that if user
has some inline assembly with ".set reorder", llvm will correctly
switch back to noreorder if we are printing a .s, but not if we are
producing a .o.

That is why the reorder mode change has to be visible in the
MCStreamer interface.

> Jack

Cheers,
Rafael



More information about the llvm-commits mailing list