<div dir="ltr">Johnny,<br><div id="gt-src-tools"><div id="gt-src-tools-l"><div style="display:inline-block" id="gt-input-tool"><div id="itamenu"><span class=""></span></div></div></div></div> <div id="gt-res-content" class=""><div dir="ltr" style="zoom:1"><span id="result_box" class="" lang="en"><span class="">It makes sense</span><span>!</span> </span><br><div style><span id="result_box" class="" lang="en"><span class="">I will try fix the code.<br></span></span></div><span id="result_box" class="" lang="en"><br> <span class="">Thank you</span> <span class="">for the tips</span><span class="">!!<br><br></span></span></div>Cheers,<br></div><div class="gmail_extra"><br clear="all"><div><div class="gmail_signature">Carlos Almeida Jr<br></div></div>
<br><div class="gmail_quote">On Thu, Nov 27, 2014 at 9:19 AM, Johnny Val <span dir="ltr"><<a href="mailto:johnnydval@gmail.com" target="_blank">johnnydval@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On Thu, Nov 27, 2014 at 11:07 AM, Carlos Almeida Jr.<br>
<<a href="mailto:almeidajr@gmail.com">almeidajr@gmail.com</a>> wrote:<br>
><br>
> Hi Johnny,<br>
><br>
> Thank you for your help. I guess the pseudo instruction does not interfere in the generated assembly code.<br>
> I'll check the file that describes the registers and I hope understand why the assembly code is printed wrong (now is printed things like add r1, r0, -40).<br>
<br>
<br>
</span>It is printing things like that because you have an instruction which<br>
lets you you add a register and an immediate. If you remove that<br>
instruction LLVM will do what you want.<br>
<br>
For your specific case (modifying CPU0) if you remove:<br>
<br>
def ADDiu : ArithLogicI<0x09, "addiu", add, simm16, immSExt16, CPURegs>;<br>
<br>
from CPU0InstrInfo.td then you should get the output you expect.<br>
<div class="HOEnZb"><div class="h5"><br>
><br>
> Cheers,<br>
> Carlos<br>
><br>
> Carlos Almeida Jr<br>
><br>
> On Thu, Nov 27, 2014 at 7:56 AM, Johnny Val <<a href="mailto:johnnydval@gmail.com">johnnydval@gmail.com</a>> wrote:<br>
>><br>
>> Hi Carlos,<br>
>><br>
>> LLVM will do this automatically for you! There is no need for a pseudo instruction in this case. As long as you have a way of adding two i32s (or any other type) using registers then LLVM will automatically do what you described when immediates are involved.<br>
>><br>
>> Cheers,<br>
>><br>
>> Johnny<br>
>><br>
>> On Wed, Nov 26, 2014 at 11:50 PM, Carlos Almeida Jr. <<a href="mailto:almeidajr@gmail.com">almeidajr@gmail.com</a>> wrote:<br>
>>><br>
>>> Hi,<br>
>>><br>
>>> I'm a beginner user using LLVM, and I'm trying to create a new backend using CPU0 Tutorial as reference.<br>
>>> I have two instructions for add: add and addi (this is a pseudo instruction, but imediate operations is not available in architecture).<br>
>>> That is my idea: When the LLVM instruction selection find addi r3 = r2 + value<br>
>>><br>
>>> must convert to this:<br>
>>><br>
>>> - load r1, value<br>
>>> - add r3 = r2 + r1<br>
>>><br>
>>> In archInstrInfo.td I declared the instructions of the architecture, but I dont know how to "split" addi instruction. I tryed understand the LLVM and CPU0 documentation for solve this but I not found anything. :(<br>
>>><br>
>>> Could anyone help me?<br>
>>><br>
>>> Thanks<br>
>>> Carlos<br>
>>><br>
>>> _______________________________________________<br>
>>> LLVM Developers mailing list<br>
>>> <a href="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</a> <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>
>>><br>
>><br>
><br>
</div></div></blockquote></div><br></div></div>