Hello.
I am playing with LLVM and trying to create Zilog Z80 Backend.
I have succesfully created basic infrastructure and now trying to extend Z80InstrInfo.td to handle more and more C code.
I have done some work with FrameIndex and now I am stuck with assert.
llc: SelectionDAG.cpp:645: bool llvm::SelectionDAG::RemoveNodeFromCSEMaps(llvm::SDNode*): Assertion `N->getOpcode() != ISD::EntryToken && "EntryToken in CSEMap!"' failed.
This code works:
void simple()
{
unsigned char i=10;
unsigned char a = 20;
}
and produces my somewhat not VERY REAL z80 assembly:
.file "simple.bc"
.text
.globl simple
.type simple,@function
simple: # @simple
# BB#0: # %entry
ld HL, SP+5
ld (SP+0), HL
ld HL, SP+4
ld (SP+2), HL
ld HL, (SP+0)
ld (HL),10
ld HL, (SP+2)
ld (HL),20
$tmp0:
.size simple, ($tmp0)-simple
But when I add one line to c:
void simple()
{
unsigned char i=10;
unsigned char a = 20;
a = a+i;
}
the llc fails to generate .S file.
I have only added this instruction to Z80InstrInfo.td
def STORE16_trunc: Z80Instr<(outs), (ins GPR16:$src, GPR16:$dst),
"ld_b ($dst),$src",
[(truncstorei8 GPR16:$src, GPR16:$dst)]>;
This is also MY PSEUDO instruction on Z80.
Next I will try to handle this is real instructions, but for now I cannot make futher due to that assertions.
Attached is my whole code + test files.
I have tried to debug but the breakpoints and showing SDNodes deesn't helped me too much.
I have observed that it is truying to remove EntryToken from proccess, but I can't figure what is in that EntryToken. According to llvm source code
EntryToken is marker used to indicate the start of the region.
Is there any magic option to get some more debug info, what is going on. And why it tries to remove EntryToken?
Thanks, Peter.
llvm_to_send.tgz (28.7 KB)