ir_code.txt 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. Intermediate representation of program:
  2. Data...
  3. LABEL( sconst ) ;insert an ASM label
  4. INT( iconst ) ;insert int constant
  5. FLOAT( fconst ) ;insert float constant
  6. STRING( sconst ) ;insert string constant
  7. Code...
  8. Statements only:
  9. ENTER( iconst ) ;enter func with iconst locals
  10. LEAVE( iconst ) ;leave func with iconst locals
  11. JUMP( sconst ) ;jump to label sconst
  12. JUMPT( l,sconst ) ;eval expr-l, if !=0 jump to label sconst
  13. JUMPF( r,sconst ) ;eval expr-r, if ==0 jump to label sconst
  14. RETURN( l,sconst ) ;eval expr-l into return reg and jump to label sconst
  15. STORE( l,r ) ;eval expr-r and store it in expr-l
  16. Stmts or expressions:
  17. CALL( l,r ) ;eval expr-r, push it and call expr-l
  18. ARGS( l,r ) ;eval expr-r, push it, eval expr-l
  19. FRAME() ;copy of frame pointer
  20. GLOBAL( sconst ) ;address of label sconst
  21. LOAD( l ) ;integer load
  22. NEG( l ),NOT( l ).. ;integer uniops
  23. ADD( l,r ),SUB( l,r ).. ;integer binops
  24. CONST( iconst ) ;integer constant
  25. CAST( l ) ;cast float expr-l to int
  26. FLOAD( l ) ;float load
  27. FNEG( l ),FNOT( l ).. ;float uniops
  28. FADD( l,r ),FSUB( l,r ).;float binops
  29. FCONST( fconst ) ;float constant
  30. FCAST( l ) ;cast int expr-l to float