<div style="line-height:1.7;color:#000000;font-size:14px;font-family:Arial"><div>Hello.</div><div><br></div><div>I am reading the code about DAG to DAG Instruction selection when I meet some problems. I am confused about the using of ch, glue. <br></div><div>when will they be used? And what are they used for? <br></div><div>when a sdnode doesn't have an actual result, it would have an MVT::Other typed result. But how to decide which sdnode is the user of this result?</div><div>for example, I have the DAG before instruction selection step, the corresponding graph is in attachment:</div><div>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#000000;">SelectionDAG has 19 nodes:</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#000000;"> t0: ch = EntryToken</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#000000;"> t5: ch = store<ST4[</span><span style=" color:#000000;">%1]> t0, Constant:i32<11>, FrameIndex:i32<0>, undef:i32</span>
</p><p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#000000;"> t8: ch = store<Volatile ST4[%2]> t5, Constant:i32<12>, FrameIndex:i32<1>, undef:i32</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#000000;"> t9: i32,ch = load<LD4[%1]> t8, FrameIndex:i32<0>, undef:i32</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#000000;"> t12: i32,ch = load<Volatile LD4[%2]> t9:1, FrameIndex:i32<1>, undef:i32</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#000000;"> t14: ch = store<ST4[%1]> t12:1, t22, FrameIndex:i32<0>, undef:i32</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#000000;"> t17: ch,glue = CopyToReg t14, Register:i32 %V0, t22</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#000000;"> t11: i32 = add t9, Constant:i32<1></span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#000000;"> t20: glue = Cpu0ISD::DivRem t11, t12</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#000000;"> t22: i32,ch,glue = CopyFromReg t0, Register:i32 %HI, t20</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#000000;"> t18: ch = Cpu0ISD::Ret t17, Register:i32 %V0, t17:1</span></p><p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#000000;">The .ll code is as below:</span></p><p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#000000;">*********************************************************************************************************************************<br></span></p><p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#000000;">; ModuleID = 'ch4_1_mod.bc'<br>source_filename = "ch4_1_mod.cpp"<br>target datalayout = "E-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32-S64"<br>target triple = "mips-unknown-linux-gnu"<br><br>; Function Attrs: nounwind<br>define i32 @_Z8test_modv() #0 {<br> %1 = alloca i32, align 4<br> %2 = alloca i32, align 4<br> store i32 11, i32* %1, align 4<br> store volatile i32 12, i32* %2, align 4<br> %3 = load i32, i32* %1, align 4<br> %4 = add nsw i32 %3, 1<br> %5 = load volatile i32, i32* %2, align 4<br> %6 = srem i32 %4, %5<br> store i32 %6, i32* %1, align 4<br> %7 = load i32, i32* %1, align 4<br> ret i32 %7<br>}<br><br>attributes #0 = { nounwind "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="mips32r2" "target-features"="+mips32r2" "unsafe-fp-math"="false" "use-soft-float"="false" }<br><br>!llvm.ident = !{!0}<br><br>!0 = !{!"clang version 3.9.0 (tags/RELEASE_390/final)"}</span></p><p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br><span style=" color:#000000;"><span style=" color:#000000;">*********************************************************************************************************************************</span></span></p><p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#000000;">Considering t9 already has a i32 sdvalue, why ch is need? Does ch represent for MVT::Other typed sdvalue?</span></p><p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#000000;">t22 has 3 results. ch is one of them, but ch is not used by any node. why is it created?</span></p><p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#000000;">what about glue? what is it used for and when is it used?</span></p><p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#000000;">And when the DAG is processed, there is usually a variable chain. what is it used for? and how is it used? Does ch in DAG represent for chain?</span></p><p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#000000;">Thanks a lot!</span></p><p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#000000;"><br></span></p><p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#000000;"><br></span></p><p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#000000;"><br></span></p><p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#000000;"><br></span></p><p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#000000;">Jack<br></span></p><style type="text/css">
p, li { white-space: pre-wrap; }
</style></div><div><br></div><div><br></div></div><br><br><span title="neteasefooter"><p> </p></span>