神奇的LLVM与llvmlite之JIT编译。
https://releases.llvm.org/11.0.0/docs/LangRef.html
llvmlite Documentation, Release 0.41.0dev0-64-gbbb88a7-dirty 3.2 User guide
3.2.1 IR layer—llvmlite.ir The llvmlite.ir module contains classes and utilities to build the LLVM IR(intermediate representation) of native functions.
The provided APIs may sometimes look like LLVM’s C++ APIs, but they never call into LLVM, unless otherwise noted. Instead, they construct a pure Python representation of the IR.
To use this module, you should be familiar with the concepts in the LLVM Language Reference.
Types
• Atomic types • Aggregate types • Other types
All values used in an LLVM module are explicitly typed. All types derive from a common base class Type. You can instantiate most of them directly. Once instantiated, a type should be considered immutable.
class llvmlite.ir.Type The base class for all types. Never instantiate it directly. Types have the following methods in common: • as_pointer(addrspace=0) Return a PointerType pointing to this type. The optional addrspace integer allows you to choose a non-default address space—the meaning is platform dependent.
• get_abi_size(target_data) Get the ABI size of this type, in bytes, according to the target_data—an llvmlite.binding. TargetData instance.
• get_abi_alignment(target_data) Get the ABI alignment of this type, in bytes, according to the target_data—an llvmlite.binding. TargetData instance. NOTE: get_abi_size() and get_abi_alignment() call into the LLVM C++ API to get the requested information.
• call(value) A convenience method to create a Constant of this type with the given value:
int32 = ir.IntType(32) >>> c = int32(42) >>> c
<ir.Constant type='i32' value=42> >>> print(c) i32 42
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 分享一个免费、快速、无限量使用的满血 DeepSeek R1 模型,支持深度思考和联网搜索!
· 基于 Docker 搭建 FRP 内网穿透开源项目(很简单哒)
· ollama系列1:轻松3步本地部署deepseek,普通电脑可用
· 按钮权限的设计及实现
· 25岁的心里话