[llvm-dev] In ISel, where Constant<0> comes from?

Tim Northover via llvm-dev llvm-dev at lists.llvm.org
Tue Dec 18 01:02:55 PST 2018


On Tue, 18 Dec 2018 at 07:11, Gleb Popov via llvm-dev
<llvm-dev at lists.llvm.org> wrote:
> However, I haven't managed to get a "Constant<>" in the DAG when compiling for X86. I'm interested in how it is lowered. Can you please give me some guidance on this?

How are you looking? When I run "llc -mtriple=x86_64-linux-gnu
-debug-only=isel" on your IR I get multiple instances of Constants. At
the very start is:

Initial selection DAG: %bb.0 'main:entry'
SelectionDAG has 18 nodes:
 t0: ch = EntryToken
 t7: i64 = Constant<0>
       t9: ch = store<(store 4 into %ir.retval)> t0, Constant:i32<0>,
FrameIndex:i64<0>, undef:i64
       t2: i32,ch = CopyFromReg t0, Register:i32 %0
     t11: ch = store<(store 4 into %ir.argc.addr)> t9, t2,
FrameIndex:i64<1>, undef:i64
     t4: i64,ch = CopyFromReg t0, Register:i64 %1
   t13: ch = store<(store 8 into %ir.argv.addr)> t11, t4,
FrameIndex:i64<2>, undef:i64
 t16: ch,glue = CopyToReg t13, Register:i32 $eax, Constant:i32<0>
 t17: ch = X86ISD::RET_FLAG t16, TargetConstant:i32<0>, Register:i32 $eax, t16:1

where the t16 line corresponds to what you've seen on SPARC.

Cheers.

Tim.


More information about the llvm-dev mailing list