the smallest meaningful units "tokens." •Lexical analysis • Check syntax rules based on tokens and analyze the structure of the program. Generate AST •Semantic analysis • Check the type and scope of the variable and check if the program is semantically correct •IR generation • Generate code to make the compiler optimized •Optimization • Transform IR into functionally equivalent but faster (or smaller) forms •Code generation • Translate transformed IR into machine language ⚠Depends on the compiler and so on….
source code into the smallest meaningful units "tokens." • Lexical analysis • Check syntax rules based on tokens and analyze the structure of the program. Generate AST • Semantic analysis • Check the type and scope of the variable and check if the program is semantically correct •IR generation • Generate code to make the compiler optimized • Optimization • Transform IR into functionally equivalent but faster (or smaller) forms • Code generation • Translate transformed IR into machine language ⚠Depends on the compiler and so on….
process of converting programming language code to machine language •Why needed? • The structure is simple and the code is easy to optimize • Generate code for various targets (e.g. Apple Silicon's MacOS) • Development e ff i ciency by separating compiler processes
suitable for C++ & not fi t for the usage of Swift(e.g. for loop) • Emphasis on advanced optimization on the Swift side • Compatible with Swift's unique calling conventions • Supports future language features • Flexible memory management by the caller(via Task)
the path from A to B passes through the suspend point (whether a suspend instruction is included) SuspendCrossingInfo class https://github.com/swiftlang/llvm-project/blob/next/llvm/include/llvm/Transforms/Coroutines/SuspendCrossingInfo.h LLVM
suspend point, use a static AsyncContextSize? (Not sure how to judge) •Erase swift_task_alloc on SILOptimizer or LLVM? Hmm…🤔 https://github.com/swiftlang/swift/issues/72289
at fi rst •Debug and grasp the processing fl ow (it’s important to fi nd the entry point) •Get used to frequent words and abbreviations •Don't be misled by casting For those who are interested in Swift compilers
• Awesome LLVM • SwiftίϯύΠϥ։ൃೖ(The introduction of Swift compiler dvelopment) • Explore Swift performance • Swift concurrency: Behind the scenes • Swift repository • LLVM repository(forked by Apple) • Async lowering • Issue about unnecessary async frame References