<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Exchange Server">
<!-- converted from text --><style><!-- .EmailQuote { margin-left: 1pt; padding-left: 4pt; border-left: #800000 2px solid; } --></style>
</head>
<body>
<meta content="text/html; charset=UTF-8">
<style type="text/css" style="">
<!--
p
        {margin-top:0;
        margin-bottom:0}
-->
</style>
<div dir="ltr">
<div id="x_divtagdefaultwrapper" dir="ltr" style="font-size:12pt; color:#000000; font-family:Calibri,Arial,Helvetica,sans-serif">
<p>Hi Tim,</p>
<p><br>
</p>
<p>Thanks for your reply. <br>
<br>
I am just interested in having a dyn_cast functionality for my dummy type.<br>
I do not care if it behaves as a type in any other way nor require LLVM <br>
Backend to interact with it in any way.<br>
<br>
The language that I want to compile is actually like this -<br>
<br>
</p>
<div>(<span style="color:rgb(255,0,0)">bits(</span><b><span style="color:rgb(255,0,0)">N</span></b><span style="color:rgb(255,0,0)">)</span>) test2(<span style="color:rgb(255,0,0)">bits(N)</span> x,<span style="color:rgb(255,0,0)"> b</span><span style="color:rgb(255,0,0)">its(</span><span style="color:rgb(255,0,0)"></span><span style="color:rgb(255,0,0)">N)
</span>y)</div>
<div>{ </div>
<div><span class="x_Apple-tab-span" style="white-space:pre"></span></div>
<div><span class="x_Apple-tab-span" style="white-space:pre"></span><span style="color:rgb(255,0,0)">bits(N)</span> res = x EOR y;</div>
<div><br>
</div>
<div><span class="x_Apple-tab-span" style="white-space:pre"></span>// return result ( implciilty extended it - simple ) </div>
<div><span class="x_Apple-tab-span" style="white-space:pre"></span>return res;</div>
<div><br>
</div>
<div>}</div>
<div><br>
</div>
<div><br>
</div>
<div>(integer) main()</div>
<div>{</div>
<div><span class="x_Apple-tab-span" style="white-space:pre"></span>bits(5) a= '01100'; </div>
<div><span class="x_Apple-tab-span" style="white-space:pre"></span>bits(5) b= '01110';</div>
<div><span class="x_Apple-tab-span" style="white-space:pre"></span></div>
<div>// on seeing function call , we concretize the types </div>
<div>// in the function template above. </div>
<div><span class="x_Apple-tab-span" style="white-space:pre"></span>bits(5) d =<b> test2(a,b);  </b></div>
<div><span class="x_Apple-tab-span" style="white-space:pre"></span>print(d);</div>
<div>}</div>
<div><br>
</div>
<div>My current AST accepts a concrete type.</div>
<div><span style="font-size:12pt">The part in red  is a non-concrete type.<br>
</span>I don't want to change my AST structure to accept a <br>
non-concrete type.<br>
<br>
Hence I wish to use a dummy class.</div>
<div>The code I showed earlier works but the <br>
only issue is I need LLVM "dyn_cast".<br>
Would changing the enum in the llvm::Type <br>
class be enough ?</div>
<div><br>
</div>
<div>Thanks,</div>
<div>Malhar </div>
<p></p>
</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:08:03 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 15:29, Jajoo, Malhar via llvm-dev<br>
<llvm-dev@lists.llvm.org> wrote:<br>
> Thanks for that , I have read the documentation on this , but I would like to know<br>
> if it would be the right thing to do , ie , changing the enum within llvm::Type<br>
<br>
Well, I find the idea of a non-canonical DummyType slightly disturbing<br>
(I don't think it's something we'd ever support officially). But you<br>
might be able to make it work and if you need dyn_cast then modifying<br>
that enum is about the only way to get it.<br>
<br>
Do you know that there's such a thing as an "opaque type" in LLVM, by<br>
the way? You haven't said what you need this DummyType for but it<br>
might serve as a replacement. Basically you start off with an<br>
unspecified struct type that you can then fill the details in for<br>
later.<br>
<br>
> and I'm slightly unclear on how I can update the C binding ?<br>
> Can someone kindly clarify that ?<br>
<br>
Can't help you there, I'm afraid. I've never used the C API and barely<br>
looked at it.<br>
<br>
Tim.<br>
</div>
</span></font>
</body>
</html>