[LLVMdev] Inline Assembly in IR
David Blaikie
dblaikie at gmail.com
Fri Jun 20 07:19:33 PDT 2014
That's probably not the right approach (best to keep this conversation on
list because this is certainly not my area of expertise and other people
might have better opinions).
If your new instruction is just a better way of describing adds on your
chip then it should just be a custom target or sub target or CPU feature in
the backend (llvms lib target, specifically the x86 target), I'd guess.
On Jun 19, 2014 11:19 PM, "pratik dand" <pratikdand143 at gmail.com> wrote:
> Dear David,
>
> It's done at the IR level by
> call void asm sideeffect "addl .. .. ..", "~{dirflag},~{fpsr},~{flags}"()
> nounwind, !srcloc !0.
>
> But I am looking for something more.
> I am planning to replace addl of X86 by my new instruction addencl. Hence,
> on seeing an "add nsw" in the LLVM IR I want to replace it with an assembly
> corresponding to my new instruction. The problem being, at the IR level I
> wouldn't know the registers allocated to the tmp variables of IR.
>
> I am looking to support a new custom add instruction without adding it to
> the backend.
>
> Regards,
> Pratik
>
>
> On Fri, Jun 20, 2014 at 1:20 PM, David Blaikie <dblaikie at gmail.com> wrote:
>
>> Oh, wait - which way. Writing inline assembly /using/ llvm IR (eg:
>> LLVM IR embedded as inline assembly in C) or writing inline assembly
>> (for actual assembly) in LLVM IR?
>>
>> For the former, see my first response. For the latter - I'd just look
>> at what IR clang produces for inline assembly given in a c file, etc.
>>
>> On Thu, Jun 19, 2014 at 10:18 PM, David Blaikie <dblaikie at gmail.com>
>> wrote:
>> > Hasn't been implemented. Could be, if someone really wanted to.
>> >
>> > On Thu, Jun 19, 2014 at 8:37 PM, pratik dand <pratikdand143 at gmail.com>
>> wrote:
>> >> Dear,
>> >>
>> >> Can anybody comment on inserting inline assembly in LLVM IR?
>> >>
>> >> --
>> >> Pratik
>> >>
>> >>
>> >> _______________________________________________
>> >> LLVM Developers mailing list
>> >> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu
>> >> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>> >>
>>
>
>
>
> --
> Pratik
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20140620/0b569c7a/attachment.html>
More information about the llvm-dev
mailing list