[llvm-dev] Help: Implementing function call lowering for a Backend

floris westermann via llvm-dev llvm-dev at lists.llvm.org
Tue Apr 14 05:01:18 PDT 2020


Hello again,

I seem to have managed to fix the last error message a couple of days ago.

However, I right afterwards I got the following error:

$ ../bin/llc -mtriple=via64 call1.ll
> LLVM ERROR: Cannot select: t10: ch,glue = callseq_end t9,
TargetConstant:i64<0>, TargetConstant:i64<0>, t9:1
>   t4: i64 = TargetConstant<0>
>   t4: i64 = TargetConstant<0>
>   t9: ch,glue = VIA64ISD::CALL t5, t7, RegisterMask:Untyped
>     t7: i64 = MOVId TargetGlobalAddress:i64<void ()* @function2> 0 [TF=1]
>       t6: i64 = TargetGlobalAddress<void ()* @function2> 0 [TF=1]
>     t8: Untyped = RegisterMask
> In function: test_call_external2

I have been trying to find out what exactly the problem is for a couple of
days now and I am getting a little desperate.
Does anyone with more experience in tblgen know what exactly I have to
implement to lower callseq_end?

If this isn't the right place to ask these questions please let me know.

Cheers,
Floris


On Sat, 11 Apr 2020 at 14:01, floris westermann <westermann.floris at gmail.com>
wrote:

> Hi everyone,
>
> I am currently working on a backend for my bachelor thesis, using the
> patches by alex bradbury as a reference (
> https://github.com/lowRISC/riscv-llvm).
>
> However, whenever I try to lower the following file:
>
> play/call.ll:
> > declare i32 @external_function(i64)
>
> > define i32 @test_call_external(i64 %a) nounwind {
> >   %1 = add i64 %a, %a
> >   %2 = call i32 @external_function(i64 %1)
> >   ret i32 %2
> > }
>
> with
> $ ./bin/llc -mtriple=via64 play/call.ll
>
> TargetRegisterInfo::getMinimalPhysRegClass() fails because it could find
> an appropriate Register Class.
> I put a copy of the stack dump at the bottom.
>
> The register i am passing should be i64 (i checked at runtime, and it is).
> And my defined registers are all 64 bit as well.
>
> Does anyone know what could be wrong?
> I understand that this is probably not enough information to answer my
> question, but I didn't exactly know what code to send.
>
> Cheers,
> Floris Westermann
>
>
> Stack dump:
>
> > $ ./bin/llc -mtriple=via64 play/call.ll
> >
> > llc: ../lib/CodeGen/TargetRegisterInfo.cpp:208: const
> llvm::TargetRegisterClass
> *llvm::TargetRegisterInfo::getMinimalPhysRegClass(unsigned int, llvm::MVT)
> const: Assertion `BestRC && "Couldn't find the register class"' failed.
> > Stack dump:
> > 0. Program arguments: ./bin/llc -mtriple=via64 play/call.ll
> > 1. Running pass 'Function Pass Manager' on module 'play/call.ll'.
> > 2. Running pass 'VIA64 DAG->DAG Pattern Instruction Selection' on
> function '@test_call_external'
> >  #0 0x00007f5dfb508709 llvm::sys::PrintStackTrace(llvm::raw_ostream&)
> /home/fooris/github/llvm/build/../lib/Support/Unix/Signals.inc:544:11
> >  #1 0x00007f5dfb5088b9 PrintStackTraceSignalHandler(void*)
> /home/fooris/github/llvm/build/../lib/Support/Unix/Signals.inc:605:1
> >  #2 0x00007f5dfb5070b6 llvm::sys::RunSignalHandlers()
> /home/fooris/github/llvm/build/../lib/Support/Signals.cpp:67:5
> >  #3 0x00007f5dfb50904d SignalHandler(int)
> /home/fooris/github/llvm/build/../lib/Support/Unix/Signals.inc:391:1
> >  #4 0x00007f5dfa275890 __restore_rt
> (/lib/x86_64-linux-gnu/libpthread.so.0+0x12890)
> >  #5 0x00007f5df9571e97 raise
> /build/glibc-OTsEL5/glibc-2.27/signal/../sysdeps/unix/sysv/linux/raise.c:51:0
> >  #6 0x00007f5df9573801 abort
> /build/glibc-OTsEL5/glibc-2.27/stdlib/abort.c:81:0
> >  #7 0x00007f5df956339a __assert_fail_base
> /build/glibc-OTsEL5/glibc-2.27/assert/assert.c:89:0
> >  #8 0x00007f5df9563412 (/lib/x86_64-linux-gnu/libc.so.6+0x30412)
> >  #9 0x00007f5dfe84376a
> llvm::TargetRegisterInfo::getMinimalPhysRegClass(unsigned int, llvm::MVT)
> const
> /home/fooris/github/llvm/build/../lib/CodeGen/TargetRegisterInfo.cpp:209:10
> > #10 0x00007f5dfbace437 CheckForPhysRegDependency(llvm::SDNode*,
> llvm::SDNode*, unsigned int, llvm::TargetRegisterInfo const*,
> llvm::TargetInstrInfo const*, unsigned int&, int&)
> /home/fooris/github/llvm/build/../lib/CodeGen/SelectionDAG/ScheduleDAGSDNodes.cpp:133:32
> > #11 0x00007f5dfbacdfeb llvm::ScheduleDAGSDNodes::AddSchedEdges()
> /home/fooris/github/llvm/build/../lib/CodeGen/SelectionDAG/ScheduleDAGSDNodes.cpp:487:9
> > #12 0x00007f5dfbace492
> llvm::ScheduleDAGSDNodes::BuildSchedGraph(llvm::AAResults*)
> /home/fooris/github/llvm/build/../lib/CodeGen/SelectionDAG/ScheduleDAGSDNodes.cpp:538:1
> > #13 0x00007f5dfbab9d05 (anonymous
> namespace)::ScheduleDAGRRList::Schedule()
> /home/fooris/github/llvm/build/../lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp:0:3
> > #14 0x00007f5dfbacbcfd
> llvm::ScheduleDAGSDNodes::Run(llvm::SelectionDAG*,
> llvm::MachineBasicBlock*)
> /home/fooris/github/llvm/build/../lib/CodeGen/SelectionDAG/ScheduleDAGSDNodes.cpp:64:1
> > #15 0x00007f5dfbbe0d70 llvm::SelectionDAGISel::CodeGenAndEmitDAG()
> /home/fooris/github/llvm/build/../lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:986:16
> > #16 0x00007f5dfbbdf3e0
> llvm::SelectionDAGISel::SelectBasicBlock(llvm::ilist_iterator<llvm::ilist_detail::node_options<llvm::Instruction,
> true, false, void>, false, true>,
> llvm::ilist_iterator<llvm::ilist_detail::node_options<llvm::Instruction,
> true, false, void>, false, true>, bool&)
> /home/fooris/github/llvm/build/../lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:735:1
> > #17 0x00007f5dfbbdeecd
> llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&)
> /home/fooris/github/llvm/build/../lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:0:7
> > #18 0x00007f5dfbbdc278
> llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&)
> /home/fooris/github/llvm/build/../lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:502:22
> > #19 0x00007f5dfe50b4a2
> llvm::MachineFunctionPass::runOnFunction(llvm::Function&)
> /home/fooris/github/llvm/build/../lib/CodeGen/MachineFunctionPass.cpp:73:8
> > #20 0x00007f5dfd9998ac
> llvm::FPPassManager::runOnFunction(llvm::Function&)
> /home/fooris/github/llvm/build/../lib/IR/LegacyPassManager.cpp:1648:23
> > #21 0x00007f5dfd999cc5 llvm::FPPassManager::runOnModule(llvm::Module&)
> /home/fooris/github/llvm/build/../lib/IR/LegacyPassManager.cpp:1684:16
> > #22 0x00007f5dfd99a444 (anonymous
> namespace)::MPPassManager::runOnModule(llvm::Module&)
> /home/fooris/github/llvm/build/../lib/IR/LegacyPassManager.cpp:1749:23
> > #23 0x00007f5dfd999f58 llvm::legacy::PassManagerImpl::run(llvm::Module&)
> /home/fooris/github/llvm/build/../lib/IR/LegacyPassManager.cpp:1862:16
> > #24 0x00007f5dfd99a9d1 llvm::legacy::PassManager::run(llvm::Module&)
> /home/fooris/github/llvm/build/../lib/IR/LegacyPassManager.cpp:1893:3
> > #25 0x000000000041fb11 compileModule(char**, llvm::LLVMContext&)
> /home/fooris/github/llvm/build/../tools/llc/llc.cpp:605:41
> > #26 0x000000000041e19d main
> /home/fooris/github/llvm/build/../tools/llc/llc.cpp:355:13
> > #27 0x00007f5df9554b97 __libc_start_main
> /build/glibc-OTsEL5/glibc-2.27/csu/../csu/libc-start.c:344:0
> > #28 0x000000000041d8da _start (./bin/llc+0x41d8da)
> > [1]    24145 abort      ./bin/llc -mtriple=via64 play/call.ll
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20200414/205c30ad/attachment.html>


More information about the llvm-dev mailing list