<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="Generator" content="Microsoft Exchange Server">
<!-- converted from rtf -->
<style><!-- .EmailQuote { margin-left: 1pt; padding-left: 4pt; border-left: #800000 2px solid; } --></style>
</head>
<body>
<font face="Calibri" size="2"><span style="font-size:11pt;">
<div>Hi,</div>
<div> </div>
<div>I’m lowering some of the logical operators (by example the | operator)  on integer32.</div>
<div>Sadly my target only provide native instruction on high and low parts of 32 bits registers.</div>
<div>So, I have to generate a sequence of two native instructions (LOR followed by HOR).</div>
<div>I’ve introduced an Pseudo instruction with a custom inserter.</div>
<div> </div>
<div>def OR_A_oo             : CLPPseudoInst<(ins FPUaOffsetOperand:$OffsetA,FPUaOffsetOperand:$OffsetB),(outs FPUaROUTADDRegisterClass:$FA_ROUTADD),</div>
<div>                                                                [], [RFLAGA],   </div>
<div>                                                                "# OR_A_oo",</div>
<div>                                                                [(set FPUaROUTADDRegisterClass:$FA_ROUTADD,(or   FPUaOffsetOperand:$OffsetA,FPUaOffsetOperand:$OffsetB))],NoItinerary></div>
<div>                                                                {let usesCustomInserter = 1;}</div>
<div> </div>
<div>The instructions selection and registers allocation are performed with the pseudo. </div>
<div> </div>
<div>        %4:fpuaoffsetclass = LOAD_A_r @a; FPUaOffsetClass:%4</div>
<div>        %5:fpuaoffsetclass = LOAD_A_r @b; FPUaOffsetClass:%5</div>
<div>        %6:fpuaroutaddregisterclass = OR_A_oo killed %5, killed %4, implicit-def dead %rflaga; FPUaROUTADDRegisterClass:%6 FPUaOffsetClass:%5,%4</div>
<div>        %7:fpuaoffsetclass = COPY %6; FPUaOffsetClass:%7 FPUaROUTADDRegisterClass:%6</div>
<div>        MOV_A_or killed %7, @c1; FPUaOffsetClass:%7</div>
<div>        %8:fpuaoffsetclass = LOAD_A_r @c1; FPUaOffsetClass:%8</div>
<div> </div>
<div>A virtual register %6 has been allocated for the out of the pseudo. So far, so good.</div>
<div> </div>
<div>My customInserter (see below) is may be over simplistic.</div>
<div>After investigation on the code produce by my customInserter, I've noticed the following problems:</div>
<div>        1)       %6 seems to be defined twice</div>
<div>        2)      %5 is killed twice.</div>
<div> </div>
<div>320B            MOV_A_ro @a, def %4; FPUaOffsetClass:%4</div>
<div>336B            MOV_A_ro @b, def %5; FPUaOffsetClass:%5</div>
<div>352B            %6:fpuaroutaddregisterclass = LOR_A_oo killed %5, implicit-def %rflaga; FPUaROUTADDRegisterClass:%6 FPUaOffsetClass:%5</div>
<div>368B            %6:fpuaroutaddregisterclass = HOR_A_oo killed %5, implicit-def %rflaga; FPUaROUTADDRegisterClass:%6 FPUaOffsetClass:%5</div>
<div>384B            %7:fpuaoffsetclass = COPY %6; FPUaOffsetClass:%7 FPUaROUTADDRegisterClass:%6</div>
<div>400B            MOV_A_or killed %7, @c1; FPUaOffsetClass:%7</div>
<div>416B            MOV_A_ro @c1, def %8; FPUaOffsetClass:%8</div>
<div> </div>
<div>Result: an assertion is raised… !!</div>
<div> </div>
<div>********** PROCESS IMPLICIT DEFS **********</div>
<div>********** Function: _start</div>
<div>llc: /home/dte/eclipse-workspace/llvm/lib/CodeGen/MachineRegisterInfo.cpp:366: llvm::MachineInstr* llvm::MachineRegisterInfo::getVRegDef(unsigned int) const: Assertion `(I.atEnd() || std::next(I) == def_instr_end()) && "getVRegDef assumes a single definition
or no definition"' failed.</div>
<div>LLVMSymbolizer: error reading file: No such file or directory</div>
<div> </div>
<div>Here is the inner part of my customInserter. </div>
<div>Are there any additional actions to perform during the customInserter.</div>
<div> </div>
<div>MachineBasicBlock *</div>
<div>CLPTargetLowering::emitLOpcodeHOpcode(MachineInstr &MI,</div>
<div>        MachineBasicBlock *MBB,</div>
<div>                  unsigned LOpcode,</div>
<div>                  unsigned HOpcode) const {</div>
<div>        const TargetInstrInfo *TII = Subtarget->getInstrInfo();</div>
<div>        DebugLoc Loc = MI.getDebugLoc();</div>
<div> </div>
<div>        const MachineOperand operand0 = MI.getOperand(0);</div>
<div>        const MachineOperand operand1 = MI.getOperand(1);</div>
<div> </div>
<div>        BuildMI(*MBB, MI, Loc, TII->get(LOpcode))</div>
<div>        .add(operand0)</div>
<div>        .add(operand1);</div>
<div>        BuildMI(*MBB, MI, Loc, TII->get(HOpcode))</div>
<div>        .add(operand0)</div>
<div>        .add(operand1);</div>
<div> </div>
<div>        MI.eraseFromParent();</div>
<div> </div>
<div>        return MBB;</div>
<div>}</div>
<div> </div>
<div>Dominique Torette</div>
<div>System Architect</div>
<div>Rue des Chasseurs Ardennais - Liège Science Park - B-4031 Angleur</div>
<div>Tel: +32 (0) 4 361 81 11 - Fax: +32 (0) 4 361 81 20</div>
<div><a href="http://www.spacebel.be">www.spacebel.be</a></div>
<div> </div>
<div> </div>
<div> </div>
<div> </div>
</span></font>
<br clear="both">
 ------------------------------------------------------------------------------<BR>
<BR>
E-MAIL DISCLAIMER<BR>
<BR>
The present message may contain confidential and/or legally privileged information. If you are not the intended addressee and in case of a transmission error, please notify the sender immediately and destroy this E-mail. Disclosure, reproduction or distribution of this document and its possible attachments is strictly forbidden.<BR>
<BR>
SPACEBEL denies all liability for incomplete, improper, inaccurate, intercepted, (partly) destroyed, lost and/or belated transmission of the current information given that unencrypted electronic transmission cannot currently be guaranteed to be secure or error free.<BR>
Upon request or in conformity with formal, contractual agreements, an originally signed hard copy will be sent to you to confirm the information contained in this E-mail.<BR>
<BR>
SPACEBEL denies all liability where E-mail is used for private use.<BR>
<BR>
SPACEBEL cannot be held responsible for possible viruses that might corrupt this message and/or your computer system.<BR>
 -------------------------------------------------------------------------------<BR>
</body>
</html>