<div dir="ltr">You were right, i forgot the include, thanks for your answers)<div><br><div class="gmail_quote"><div dir="ltr">ср, 26 сент. 2018 г. в 21:07, Friedman, Eli <<a href="mailto:efriedma@codeaurora.org" target="_blank">efriedma@codeaurora.org</a>>:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div text="#000000" bgcolor="#FFFFFF">
<div class="m_-3547257306139825256m_823037147963819305moz-cite-prefix">Are you sure you actually defined the
intrinsic? (If you're adding a new .td file to include/llvm/IR/,
you need to make sure there's a corresponding line in
include/llvm/IR/Intrinsics.td.)<br>
<br>
-Eli<br>
<br>
On 9/26/2018 1:29 AM, Павел Безбородов wrote:<br>
</div>
<blockquote type="cite">
<div dir="ltr">
<div dir="ltr">Actually, I've done it, but I have problem with
Intrinsic namespace, while adding my intrinsic to
CodeGenFunction::EmitMyTargetBuiltinExpr I do something like
CGF.getIntrinsic(Intrinsic::my_builtin) and it throws error <br>
/tools/clang/lib/CodeGen/CGBuiltin.cpp:10327: error: no member
named 'arc_sub4' in namespace 'llvm::Intrinsic'
<div> llvm::Function *F =
CGM.getIntrinsic(Intrinsic::arc_sub4);</div>
<div> ~~~~~~~~~~~^</div>
<div>I don't know how to fix this.<br>
I'm new to LLVM and need some help in it...</div>
</div>
</div>
<br>
<div class="gmail_quote">
<div dir="ltr">вт, 25 сент. 2018 г. в 21:12, Friedman, Eli <<a href="mailto:efriedma@codeaurora.org" target="_blank">efriedma@codeaurora.org</a>>:<br>
</div>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On 9/24/2018
6:47 AM, Павел Безбородов via llvm-dev wrote:<br>
> I want to write a simple backend-specific instrinsic that
will just <br>
> call an instruction. How should I do that?<br>
<br>
Is this really not documented anywhere...?<br>
<br>
Anyway, the basic steps:<br>
<br>
1. Add the builtin to the list of intrinsics for your target:
<br>
include/llvm/IR/IntrinsicsYourTarget.td. Use a GCCBuiltin for
the <br>
corresponding C intrinisc name.<br>
2. Teach your target to lower the intrinsic to an instruction;
you can <br>
usually just use the name of the intrinsic in a pattern in <br>
lib/Target/YourTarget/YourTargetInstrInfo.td.<br>
3. Add the builtin to
include/clang/Basic/BuiltinsYourTarget.def<br>
<br>
An example of an intrinsic implemented this way is
int_arm_qadd8 in the <br>
ARM backend (corresponding to the C builtin
__builtin_arm_qadd8); it <br>
should be straightforward to follow that example.<br>
<br>
This approach assumes your intrinsic is simple: it returns at
most one <br>
value, and all the parameter and return types are legal. If
that isn't <br>
true, you might need to write some C++ code to handle it in
clang or in <br>
your backend.<br>
<br>
Maybe we should add this as a section to <br>
<a href="http://llvm.org/docs/WritingAnLLVMBackend.html" rel="noreferrer" target="_blank">http://llvm.org/docs/WritingAnLLVMBackend.html</a>
.<br>
<br>
-Eli<br>
<br>
-- <br>
Employee of Qualcomm Innovation Center, Inc.<br>
Qualcomm Innovation Center, Inc. is a member of Code Aurora
Forum, a Linux Foundation Collaborative Project<br>
<br>
</blockquote>
</div>
</blockquote>
<p><br>
</p>
<pre class="m_-3547257306139825256m_823037147963819305moz-signature" cols="72">--
Employee of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project</pre>
</div>
</blockquote></div></div></div>