<div dir="ltr">Sounds like you haven't updated the machine CFG to keep the basic block containing the label alive. See how addSuccessor is used in the X86 lowering.</div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Apr 27, 2016 at 3:49 PM, Chris.Dewhurst via llvm-dev <span dir="ltr"><<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">




<div>
<div style="direction:ltr;font-family:Tahoma;color:#000000;font-size:10pt">Hi,
<div><br>
</div>
<div>I'm trying to work out what to do to eliminate an "Undefined temporary symbol", which has appeared after I had thought I'd cleared up the last problems trying to implement __builtin_setjmp.</div>
<div><br>
</div>
<div>I know that the symbol it's referring to is "sinkMBB" in the two BuildMI instructions in the code fragment below, as the problem goes away if I remove these lines temporarily (although the algorithm doesn't work then).</div>
<div><br>
</div>
<div>What must I do to eliminate the Undefined Temporary Symbol error, later in the compilation process (raised at ElfObjectWriter.cpp:803)?</div>
<div><br>
</div>
<div>
<div style="font-family:Times New Roman;color:#000000;font-size:16px">
<div>
<div style="direction:ltr;font-family:Tahoma;color:#000000;font-size:10pt">
<div>
<div>Chris Dewhurst, Lero, University of Limerick</div>
<div><br>
</div>
<div>+   const BasicBlock *BB = MBB->getBasicBlock();</div>
<div>+   MachineFunction::iterator It = ++MBB->getIterator();</div>
<div>+   MachineBasicBlock *thisMBB = MBB;</div>
<div>+   const BasicBlock* mainBB = BasicBlock::Create(BB->getContext(), "setjmp.main");</div>
<div>+   MachineBasicBlock *mainMBB = MF->CreateMachineBasicBlock(mainBB);</div>
<div>+   mainMBB->setHasAddressTaken();</div>
<div>+   const BasicBlock* sinkBB = BasicBlock::Create(BB->getContext(), "setjmp.sink");</div>
<div>+   MachineBasicBlock *sinkMBB = MF->CreateMachineBasicBlock(sinkBB);</div>
<div>+   sinkMBB->setHasAddressTaken();</div>
<div>+ </div>
<div>+   MF->insert(It, mainMBB);</div>
<div>+   MF->insert(It, sinkMBB);</div>
<div>+ </div>
<div>+   // Transfer the remainder of BB and its successor edges to sinkMBB.</div>
<div>+   sinkMBB->splice(sinkMBB->begin(), MBB,</div>
<div>+                   std::next(MachineBasicBlock::iterator(MI)),</div>
<div>+                   MBB->end());</div>
<div>+   sinkMBB->transferSuccessorsAndUpdatePHIs(MBB);</div>
<div>+ </div>
<div>+   MachineInstrBuilder MIB;</div>
<div>+ </div>
<div>+   unsigned LabelReg = MRI.createVirtualRegister(&SP::IntRegsRegClass);</div>
<div>+   unsigned BufReg = MI->getOperand(1).getReg();</div>
<div>+ </div>
<div>+   MIB = BuildMI(*thisMBB, MI, DL, TII->get(SP::SETHIi))</div>
<div>+             .addReg(LabelReg, RegState::Define)</div>
<div>+             .addMBB(sinkMBB, SparcMCExpr::VK_Sparc_HI);</div>
<div>+   MIB.setMemRefs(MMOBegin, MMOEnd);</div>
<div>+ </div>
<div>+   MIB = BuildMI(*thisMBB, MI, DL, TII->get(SP::ADDri))</div>
<div>+             .addReg(LabelReg)</div>
<div>+             .addReg(LabelReg)</div>
<div>+             .addMBB(sinkMBB, SparcMCExpr::VK_Sparc_LO);</div>
<div>+   MIB.setMemRefs(MMOBegin, MMOEnd);</div>
<div>+ </div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>

<br>_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
<br></blockquote></div><br></div>