<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<p><br>
</p>
<div class="moz-cite-prefix">On 08/23/2017 11:35 AM, Jakob Stoklund
Olesen wrote:<br>
</div>
<blockquote cite="mid:E9163744-9024-4A0A-9BB5-247134E42A8E@2pi.dk"
type="cite">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<br class="">
<div>
<blockquote type="cite" class="">
<div class="">On Aug 22, 2017, at 14:15, Hal Finkel via
llvm-dev <<a moz-do-not-send="true"
href="mailto:llvm-dev@lists.llvm.org" class="">llvm-dev@lists.llvm.org</a>>
wrote:</div>
<br class="Apple-interchange-newline">
<div class=""><span style="font-family: Menlo-Regular;
font-size: 12px; font-style: normal; font-variant-caps:
normal; font-weight: normal; letter-spacing: normal;
text-align: start; text-indent: 0px; text-transform: none;
white-space: normal; word-spacing: 0px;
-webkit-text-stroke-width: 0px; float: none; display:
inline !important;" class="">For situations well beyond
TableGen's current language capabilities, we have a
decision to make. We can continue extending TableGen until
it can meet those needs. Alternatively, we can enable the
use of some more-powerful input language. For example, we
could allow TableGen to embed Python, and then use Python
in order to generate record definitions.</span></div>
</blockquote>
</div>
<br class="">
<div class="">For a project that’s not LLVM, I recently had the
opportunity to replace both TableGen and *.td files with Python
scripts. I found that TableGen’s features were easily matched by
Python’s for loops and the ability to define functions. I am
pretty happy with the approach so far. AMA</div>
</blockquote>
<br>
Interesting, thanks.<br>
<br>
<blockquote cite="mid:E9163744-9024-4A0A-9BB5-247134E42A8E@2pi.dk"
type="cite">
<div class=""><br class="">
</div>
<div class="">This is a lot easier to do in a green field project
than in an old project like LLVM, of course.</div>
</blockquote>
<br>
If we want to go down that route, I can certainly imagine a feasible
incremental-transitioning strategy. We could allow TableGen to use
an embedded Python interpreter to generate records based on Python
data structures, and then, combine records from the existing .td
files with those generated by the Python code. We'd use the existing
TableGen plugins (which we may need to continue to use regardless,
compared to writing Python, for performance reasons), and so we
could incrementally transition existing definitions from .td files
to Python as appropriate.<br>
<br>
-Hal<br>
<br>
<blockquote cite="mid:E9163744-9024-4A0A-9BB5-247134E42A8E@2pi.dk"
type="cite">
<div class=""><br class="">
</div>
<div class="">Example “.td” file: <a moz-do-not-send="true"
href="https://github.com/stoklund/cretonne/blob/master/lib/cretonne/meta/isa/riscv/encodings.py"
class="">https://github.com/stoklund/cretonne/blob/master/lib/cretonne/meta/isa/riscv/encodings.py</a></div>
<div class=""><br class="">
</div>
<div class="">Thanks,</div>
<div class="">/jakob</div>
</blockquote>
<br>
<pre class="moz-signature" cols="72">--
Hal Finkel
Lead, Compiler Technology and Programming Languages
Leadership Computing Facility
Argonne National Laboratory</pre>
</body>
</html>