Runtime系列:LLVM的中间代码(IR)【07】

简介: Runtime系列:LLVM的中间代码(IR)

Objective-C在变为机器代码之前,会被LLVM编译器转换为中间代码(Intermediate Representation)


可以使用以下命令行指令生成中间代码:


clang -emit-llvm -S main.m

常用语法简介:


@ - 全局变量

% - 局部变量

alloca - 在当前执行的函数的堆栈帧中分配内存,当该函数返回到其调用者时,将自动释放内存

i32 - 32位4字节的整数

align - 对齐

load - 读出

store - 写入

icmp - 两个整数值比较,返回布尔

br - 选择分支,根据条件来转向label,不根据条件跳转的话类似 goto

label - 代码标签

call - 调用函数


具体参考官方文档:https://llvm.org/docs/LangRef.html


相关文章
|
5月前
|
iOS开发 Perl
解决pod install报错:ffi is an incompatible architecture
解决pod install报错:ffi is an incompatible architecture
145 2
|
5月前
|
编译器 Linux API
BPF的可移植性和CO-RE (Compile Once – Run Everywhere)
BPF的可移植性和CO-RE (Compile Once – Run Everywhere)
53 2
|
并行计算 编译器 TensorFlow
win10 install tensorflow error:Loaded runtime CuDNN library: 7102 but source was compiled with 7005
win10 install tensorflow error:Loaded runtime CuDNN library: 7102 but source was compiled with 7005
175 0
编译OpenJDK11:configure: error: Target CPU mismatch. We are building for x86_64 but CL is for “版“; exp
编译OpenJDK11:configure: error: Target CPU mismatch. We are building for x86_64 but CL is for “版“; exp
175 0
|
C++
编译OpenJDK11:fixpath Unknown argument: -nologo
编译OpenJDK11:fixpath Unknown argument: -nologo
129 0
MAC编译OpenJDK8:clang: error: unknown argument: ‘-fpch-deps‘
MAC编译OpenJDK8:clang: error: unknown argument: ‘-fpch-deps‘
98 0
MAC编译OpenJDK8:error: ‘&&‘ within ‘||‘ [-Werror,-Wlogical-op-parentheses]
MAC编译OpenJDK8:error: ‘&&‘ within ‘||‘ [-Werror,-Wlogical-op-parentheses]
105 0
MAC编译OpenJDK8:error: invalid argument ‘-std=gnu++98‘ not allowed with ‘C‘
MAC编译OpenJDK8:error: invalid argument ‘-std=gnu++98‘ not allowed with ‘C‘
111 0
编译OpenJDK12:Target CPU mismatch. We are building for x86_64 but CL is for ""; expected "x64"
编译OpenJDK12:Target CPU mismatch. We are building for x86_64 but CL is for ""; expected "x64"
124 0