[LLVMdev] Calling external functions failed on PowerPC

陳韋任 chenwj at iis.sinica.edu.tw
Wed Mar 23 02:34:46 PDT 2011


Hi, all

  I have a trouble with calling external functions on PowerPC.
What I am doing is generating a LLVM IR first like this,

- x86

 call void @helper_shack_flush(%struct.CPUX86State* %62) noinline, !flags !12

- ppc

 call void @helper_shack_flush(%struct.CPUX86State* %62) noinline, !flags !10
   
After lowering above LLVM IR for x86 and ppc, it becomes:

- x86

 %RAX<def> = MOV64ri <ga:@helper_shack_flush>
 %RDI<def> = COPY %RBX
 CALL64r %RAX<kill>, %RDI<kill>, %RAX<imp-def,dead>,
%RCX<imp-def,dead>, %RDX<imp-def,dead>, %RSI<imp-def,dead>,
%%RDI<imp-def,dead>, %R8<imp-def,dead>,
%EFLAGS<imp-def,dead>, %RSP<imp-use>, ...

- ppc

 %X4<def> = LDtoc <ga:@helper_shack_flush>, %X2

  The x86 JIT can call the external function correctly, but
the ppc JIT give me the error belows,

  %X4<def> = LDtoc <ga:@helper_shack_flush>, %X2
UNREACHABLE executed!
Stack dump:
0.      Running pass 'PowerPC Machine Code Emitter' on function '@"8048150"'
Aborted

  Is this a bug in ppc JIT? Or I have to do something else
so that ppc JIT can call external functions?

  Thanks!

Regards,
chenwj

-- 
Wei-Ren Chen (陳韋任)
Parallel Processing Lab, Institute of Information Science,
Academia Sinica, Taiwan (R.O.C.)
Tel:886-2-2788-3799 #1667




More information about the llvm-dev mailing list