[LLVMdev] making emitInlineAsm protected

Reed Kotler rkotler at mips.com
Wed Jan 29 15:29:34 PST 2014

On 01/29/2014 02:32 PM, Eric Christopher wrote:
> On Wed, Jan 29, 2014 at 2:27 PM, reed kotler <rkotler at mips.com> wrote:
>> On 01/29/2014 02:18 PM, Rafael EspĂ­ndola wrote:
>>>> I'd like to just check my code in and then you can look at it in it's
>>>> totality and see if you have
>>>> a better solution .
>>> No!
>>> If it is the compiler creating instructions, it is not inline
>>> assembly. If you need to print mips16 and mips32 and they are two
>>> independent instruction sets, my guess is that you need to figure out
>>> how to swap between two AsmPrinters.
>>> Cheers,
>>> Rafael
>> We do switch them already.
>> We create different functions for the stubs and assign them the mips32
>> attribute.
>> Then they get assembled.
>> The need for these particular stubs cannot be recognized until isel
>> lowering.
>> Why do I need to make a complex mechanism here when all I need to do is emit
>> some
>> some inline assembly code at the end of asm printer?
>> What purpose will this serve?
> Because we're not an assembly emitting compiler. We're an object file
> emitting compiler and it's breaking abstractions. The correct way to
> do the work here is to emit the functions and lower them
> appropriately.
> -eric
So explain to me how this mechanism would work.

As I'm processing a single mips16 function, I realize that I need to 
create one or more mips32 helper functions.

I'm in a function pass. So I'm not supposed to be creating new 
functions, as far as I understand.

Also, I can't know which mips32 stub functions to create until I have 
processed all functions because otherwise I might create duplicates.

So how would you do this within the existing LLVM pass structure?


More information about the llvm-dev mailing list