TriDis / llvm-tricore

LLVM Compiler Infrastructure with TriCore backend
Other
27 stars 9 forks source link

Use it in current LLVM #3

Open thetemplar opened 1 year ago

thetemplar commented 1 year ago

Hi, i am trying to merge this TriCore target into the current version of llvm. I fixed some minor changes, but am stuck at here:

ADJCALLSTACKDOWN changed, so I had to add $amt2:

// Pseudo Instructions
//===----------------------------------------------------------------------===//

let Defs = [A10], Uses = [A10] in {
def ADJCALLSTACKDOWN : Pseudo<(outs), (ins i32imm:$amt1, i32imm:$amt2),
                                    "# ADJCALLSTACKDOWN $amt1",
                                    [(callseq_start timm:$amt1, timm:$amt2)]>;
def ADJCALLSTACKUP   : Pseudo<(outs), (ins i32imm:$amt1, i32imm:$amt2),
                                    "# ADJCALLSTACKUP $amt1",
                                    [(callseq_end timm:$amt1, timm:$amt2)]>;
}

This now leads to this error:

Included from /home/graul/test/llvm-project/llvm/lib/Target/TriCore/TriCore.td:25:
/home/graul/test/llvm-project/llvm/lib/Target/TriCore/TriCoreInstrInfo.td:242:5: error: In ADJCALLSTACKDOWN: Could not infer all types in pattern!
def ADJCALLSTACKDOWN : Pseudo<(outs), (ins i32imm:$amt1, i32imm:$amt2),
    ^

But after hours if comparing it to existing/working projects, I still do not know what the problem here is.

I know you did not work on this for several years, but do you have an idea anyway?

Thanks!

sidneyp commented 1 year ago

Hi,

That is so nice you are doing that! I think I can still help. I believe the problem is in the definition of "callseq_start" that you didn't update too.

Here is the location where you should change: SDT_TriCoreCallSeqStart

Hope it works!

XVilka commented 1 year ago

@thetemplar the full support of Tricore was added into the mainstream capstone: https://github.com/capstone-engine/capstone/tree/next/arch/TriCore Many of TableGen files were updated. Even though we targeted only disassembly, it should be helpful for the code generation as well, if you plan to work on this in the future.

Feel free to try and report any bugs if there are any, pull requests are welcome too.

See also https://github.com/TriDis/ditricore/issues/2#issuecomment-1600261757

XVilka commented 1 year ago

@imbillow sent a draft PR with those updated files. If there is anyone who wants continue this work - they could use them as a base: https://github.com/TriDis/llvm-tricore/pull/4