<p dir="ltr">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).</p>
<p dir="ltr">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.</p>

<div class="gmail_quote">On Jun 19, 2014 11:19 PM, "pratik dand" <<a href="mailto:pratikdand143@gmail.com">pratikdand143@gmail.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr"><div><div>Dear David,<br><br></div>It's done at the IR level by <br>call void asm sideeffect "addl .. .. ..", "~{dirflag},~{fpsr},~{flags}"() nounwind, !srcloc !0.<br><br></div><div>
But I am looking for something more.<br>
</div><div>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.<br>

<br></div><div>I am looking to support a new custom add instruction without adding it to the backend.<br><br></div><div>Regards,<br></div><div>Pratik  <br></div><div><div class="gmail_extra"><br><br><div class="gmail_quote">

On Fri, Jun 20, 2014 at 1:20 PM, David Blaikie <span dir="ltr"><<a href="mailto:dblaikie@gmail.com" target="_blank">dblaikie@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

Oh, wait - which way. Writing inline assembly /using/ llvm IR (eg:<br>
LLVM IR embedded as inline assembly in C) or writing inline assembly<br>
(for actual assembly) in LLVM IR?<br>
<br>
For the former, see my first response. For the latter - I'd just look<br>
at what IR clang produces for inline assembly given in a c file, etc.<br>
<div><div><br>
On Thu, Jun 19, 2014 at 10:18 PM, David Blaikie <<a href="mailto:dblaikie@gmail.com" target="_blank">dblaikie@gmail.com</a>> wrote:<br>
> Hasn't been implemented. Could be, if someone really wanted to.<br>
><br>
> On Thu, Jun 19, 2014 at 8:37 PM, pratik dand <<a href="mailto:pratikdand143@gmail.com" target="_blank">pratikdand143@gmail.com</a>> wrote:<br>
>> Dear,<br>
>><br>
>> Can anybody comment on inserting inline assembly in LLVM IR?<br>
>><br>
>> --<br>
>> Pratik<br>
>><br>
>><br>
>> _______________________________________________<br>
>> LLVM Developers mailing list<br>
>> <a href="mailto:LLVMdev@cs.uiuc.edu" target="_blank">LLVMdev@cs.uiuc.edu</a>         <a href="http://llvm.cs.uiuc.edu" target="_blank">http://llvm.cs.uiuc.edu</a><br>
>> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br>
>><br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br>Pratik<div><br></div>
</div></div></div>
</blockquote></div>