<html dir="ltr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style id="owaParaStyle" type="text/css">P {margin-top:0;margin-bottom:0;}</style>
</head>
<body ocsi="0" fpstyle="1">
<div style="direction: ltr;font-family: Tahoma;color: #000000;font-size: 10pt;">Hi,<br>
<br>
The Mips target is doing this for Mips32r6/Mips64r6 by defining two instructions, one predicated on having a feature, the other on not having it. The instruction selection then picks the right one for the subtarget. CLO and CLO_R6 is a good example. A more
 complicated example is PseudoReturn, JR, and JALR which is the same general idea but we use a Pseudo and select the real instruction much later.<br>
<br>
We also do this on a larger scale for microMIPS but I don't fully understand the details of that code yet.<br>
<div style="font-family: Times New Roman; color: #000000; font-size: 16px">
<hr tabindex="-1">
<div style="direction: ltr;" id="divRpF880239"><font color="#000000" face="Tahoma" size="2"><b>From:</b> llvmdev-bounces@cs.uiuc.edu [llvmdev-bounces@cs.uiuc.edu] on behalf of Dylan McKay [dylanmckay34@gmail.com]<br>
<b>Sent:</b> 30 January 2015 06:50<br>
<b>To:</b> llvmdev@cs.uiuc.edu<br>
<b>Subject:</b> [LLVMdev] Different instruction encodings based on subtarget features<br>
</font><br>
</div>
<div></div>
<div>
<div dir="ltr">I am working on an LLVM backend for the AVR architecture, and am having troubles working with the codegen layer, trying to get around the quirks of the binary encodings of the AVR ISR.
<div><br>
</div>
<div>There are several different families of AVR microcontrollers, each with a minimum 'core' instruction set. Each family builds upon (or removes) the core ISR with more instructions or different encodings.</div>
<div><br>
</div>
<div>My context is that the binary encodings of certain instructions differ solely with the 'AVR Tiny' family of devices (see the bottom row of the tabled headed "Instruction set inheritance" linked
<a href="http://en.wikipedia.org/wiki/Atmel_AVR_instruction_set" target="_blank">
here</a>). I have a subtarget feature specifically for each CPU family.</div>
<div><br>
</div>
<div>What I would like to do is choose a different instruction encoding based on whether or not the 'AVR Tiny' subtarget feature is enabled. I have found
<a href="http://lists.cs.uiuc.edu/pipermail/llvmdev/2012-November/055149.html" target="_blank">
this</a> link to a LLVMdev email which is quite dated, and if I may say so myself -- is a dirty hack.</div>
<div><br>
</div>
<div>Is there a way to do this without hacking the build system?</div>
</div>
</div>
</div>
</div>
</body>
</html>