<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/65937>65937</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            A way to create data layout without creating target machine
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          Panzerschrek
      </td>
    </tr>
</table>

<pre>
    I am developing a language server for my language. I need to obtain proper data layout for selected target in order to run my compiler frontend logic.
Right now i need to create target machine to construct data layout. In order to create target machine i need to link against target library (libraries), like X86 target. But doing this i create huge dependency on whole target code, including asm parsers, code generators, optimizers etc.
But for the language server this code is unnecessary. All these code is useless and only increases result executable size - up to 20mb for single X86 target, or up to 80 mb (or more) for all targets.

I found, that internally at least some data layout computation functions are relatively simple - they are just free functions with no side effects that build data layout based ob provided target triple. So, i suggest to make these functions accessible via public header(s). It would be even better to move these functions into some library, independent on target libraries, in order to have possibility to compute data layout without even building any target library.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJxsVM1u4zgTfBr50oigUHbGPuiQzCBAbh--vey1RbalnlCkwG7aq3n6BWUnsXfmIgnqv2JVsVGEh0DUVbuXavdjg1nHmLr_YfhFSeyY6H3TR7d0b4ATODqRjzOHARA8hiHjQCCUTpTgGBNMy-fvGt4gEDnQCLFX5ABzijMlcKileolZ1yIhT1ZLJqaBFDhATI5SqUw5lKY2TjP7MiTFoBQc-DiwravmR9U8_5-HUSHEM_DnSJsIlT5aTmhHDrQGYhBN2eotjhrebob-ufart-fwDjggB9GPLM99wrRAZfaXTyapzKEy38HzO8Hf-6drag0vWcHFwqKOLMAfA8c8EDiaKTgKdoEY4DxG_4nERkelIQfrs1tVkAlmTEJJSqAkwECBEmq8_Iqz8sRFTCD9IOzlyryO9JuMK6S1EQvkEMiSCKalhmfvS4XQV7hIJwIYHMTgl4IsEQoJJJLsFegfslmx9wTCvwgeIM-FQtNM_UV8DoO_pWcFna5p-wamvnBavBUTVeawVmGBsqbL9UiX5xscYw6u9NARi5WUUkDvF0AFTygKEie682AxV1ZUjgGOOdjyIYCJIJFH5RP5BYSn2Rf8OtKyBn9mUTgmopuiM-sIIYKwI6DjkazKBUmf2bu7sT0KOYh9uRYndl_-18Szpxr-iqvYIHkYqDgtwoTvdNXgBqktEnHh-MQIc-49WxgJHaXK7IsNa3hTOMfsHfQEdKIAPale7D7F0-9NOWi8UHV19sV4H-7UYs47669-_353eUc8EcyxYGPPulyuXyH7XoDCWnlfcBWiVm-H5T-Xq964rnWH9oAb6h6fDtutMbv2aTN2brcl07eGcG-_GWps3-xMS-2j2bvHY7_dcGca0zaHx8dmv9u1T_Uet3s6uobMdte2dl9tG5qQfe39aapjGjYskql72h3abxuPPXlZl6Qxgc6wBitjys5MXal56PMg1bbxLCpfXZTVU_cMZ1xuVsufTr-G1qVwt3c2OfluVJ2lap8r81qZ14F1zH1t41SZ1zLp-nqYU_xJVivzuuKTyryu-P8NAAD__-FSFS8">