<font size=2 face="sans-serif">Hello Tim,</font>
<br>
<br><font size=2 face="sans-serif">thank you for the response! Are there
tutorials for the points 1 and 3 available? I'm still a cub with the LLVM...</font>
<br>
<br><font size=2 face="sans-serif">Kind regards</font>
<br><font size=2 face="sans-serif">Björn</font>
<br>
<br>
<br>
<br><font size=1 color=#5f5f5f face="sans-serif">From:      
 </font><font size=1 face="sans-serif">Tim Northover <t.p.northover@gmail.com></font>
<br><font size=1 color=#5f5f5f face="sans-serif">To:      
 </font><font size=1 face="sans-serif">bjoern.gaier@horiba.com</font>
<br><font size=1 color=#5f5f5f face="sans-serif">Cc:      
 </font><font size=1 face="sans-serif">LLVM Developers Mailing
List <llvm-dev@lists.llvm.org></font>
<br><font size=1 color=#5f5f5f face="sans-serif">Date:      
 </font><font size=1 face="sans-serif">09.04.2018 12:09</font>
<br><font size=1 color=#5f5f5f face="sans-serif">Subject:    
   </font><font size=1 face="sans-serif">Re: [llvm-dev]
Possibilities with LLVM</font>
<br>
<hr noshade>
<br>
<br>
<br><tt><font size=2>Hi Björn,<br>
<br>
On 9 April 2018 at 09:43, via llvm-dev <llvm-dev@lists.llvm.org>
wrote:<br>
> 1.) Can I teach the LLVM new platform depended intrinsics?<br>
> Like I provide assembly code and want to create a custom intrinsic
for it.<br>
<br>
Yes. You'd add a declaration to include/llvm/IR/IntrinsicsXYZ.td<br>
(where XYZ is your target), and then you can select them with a normal<br>
pattern in your target's .td files.<br>
<br>
On the Clang side you'd add it to include/clang/Basic/BuiltinsXYZ.def<br>
and lib/CodeGen/CGBuiltin.cpp. Possibly lib/Sema/SemaChecking.cpp too<br>
if it has strange validity requirements.<br>
<br>
> 2.) Does the IR language have some kind of template support?<br>
> I'm not sure if this even possible - but I thought about having a
template<br>
> function and when jitting the IR it could instantiate that template
with the<br>
> now known data - okay writing this already sounds weird and I'm not
sure if<br>
> I could explain what I wanted.<br>
<br>
No template support, I'm afraid. That would be handled by a language's<br>
front-end.<br>
<br>
> 3.) Can I implement my own custom calling convention? Like my own<br>
> "__planschiCall" or something?<br>
<br>
Yes. The easiest way would be to use a simple numbered calling<br>
convention "cc N" in the LLVM IR. Then you just have to add support
to<br>
lib/Target/XYZ/XYZISelLowering.cpp and the corresponding calling<br>
convention .td file (the name varies a bit). ISelLowering usually just<br>
involves a switch based on the call or definition that selects the<br>
right implementation from the .td file. Grep for CCAssignFnForCall to<br>
see the kind of thing you'll be changing.<br>
<br>
Clang side, you'll be changing lib/Targets/XYZ.cpp to either make it<br>
the default or support it via __attribute__((pcs("whatever"))).
See<br>
ARM.cpp for an example, it already uses both methods.<br>
<br>
Cheers.<br>
<br>
Tim.<br>
</font></tt>
<br>
<br><font size=2 face="sans-serif"><br>
Als GmbH eingetragen im Handelsregister Bad Homburg v.d.H. HRB 9816, USt.ID-Nr.
DE 114 165 789<br>
Geschäftsführer: Dr. Hiroshi Nakamura, Dr. Robert Plank, Markus Bode, Heiko
Lampert, Hiroshi Kawamura, Takashi Nagano, Takeshi Fukushima.<br>
<br>
</font>