Joseph Reddington
2012-Nov-11 12:41 UTC
[LLVMdev] Tracing nodes in selectionDAG to final code...
Hello everyone. I use this command clang -emit-llvm hello.c -c -o hello.bc llc hello.bc -march=mipsel -relocation-model=static -o hello.s to produce this MIPS code: .section .mdebug.abi32 .previous .file "hello.bc" .text .globl main .align 2 .type main, at function .set nomips16 # @main .ent main main: .cfi_startproc .frame $sp,32,$ra .mask 0x80000000,-4 .fmask 0x00000000,0 .set noreorder .set nomacro # BB#0: # %entry addiu $sp, $sp, -32 $tmp2: .cfi_def_cfa_offset 32 sw $ra, 28($sp) # 4-byte Folded Spill $tmp3: .cfi_offset 31, -4 lui $2, %hi(__gnu_local_gp) addiu $2, $2, %lo(__gnu_local_gp) sw $2, 16($sp) sw $zero, 24($sp) lui $2, %hi($.str) addiu $4, $2, %lo($.str) jal printf nop addiu $2, $zero, 0 lw $ra, 28($sp) # 4-byte Folded Reload addiu $sp, $sp, 32 jr $ra nop .set macro .set reorder .end main $tmp4: .size main, ($tmp4)-main .cfi_endproc .type $.str, at object # @.str .section .rodata.str1.1,"aMS", at progbits,1 $.str: .asciz "hello world\n" .size $.str, 13 from a simple hello world example that looks like: #include <stdio.h> int main() { printf("hello world\n"); return 0; } I use the method I talked about at (http://markmail.org/message/3micyhqjpgx7fwvv) to itterate over the nodes in the selectionDAG, the operations are effectively... -Operation EntryToken has number 0 -Operation Constant has number 1 -Operation FrameIndex has number 2 -Operation undef has number 3 -Operation store has number 4 -Operation GlobalAddress has number 5 -Operation GlobalAddress has number 6 -Operation TargetConstant has number 7 -Operation callseq_start has number 8 -Operation TargetGlobalAddress has number 9 -Operation Register has number 10 -Operation CopyToReg has number 11 -Operation RegisterMask has number 12 -Operation MipsISD::JmpLink has number 13 -Operation TargetConstant has number 14 -Operation TargetConstant has number 15 -Operation callseq_end has number 16 -Operation Register has number 17 -Operation CopyFromReg has number 18 -Operation CopyToReg has number 19 -Operation Register has number 20 -Operation MipsISD::Ret has number 21 What I'd like to know now is how I might tell which parts of MIPS each operation in the selectionDAG produced? I'm pressuming there is a specification in the filesystem somewhere and it would be great to get a pointer... Thanks Joe -- Dr Joseph Reddington Computer Science, Royal Holloway For 2012 I have a resolution to write all my email responses within 24-hours - no exceptions. If you've not had a response, there's been a misunderstanding somewhere, and it's worth reminding me.
Krzysztof Parzyszek
2012-Nov-11 12:46 UTC
[LLVMdev] Tracing nodes in selectionDAG to final code...
On 11/11/2012 6:41 AM, Joseph Reddington wrote:> > What I'd like to know now is how I might tell which parts of MIPS each > operation in the selectionDAG produced? I'm pressuming there is a > specification in the filesystem somewhere and it would be great to get > a pointer...Try -debug-only=isel. It would dump the DAG nodes from a given BB after each stage of instruction selection. -Krzysztof -- Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
Arnold Schwaighofer
2012-Nov-11 13:04 UTC
[LLVMdev] Tracing nodes in selectionDAG to final code...
What Krzysztof said and you might want to look at lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp to see when the various stages happen during ISel (SelectionDAGISel::CodeGenAndEmitDAG()). There are also the various -view-<some>-dag flags that you can use with llc if you have dotty or graphviz installed to watch instruction lowering happening in a more graphical manner. See also http://llvm.org/docs/CodeGenerator.html#instruction-selection-section. For code and instruction lowering description specific to MIPS look in lib/Target/Mips/Mips-ISelLowering.cpp, -InstrInfo.td, and -ISelDAGToDAG.cpp. On Sun, Nov 11, 2012 at 6:41 AM, Joseph Reddington <joseph at cs.rhul.ac.uk> wrote:> Hello everyone. > > I use this command > > clang -emit-llvm hello.c -c -o hello.bc > llc hello.bc -march=mipsel -relocation-model=static -o hello.s > > to produce this MIPS code: > > .section .mdebug.abi32 > .previous > .file "hello.bc" > .text > .globl main > .align 2 > .type main, at function > .set nomips16 # @main > .ent main > main: > .cfi_startproc > .frame $sp,32,$ra > .mask 0x80000000,-4 > .fmask 0x00000000,0 > .set noreorder > .set nomacro > # BB#0: # %entry > addiu $sp, $sp, -32 > $tmp2: > .cfi_def_cfa_offset 32 > sw $ra, 28($sp) # 4-byte Folded Spill > $tmp3: > .cfi_offset 31, -4 > lui $2, %hi(__gnu_local_gp) > addiu $2, $2, %lo(__gnu_local_gp) > sw $2, 16($sp) > sw $zero, 24($sp) > lui $2, %hi($.str) > addiu $4, $2, %lo($.str) > jal printf > nop > addiu $2, $zero, 0 > lw $ra, 28($sp) # 4-byte Folded Reload > addiu $sp, $sp, 32 > jr $ra > nop > .set macro > .set reorder > .end main > $tmp4: > .size main, ($tmp4)-main > .cfi_endproc > > .type $.str, at object # @.str > .section .rodata.str1.1,"aMS", at progbits,1 > $.str: > .asciz "hello world\n" > .size $.str, 13 > > > > from a simple hello world example that looks like: > > > #include <stdio.h> > > int main() { > printf("hello world\n"); > return 0; > } > > > I use the method I talked about at > (http://markmail.org/message/3micyhqjpgx7fwvv) to itterate over the > nodes in the selectionDAG, the operations are effectively... > > -Operation EntryToken has number 0 > -Operation Constant has number 1 > -Operation FrameIndex has number 2 > -Operation undef has number 3 > -Operation store has number 4 > -Operation GlobalAddress has number 5 > -Operation GlobalAddress has number 6 > -Operation TargetConstant has number 7 > -Operation callseq_start has number 8 > -Operation TargetGlobalAddress has number 9 > -Operation Register has number 10 > -Operation CopyToReg has number 11 > -Operation RegisterMask has number 12 > -Operation MipsISD::JmpLink has number 13 > -Operation TargetConstant has number 14 > -Operation TargetConstant has number 15 > -Operation callseq_end has number 16 > -Operation Register has number 17 > -Operation CopyFromReg has number 18 > -Operation CopyToReg has number 19 > -Operation Register has number 20 > -Operation MipsISD::Ret has number 21 > > What I'd like to know now is how I might tell which parts of MIPS each > operation in the selectionDAG produced? I'm pressuming there is a > specification in the filesystem somewhere and it would be great to get > a pointer... > > Thanks > > Joe > > > > > > -- > Dr Joseph Reddington > Computer Science, Royal Holloway > For 2012 I have a resolution to write all my email responses within > 24-hours - no exceptions. If you've not had a response, there's been a > misunderstanding somewhere, and it's worth reminding me. > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Maybe Matching Threads
- [LLVMdev] Mips backend -- Incorrect globaladdr/constpool address generation when bit 15 of address is set?
- [LLVMdev] backend problem with LiveInterval::removeRange
- [LLVMdev] Is va_arg correct on Mips backend?
- [LLVMdev] Is va_arg correct on Mips backend?
- [LLVMdev] Problem with PTX assembly printing (NVPTX backend)