[LLVMdev] Help with Instruction Expansion on Mips

Reed Kotler rkotler at mips.com
Fri Jul 20 07:02:59 PDT 2012


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 list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20120720/65fd2b4a/attachment.html>


More information about the llvm-dev mailing list