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

Latest commit

 

History

History
82 lines (74 loc) · 1.87 KB

p_55.md

File metadata and controls

82 lines (74 loc) · 1.87 KB

5.5 "Compiler des expressions"

Command to run the test (source code):

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

Result :

.file  "p_55.c"
.text

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


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

  jmp    .L3_innerbeginof_main

.L3_innerbeginof_main:
  movl    $0, -8(%rbp)
  movl    -8(%rbp), %r10d
  movl    %r10d, -12(%rbp)                 # copyInstr
  movl    $0, -20(%rbp)
  movl    -20(%rbp), %r10d
  movl    %r10d, -24(%rbp)                 # copyInstr
  movl    $0, -32(%rbp)
  movl    -32(%rbp), %r10d
  movl    %r10d, -36(%rbp)                 # copyInstr
  # empty with returnName=a
  movl    $77, -44(%rbp)
  movl    -44(%rbp), %r10d
  movl    %r10d, -12(%rbp)                 # copyInstr
  # empty with returnName=b
  movl    $1, -52(%rbp)
  # empty with returnName=a
  movl    -12(%rbp), %r10d
  movl    %r10d, -56(%rbp)
  movl    -52(%rbp), %eax
  addl    %eax, -56(%rbp)
  movl    $1, -64(%rbp)
  movl    -64(%rbp), %r10d
  movl    %r10d, -68(%rbp)
  movl    -56(%rbp), %eax
  addl    %eax, -68(%rbp)
  movl    -68(%rbp), %r10d
  movl    %r10d, -24(%rbp)                 # copyInstr
  # empty with returnName=c
  # empty with returnName=b
  movl    $4, -76(%rbp)
  movl    -24(%rbp), %eax
  subl    -76(%rbp), %eax
  movl    %eax, -80(%rbp)
  movl    -80(%rbp), %r10d
  movl    %r10d, -36(%rbp)                 # copyInstr
  # empty with returnName=b
  pushq    %rdi
  movl    -24(%rbp), %edi                 # call Param
  call    putchar
  popq     %rdi
  # empty with returnName=c
  pushq    %rdi
  movl    -36(%rbp), %edi                 # call Param
  call    putchar
  popq     %rdi
  movl    $10, -88(%rbp)
  pushq    %rdi
  movl    -88(%rbp), %edi                 # call Param
  call    putchar
  popq     %rdi
  jmp    .L2_endof_main

.L2_endof_main:
  leave
  ret