Skip to content

Static shape vs dynamic shape code gen results #3

@chlict

Description

@chlict

rev: 53936d5
static shape code gen:

  .globl  __ZN29TestCodeGen_StaticShape1_Test8TestBodyEv ## -- Begin function _ZN29TestCodeGen_StaticShape1_Test8TestBodyEv
  .p2align  4, 0x90 
__ZN29TestCodeGen_StaticShape1_Test8TestBodyEv: ## @_ZN29TestCodeGen_StaticShape1_Test8TestBodyEv
  .cfi_startproc
## %bb.0:
  pushq %rbp 
  .cfi_def_cfa_offset 16
  .cfi_offset %rbp, -16
  movq  %rsp, %rbp 
  .cfi_def_cfa_register %rbp 
  leaq  L_.str.7(%rip), %rdi 
  movl  $4096, %esi             ## imm = 0x1000
  movl  $4096, %edx             ## imm = 0x1000
  movl  $8192, %ecx             ## imm = 0x2000
  movl  $12, %r8d 
  xorl  %eax, %eax 
  callq _printf
  leaq  L_str.15(%rip), %rdi 
  popq  %rbp 
  jmp _puts                   ## TAILCALL
  .cfi_endproc

dynamic shape code gen:

  .globl  __ZN30TestCodeGen_DynamicShape1_Test8TestBodyEv ## -- Begin function _ZN30TestCodeGen_DynamicShape1_Test8TestBodyEv
  .p2align  4, 0x90 
__ZN30TestCodeGen_DynamicShape1_Test8TestBodyEv: ## @_ZN30TestCodeGen_DynamicShape1_Test8TestBodyEv
  .cfi_startproc
## %bb.0:
  pushq %rbp 
  .cfi_def_cfa_offset 16
  .cfi_offset %rbp, -16
  movq  %rsp, %rbp 
  .cfi_def_cfa_register %rbp 
  movl  16(%rdi), %r8d 
  addl  20(%rdi), %r8d 
  addl  %r8d, %r8d 
  leaq  L_.str.7(%rip), %rdi 
  movl  $4096, %esi             ## imm = 0x1000
  movl  $4096, %edx             ## imm = 0x1000
  movl  $8192, %ecx             ## imm = 0x2000
  xorl  %eax, %eax 
  callq _printf
  leaq  L_str.15(%rip), %rdi 
  popq  %rbp 
  jmp _puts                   ## TAILCALL
  .cfi_endproc

dynamic shape相比static shape多了3条汇编指令:

  movl  16(%rdi), %r8d 
  addl  20(%rdi), %r8d 
  addl  %r8d, %r8d 

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions