<html dir="ltr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style id="owaParaStyle" type="text/css">P {margin-top:0;margin-bottom:0;}</style>
</head>
<body ocsi="0" fpstyle="1" style="word-wrap:break-word">
<div style="direction: ltr;font-family: Tahoma;color: #000000;font-size: 10pt;">Hi Jim,<br>
thank you for the quick response. I have used InstAlias in some cases, but these are really simple pseudo instructions where the  pseudo instruction is more like a special case of existing one, like using fixed operand or simply a more human understandable
 way of presenting an operation. I know that there are predicates available to improve matching, but can InstAlias use conditions to choose between different replacements, like the ones I stated for load immediate? I have thought of expanding instructions after
 successful match but I was hoping that there is some kind of mechanism from tableGen that can be used for the purpose as the former way seems to me more like a hack.<br>
<br>
Kind regards<br>
<br>
Vladimir<br>
<div style="font-family: Times New Roman; color: #000000; font-size: 16px">
<hr tabindex="-1">
<div style="direction: ltr;" id="divRpF695744"><font color="#000000" face="Tahoma" size="2"><b>From:</b> Jim Grosbach [grosbach@apple.com]<br>
<b>Sent:</b> Thursday, August 09, 2012 6:18 PM<br>
<b>To:</b> Medic, Vladimir<br>
<b>Cc:</b> llvmdev@cs.uiuc.edu<br>
<b>Subject:</b> Re: [LLVMdev] Pseudo instructions expansion<br>
</font><br>
</div>
<div></div>
<div>
<div>Hi Vladimir,</div>
<div><br>
</div>
<div>The pass you refer to isn't used by the assembler at all. That's strictly a compiler codegen thing. The assembler equivalents are expressed via InstAlias constructions. Again, though, those are for a single output instruction, so you need something more. Sprecifically,
 you can handle assembly pseudo-instructions in C++ code. Something like the ARM assembler's processInstruction() hook would be an appropriate place.</div>
<div><br>
</div>
<div>-Jim</div>
<div><br>
</div>
<br>
<div>
<div>On Aug 9, 2012, at 3:26 AM, "Medic, Vladimir" <<a href="mailto:vmedic@mips.com" target="_blank">vmedic@mips.com</a>> wrote:</div>
<br class="Apple-interchange-newline">
<blockquote type="cite">
<div style="font-family:Helvetica; font-size:medium; font-style:normal; font-variant:normal; font-weight:normal; letter-spacing:normal; line-height:normal; orphans:2; text-indent:0px; text-transform:none; white-space:normal; widows:2; word-spacing:0px">
<div style="direction:ltr; font-family:Tahoma; font-size:10pt">Hi all,<br>
I'm trying to solve a problem that we have in implementation of the assembler for Mips platform in llvm. Mips has some pseudo instructions that, depending on the arguments can be emitted as one or more real instructions by the assembler.<span class="Apple-converted-space"> </span><br>
<pre class="bz_comment_text" id="comment_text_0"><font face="Tahoma">For example load immediate instruction can have multiple expansions depending on a size of immediate operand:
This expansion is for 0 ≤ j ≤ 65535.</font>
li d,j =>
ori d,$zero,j
<font face="Tahoma">This one is for −32768 ≤ j < 0.</font>
li d,j =>
addiu d,$zero,j
<font face="Tahoma">This one is for any other value of j that is representable as a 32-bit integer.</font>
li d,j =>
lui d,hi16(j)
ori d,d,lo16(j)</pre>
<font face="Tahoma">I have found that class PseudoLoweringEmitter emits code which deals with PseudoInstExpansion.<span class="Apple-converted-space"> </span></font><font face="Tahoma">This sounds like exactly what we need , but</font><font face="Tahoma">,
 as stated in comment in PseudoLoweringEmitter.cpp:<span class="Apple-converted-space"> </span><br>
// FIXME: This pass currently can only expand a pseudo to a single instruction.<span class="Apple-converted-space"> </span><br>
// The pseudo expansion really should take a list of dags, not just<span class="Apple-converted-space"> </span><br>
// a single dag, so we can do fancier things.<span class="Apple-converted-space"> </span><br>
<br>
Are the 'fancier things' mentioned in the comment</font><span class="Apple-converted-space"> </span>things that we need, expansion to a multiple instructions and could they use operand values as conditions for different expansions?<br>
Could it work for inline asm in C code, with/without direct-object emitter?<br>
<br>
Kind Regards<br>
<br>
Vladimir<br>
</div>
_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:LLVMdev@cs.uiuc.edu" target="_blank">LLVMdev@cs.uiuc.edu</a><span class="Apple-converted-space"> </span>        <a href="http://llvm.cs.uiuc.edu" target="_blank">http://llvm.cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br>
</div>
</blockquote>
</div>
<br>
</div>
</div>
</div>
</body>
</html>