Intermediate Representation

Created
Created
2021 May 5 16:0
Editor
Editor
Alan JoAlan Jo
Creator
Creator
Alan JoAlan Jo
Edited
Edited
2022 Dec 3 8:5
Refs
Refs

IR

  • Three-address code
  • stack-machine code type
An internal code representation used by compilers
2개의 입력용과 1개의 출력용 메모리 주소 혹은 레지스터를 지정하는 형식이기 때문에 Three-address code
언어와 기계 사이의 의존성을 독립적으로 유지하기 위해서
전단부는 입력으로 받은 소스 프로그램을 후단부가 이해할 수 있는 코드로 번역하는 역할이고, 후단부는 해당 코드를 입력받아 동작시킬 기계에서 적합한 코드로 번역을 하는 역할을 담당
전단부는 후단부가 이해할 수 있는 별도의 코드를 결과물로 출력하는데, 이를 중간 코드
  • U-Code
  • P-code : stack-machine code type
  • JVM Byte Code : stack-machine code type
컴파일러 최적화를 실현하는데 사용
  • Operators use at most three addresses
  • Introduce temporary vairables (interior nodes in
    AST
    )
  • quadruple
    • An array or linked list of 4-tuple struct
  • triple
    • Let operations implicitly define temporary variables
 
 
 
 
 
 

Recommendations