What is the difference between frontend IR and non...
# compiler
c
What is the difference between frontend IR and non-frontend IR? They have different APIs, but what does "frontend" mean in this context?
d
On the high level the compiler consists of two parts: • one for analyzing the source code, resolve calls, infer types, report errors (frontend) • another for taking this analysis results and generating the actual bytecode/js/native code (backend) So frontend and backend IRs are different representations of the code used by these two parts There are two different APIs both due to historical reasons and as their use-cases are quite different, so they designed to perform different things over them in different contexts
thank you color 1
c
So if I were to make a plugin to change
val x = methodMeta(Foo::bar)
to
val x = MethodMetadata("example/Foo", "bar", "()V")
(typesafe function references but without classloading at runtime, for ASM purposes), would I want to target frontend or backend IR?
d
Backend IR (
IrGenerationExtension
)
c
Awesome, thanks!
d
Also see this thread