[LLVMdev] Can llvm support a target backend without function call ?

Peng Wang paulart.wang at gmail.com
Thu Sep 15 03:51:08 PDT 2011


Hi all,

I am writing a llvm backend for a small stream processor. Because of its
special application field, the processor does not support function. When I
built the llvm backend for the new target, I leave the calling convention
and frame lowering part blank. It compilered correctly, but I encountered
execution errors, like

*[xxx at localhost ex]$ llc test.ll -march=SSP -o test.s
0  llc       0x08f7ee49
1  llc       0x08f7f41a
2            0x003b1420 __kernel_sigreturn + 0
3  llc       0x08de0d52 llvm::TargetData::getAlignment(llvm::Type const*,
bool) const + 44
4  llc       0x08de108a llvm::TargetData::getABITypeAlignment(llvm::Type
const*) const + 44
5  llc       0x0863e289 llvm::TargetData::getTypeAllocSize(llvm::Type
const*) const + 37
6  llc       0x08a707ed llvm::GetReturnInfo(llvm::Type const*, unsigned int,
llvm::SmallVectorImpl<llvm::ISD::OutputArg>&, llvm::TargetLowering const&,
llvm::SmallVectorImpl<unsigned long long>*) + 573
7  llc       0x089b59be llvm::FunctionLoweringInfo::set(llvm::Function
const&, llvm::MachineFunction&) + 156
8  llc       0x08a4ec8a
llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&) + 280
9  llc       0x08b7c191
llvm::MachineFunctionPass::runOnFunction(llvm::Function&) + 89
10 llc       0x08eb92f1 llvm::FPPassManager::runOnFunction(llvm::Function&)
+ 315
11 llc       0x08eb94bb llvm::FPPassManager::runOnModule(llvm::Module&) +
121
12 llc       0x08eb8fbf llvm::MPPassManager::runOnModule(llvm::Module&) +
413
13 llc       0x08eba3b0 llvm::PassManagerImpl::run(llvm::Module&) + 124
14 llc       0x08eba415 llvm::PassManager::run(llvm::Module&) + 39
15 llc       0x0859a610 main + 2470
16 libc.so.6 0x0097de9c __libc_start_main + 220
17 llc       0x08598b61
Stack dump:
0.      Program arguments: llc test.ll -march=SSP -o test.s
1.      Running pass 'Function Pass Manager' on module 'test.ll'.
2.      Running pass 'SSP DAG->DAG Pattern Instruction Selection' on
function '@add'
Segmentation fault
*
I think the error comes from the lacking support of function call. Should I
write some fake codes to walk around, or I have some ways to tell LLVM that
I do not want function call?

Actually, I tried to write LLVM IR without the function form of define
@main(..., but with function body directly. Unfortunately, everything seems
must work with a function call, otherwise llc will not work.


Best wishes!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20110915/adad412e/attachment.html>


More information about the llvm-dev mailing list