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

Latest commit

 

History

History
74 lines (66 loc) · 1.71 KB

p_54.md

File metadata and controls

74 lines (66 loc) · 1.71 KB

5.4 "Compiler l’affectation vers une variable"

Command to run the test (source code):

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

Result :

.file  "p_54.c"
.text

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


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

  jmp    .L1_innerbeginof_main

.L1_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    $79, -44(%rbp)
  movl    -44(%rbp), %r10d
  movl    %r10d, -12(%rbp)                 # copyInstr
  # empty with returnName=b
  movl    $0, -48(%rbp)
  movl    -12(%rbp), %eax
  addl    %eax, -48(%rbp)
  movl    -48(%rbp), %r10d
  movl    %r10d, -24(%rbp)                 # copyInstr
  # empty with returnName=c
  movl    $75, -56(%rbp)
  movl    -56(%rbp), %r10d
  movl    %r10d, -36(%rbp)                 # copyInstr
  # empty with returnName=a
  movl    $10, -64(%rbp)
  movl    -64(%rbp), %r10d
  movl    %r10d, -12(%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
  # empty with returnName=a
  pushq    %rdi
  movl    -12(%rbp), %edi                 # call Param
  call    putchar
  popq     %rdi
  jmp    .L0_endof_main

.L0_endof_main:
  leave
  ret