<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body>
    <p>As a generic note, I don't believe that there are many places
      within TableGen's set of code generators that handle 'code' values
      as pass-through in the way you hint at below. One place that does
      is SearchableTable/GenericTable field values, and that is pretty
      useful.</p>
    <p> -Hal<br>
    </p>
    <div class="moz-cite-prefix">On 6/28/20 11:06 AM, Chris Sears via
      llvm-dev wrote:<br>
    </div>
    <blockquote type="cite" cite="mid:CALKdvkbSYfMTGyuwgZ3AMm-FtbWx5oBRvTPE+hDP0od5t8714A@mail.gmail.com">
      
      <div dir="ltr">
        <div class="gmail_default" style="font-size:small">I figured out
          the answer to my problem. I use const MCInstrDesc  desc =
          MCII->get(x) to get the same information. It's just that I
          was writing TableGen descriptions and so I thought the answer
          would be in TableGen.</div>
      </div>
      <br>
      <div class="gmail_quote">
        <div dir="ltr" class="gmail_attr">On Sat, Jun 27, 2020 at 10:49
          AM Chris Sears <<a href="mailto:chris.sears@gmail.com" moz-do-not-send="true">chris.sears@gmail.com</a>> wrote:<br>
        </div>
        <blockquote class="gmail_quote" style="margin:0px 0px 0px
          0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
          <div dir="ltr">I'd like to store a tablegen generated
            enumeration in a record field/value. Clearly this
            enumeration isn't available yet so it seems that a code
            fragment should be the escape mechanism I need. Looking at
            the other backends for examples, I see things like<br>
            <br>
            <span class="gmail_default" style="font-size:small">    </span>[{
            return Imm >= 0 && Imm < 64; }]              
            // promising<br>
            <span class="gmail_default" style="font-size:small">    </span>code
            Requires = [{ {} }];                                 // <span class="gmail_default" style="font-size:small">this </span>looks
            like a string<br>
            <span class="gmail_default" style="font-size:small">    </span>let
            Requires = [{ {AArch64::FeatureETE} }].  // <span class="gmail_default" style="font-size:small">which is </span>not
            promising<br>
            <br>
            So I think<span class="gmail_default" style="font-size:small"> that</span> <span class="gmail_default" style="font-size:small">this</span> would
            look something like:<br>
            <br>
            <div><span class="gmail_default" style="font-size:small">   
              </span>int reg_index           = -1;</div>
            <div>
              <div class="gmail_default" style="font-size:small">    ...</div>
              <span class="gmail_default" style="font-size:small">    </span>let
              reg_index = [{ return XX::R8; }];             <span class="gmail_default" style="font-size:small">  // </span>or<br>
              <span class="gmail_default" style="font-size:small">    </span>let
              reg_index = [{ {XX::R8} }];<br>
              <br>
              However, then<span class="gmail_default" style="font-size:small"> </span>I<span class="gmail_default" style="font-size:small"> </span>get
              errors of the form:<br>
              <br>
              <span class="gmail_default" style="font-size:small">    </span>error:
              Value 'reg_index' of type 'int' is incompatible with
              initializer '[{ {XX::R8} }]' of type 'code'
              <div>
                <div class="gmail_default" style="font-size:small">   
                  error: Value 'reg_index' of type 'int' is incompatible
                  with initializer '[{ return XX::R8; }]' of type 'code'</div>
                <br>
                Is there a way of doing this? I don't understand
                TableGen casting but is that necessary?</div>
            </div>
          </div>
        </blockquote>
      </div>
      <br clear="all">
      <div><br>
      </div>
      -- <br>
      <div dir="ltr" class="gmail_signature">Ite Ursi</div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <pre class="moz-quote-pre" wrap="">_______________________________________________
LLVM Developers mailing list
<a class="moz-txt-link-abbreviated" href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a>
<a class="moz-txt-link-freetext" href="https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev">https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a>
</pre>
    </blockquote>
    <pre class="moz-signature" cols="72">-- 
Hal Finkel
Lead, Compiler Technology and Programming Languages
Leadership Computing Facility
Argonne National Laboratory</pre>
  </body>
</html>