<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr">
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;font-family:Calibri,Arial,Helvetica,sans-serif;" dir="ltr">
<p></p>
<div>Hi,</div>
<div><br>
</div>
<div>I need to create a template function after parsing the following.</div>
<div> Later on seeing a fucntion call I concretize the types.- </div>
<div><br>
</div>
<div>( bits(N)) test ( bits(5) x , bits(M) y)</div>
<div>{</div>
<div>      bits(N) x =  x EOR y ; </div>
<div><br>
</div>
<div>}</div>
<div><br>
</div>
<div><br>
</div>
<div>Let's say I manage to implement "classof" correctly </div>
<div>and dyn_cast<> works. </div>
<div><br>
</div>
<div>An issue that I think may be possible would be that I would</div>
<div> not be able to distinguish between "N" and "M" </div>
<div>here. I mean LLVM uses immutable types , and the llvm::Type </div>
<div>file mentions that I will need to modify llvm::Type::getPrimitiveType() </div>
<div>to return my new type , and there can only be a single instance.</div>
<div><br>
</div>
<div>If I am required to distinguish between "N" and "M" , I need to dyn_cast</div>
<div>and there must be more than one instance of my Type.</div>
<div><br>
</div>
<div>Thanks,</div>
<div>Malhar</div>
<p></p>
<div dir="ltr">
<div id="x_divtagdefaultwrapper" dir="ltr" style="font-size: 12pt; color: rgb(0, 0, 0); font-family: Calibri, Arial, Helvetica, sans-serif, EmojiFont, "Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Segoe UI Symbol", "Android Emoji", EmojiSymbols;">
<div></div>
</div>
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="x_divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>From:</b> Tim Northover <t.p.northover@gmail.com><br>
<b>Sent:</b> Saturday, June 10, 2017 2:23:35 AM<br>
<b>To:</b> Jajoo, Malhar<br>
<b>Cc:</b> llvm-dev@lists.llvm.org<br>
<b>Subject:</b> Re: [llvm-dev] Subclassing LLVM Type</font>
<div> </div>
</div>
</div>
<font size="2"><span style="font-size:10pt">
<div class="PlainText">On 9 June 2017 at 16:17, Jajoo, Malhar via llvm-dev<br>
<llvm-dev@lists.llvm.org> wrote:<br>
> I don't want to change my AST structure to accept a<br>
> non-concrete type.<br>
<br>
That sounds like a hack to me. If it's expected to convey no actual<br>
information what about an llvm::Optional, or even the dreaded nullptr?<br>
A Type that's sort of valid sometimes but not really seems like the<br>
worst of all possible worlds.<br>
<br>
> Would changing the enum in the llvm::Type<br>
> class be enough ?<br>
<br>
No, you'd also have to implement "classof" in your DummyType.<br>
<br>
Cheers.<br>
<br>
Tim.<br>
</div>
</span></font></div>
</body>
</html>