Skip to content
This repository has been archived by the owner on Dec 12, 2022. It is now read-only.

Latest commit

 

History

History
207 lines (195 loc) · 5.02 KB

p_515.md

File metadata and controls

207 lines (195 loc) · 5.02 KB

5.15 Compiler les appels de fonction ayant plus de 6 arguments

Command for the test (source code):

./chef.py test backend -bw doc/p_515.c
cat build/cpp-bin/assembly.s

Result:

.file  "p_515.c"
.text

.Ltext0:
  .globl main
  .type main, @function


foo:
  pushq   %rbp
  movq    %rsp, %rbp
  subq $136, %rsp

  movl    %edi, -4(%rbp)                 # copyInstr
  movl    %esi, -8(%rbp)                 # copyInstr
  movl    %edx, -12(%rbp)                 # copyInstr
  movl    %ecx, -16(%rbp)                 # copyInstr
  movl    %r8d, -20(%rbp)                 # copyInstr
  movl    %r9d, -24(%rbp)                 # copyInstr
  jmp    .L1_innerbeginof_foo

.L1_innerbeginof_foo:
  movl    $48, -32(%rbp)
  # empty with returnName=a
  movl    -4(%rbp), %r10d
  movl    %r10d, -36(%rbp)
  movl    -32(%rbp), %eax
  addl    %eax, -36(%rbp)
  pushq    %rdi
  movl    -36(%rbp), %edi                 # call Param
  call    putchar
  popq     %rdi
  movl    $48, -44(%rbp)
  # empty with returnName=b
  movl    -8(%rbp), %r10d
  movl    %r10d, -48(%rbp)
  movl    -44(%rbp), %eax
  addl    %eax, -48(%rbp)
  pushq    %rdi
  movl    -48(%rbp), %edi                 # call Param
  call    putchar
  popq     %rdi
  movl    $48, -56(%rbp)
  # empty with returnName=c
  movl    -12(%rbp), %r10d
  movl    %r10d, -60(%rbp)
  movl    -56(%rbp), %eax
  addl    %eax, -60(%rbp)
  pushq    %rdi
  movl    -60(%rbp), %edi                 # call Param
  call    putchar
  popq     %rdi
  movl    $48, -68(%rbp)
  # empty with returnName=d
  movl    -16(%rbp), %r10d
  movl    %r10d, -72(%rbp)
  movl    -68(%rbp), %eax
  addl    %eax, -72(%rbp)
  pushq    %rdi
  movl    -72(%rbp), %edi                 # call Param
  call    putchar
  popq     %rdi
  movl    $48, -80(%rbp)
  # empty with returnName=e
  movl    -20(%rbp), %r10d
  movl    %r10d, -84(%rbp)
  movl    -80(%rbp), %eax
  addl    %eax, -84(%rbp)
  pushq    %rdi
  movl    -84(%rbp), %edi                 # call Param
  call    putchar
  popq     %rdi
  movl    $48, -92(%rbp)
  # empty with returnName=f
  movl    -24(%rbp), %r10d
  movl    %r10d, -96(%rbp)
  movl    -92(%rbp), %eax
  addl    %eax, -96(%rbp)
  pushq    %rdi
  movl    -96(%rbp), %edi                 # call Param
  call    putchar
  popq     %rdi
  movl    $48, -104(%rbp)
  # empty with returnName=g
  movl    64(%rbp), %r10d
  movl    %r10d, -108(%rbp)
  movl    -104(%rbp), %eax
  addl    %eax, -108(%rbp)
  pushq    %rdi
  movl    -108(%rbp), %edi                 # call Param
  call    putchar
  popq     %rdi
  movl    $48, -116(%rbp)
  # empty with returnName=h
  movl    72(%rbp), %r10d
  movl    %r10d, -120(%rbp)
  movl    -116(%rbp), %eax
  addl    %eax, -120(%rbp)
  pushq    %rdi
  movl    -120(%rbp), %edi                 # call Param
  call    putchar
  popq     %rdi
  movl    $48, -128(%rbp)
  # empty with returnName=i
  movl    80(%rbp), %r10d
  movl    %r10d, -132(%rbp)
  movl    -128(%rbp), %eax
  addl    %eax, -132(%rbp)
  pushq    %rdi
  movl    -132(%rbp), %edi                 # call Param
  call    putchar
  popq     %rdi
  # empty with returnName=d
  movl    -16(%rbp), %eax
  jmp    .L0_endof_foo
  jmp    .L0_endof_foo

.L0_endof_foo:
  leave
  ret

main:
  pushq   %rbp
  movq    %rsp, %rbp
  subq $132, %rsp

  jmp    .L3_innerbeginof_main

.L3_innerbeginof_main:
  movl    $79, -8(%rbp)
  movl    $9, -16(%rbp)
  pushq   -16(%rbp)                 # call Param
  movl    $8, -24(%rbp)
  pushq   -24(%rbp)                 # call Param
  movl    $7, -32(%rbp)
  pushq   -32(%rbp)                 # call Param
  movl    $6, -40(%rbp)
  pushq    %r9
  movl    -40(%rbp), %r9d                 # call Param
  movl    $5, -48(%rbp)
  pushq    %r8
  movl    -48(%rbp), %r8d                 # call Param
  movl    $4, -56(%rbp)
  pushq    %rcx
  movl    -56(%rbp), %ecx                 # call Param
  movl    $3, -64(%rbp)
  pushq    %rdx
  movl    -64(%rbp), %edx                 # call Param
  movl    $2, -72(%rbp)
  pushq    %rsi
  movl    -72(%rbp), %esi                 # call Param
  movl    $1, -80(%rbp)
  pushq    %rdi
  movl    -80(%rbp), %edi                 # call Param
  call    foo
  movl    %eax, -84(%rbp)
  popq     %rdi
  popq     %rsi
  popq     %rdx
  popq     %rcx
  popq     %r8
  popq     %r9
  addq    $24, %rsp
  movl    -8(%rbp), %eax
  subl    -84(%rbp), %eax
  movl    %eax, -88(%rbp)
  movl    -88(%rbp), %r10d
  movl    %r10d, -92(%rbp)                 # copyInstr
  movl    $10, -100(%rbp)
  pushq    %rdi
  movl    -100(%rbp), %edi                 # call Param
  call    putchar
  popq     %rdi
  movl    $79, -108(%rbp)
  pushq    %rdi
  movl    -108(%rbp), %edi                 # call Param
  call    putchar
  popq     %rdi
  # empty with returnName=k
  pushq    %rdi
  movl    -92(%rbp), %edi                 # call Param
  call    putchar
  popq     %rdi
  movl    $10, -116(%rbp)
  pushq    %rdi
  movl    -116(%rbp), %edi                 # call Param
  call    putchar
  popq     %rdi
  movl    $0, -124(%rbp)
  movl    -124(%rbp), %eax
  jmp    .L2_endof_main
  jmp    .L2_endof_main

.L2_endof_main:
  leave
  ret