Intermediate Representation

Creator
Creator
Seonglae ChoSeonglae Cho
Created
Created
2021 May 5 16:0
Editor
Edited
Edited
2025 Oct 22 23:58
Refs
Refs

Intermediate Representation (IR)

An intermediate representation is an internal code representation used by compilers to maintain independence between source languages and target machines. The compiler's front-end translates the source program into code that the back-end can understand, while the back-end converts this code into machine-appropriate instructions. This intermediate code serves as the bridge between these two phases and is essential for implementing compiler optimizations.

Types of IR

  1. Three-address codeA format that specifies two input memory addresses or registers and one output address. This is why it's called "three-address code."
      • Operators use at most three addresses
      • Introduces temporary variables (interior nodes in
        AST
        )
      • Can be represented as quadruple: an array or linked list of 4-tuple structures
      • Can be represented as triple: operations implicitly define temporary variables
  1. Stack-machine code typeExamples include:
      • U-Code
      • P-code
      • JVM Byte Code
Intermediate Representation Notion
 
 
 
컴파일러는 어떻게 내가 작성한 코드를 인식하는걸까? - 재그지그의 개발 블로그
이번 포스트는 기존에 제가 평소에 다루던 주제와는 조금 다릅니다. 아니, 프론트엔드 개발자가 형식 언어와 컴파일러 얘기라니... 이 무슨 저-급(Low-Level) 레이어 이야기를 하고 계신건가요? 맞습니다. 사실 대부분의 개발자는 연구자가 아닌 이상 응용 소프트웨어를 만드는 일을 하지, 이렇게 컴퓨터 이론과 언어학 자체에 대해서 깊게 알 필요는 없는 것 같습니다.
컴파일러는 어떻게 내가 작성한 코드를 인식하는걸까? - 재그지그의 개발 블로그
 
 
 

Recommendations