[LLVMdev] Help with Instruction Expansion on Mips

Geraint Yang geraint0923 at gmail.com
Fri Jul 20 07:20:13 PDT 2012


Thanks for your reply.

We are trying to implement a simple Mips-based CPU with just for teaching
purpose, so we delete some instructions which are not commonly used, thus
the task won't be too hard for students. I am responsible for modifying the
compiler so that the compiler won't emit unsupported instructions.

In order to avoid "can not select" error, I am trying to expand these
instructions when meeting them.

So what should I modify to achieve the goal?


Thanks,
Yang


On Fri, Jul 20, 2012 at 10:02 PM, Reed Kotler <rkotler at mips.com> wrote:

>  why do you want to "ban" certain instructions?
>
> is this for some architectural variant?
>
> the compiler is trying to match patterns from the target independent part
> of the code generator.
>
> if you remove instructions, the compiler in many cases will no longer be
> able to match certain patterns
> and you will get thos "can not select" messages.
>
>
> On 07/20/2012 03:05 AM, Geraint Yang wrote:
>
> Hi everyone,
>
> I am a newbie to LLVM. I am trying to ban some of instructions in Mips
> Instruction, for example, lh, lhu, sh, and etc.
> I have tried to directly comment lh, lhu, and sh to make llvm not to
> choose these instruction when compiling, however, it usually cause a 'can
> not select ...' error when using 'short' data type in source code.
> Then I tried to expand these instructions in EmitInstrWithCustomInserter
> in file lib/Target/Mips/MipsISelLowering.cpp, just as commit in:
>
>
> https://github.com/geraint0923/LLVM-ThuMips/commit/6a9ca907f3e945c2bb1f9627e0e5fdcbd7964da2
>
> It works fine for lh and lhu, and fails for sh:
> when expanding sh, there are four instruction, but in *.s generated by
> modified llvm's llc, there are only two instructions which are both sb,
> addiu and srl are gone.
>
> Is there anything wrong when expanding?
> And I wonder if there is another method to do the same thing.
>
> Any help will be appreciated.
>
>
> Thanks,
> Yang
>
> _______________________________________________
> LLVM Developers mailing listLLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.eduhttp://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>
>
>


-- 
Geraint Yang
Tsinghua University Department of Computer Science and Technology
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20120720/44536f53/attachment.html>


More information about the llvm-dev mailing list