当前位置:网站首页>LLVM TargetPassConfig
LLVM TargetPassConfig
2022-06-25 01:06:00 【Hui's Sutra Pavilion】
TargetPassConfig
TargetPassConfig Class is LLVM Back end add pass entrance ,LLVM The framework divides the whole back end into instruction selection 、 Instruction scheduling , Register allocation, etc ,, Here's the picture :

Each of these phases contains one or more pass,LLVM One of the most important processes in the backend is compatibility and modularity , To add to these back ends pass Conduct management ,LLVM The back end encapsulates the interfaces for the above important stages , Each interface basically represents one Important stage , Every target You can add as many as you need pass,
TargetPassConfig The class for codegen Various interfaces are provided for each stage in , The main interfaces provided are as follows :
Interface | explain |
addISelPasses | Add all necessary from llvm IR Convert to generation MI Of pass |
addIRPasses | Add pair llvm IR->IR The optimization of the pass |
addPassesToHandleExceptions | Add various exceptions at lower levels pass, these pass Main treatment CodeGen Various exceptions generated in |
addCodeGenPrepare | stay LLVM IR Add... To this level CodeGen I've been preparing for pass, these pass At this time, only IR, So you need to addPassesToHandleExceptions Before adding |
addISelPrepare | Add some optimizations before instruction selection IR Of pass, This stage is also in IR Stage , Not converted to DAG, Main optimization IR |
addInstSelector | Add instruction selector selector And if necessary pass |
addIRTranslator | add to IR Convert to machine code related pass, When calling a relationship addIRTranslatoràaddInstSelector |
addMachinePasses | Add a set CodeGen Required by the standard pass |
addMachineSSAOptimization | SSA Optimization needs to add pass |
addPreRegAlloc/addPostRegAlloc | Before register allocation / You need to add pass |
addFastRegAlloc | To quickly allocate registers, you need to add pass |
addPassesToGenerateCode
addPassesToGenerateCode Function to add CodeGen Pass The main entrance :
/// addPassesToX helper drives creation and initialization of TargetPassConfig.
static TargetPassConfig *
addPassesToGenerateCode(LLVMTargetMachine &TM, PassManagerBase &PM,
bool DisableVerify,
MachineModuleInfoWrapperPass &MMIWP) {
// Targets may override createPassConfig to provide a target-specific
// subclass.
TargetPassConfig *PassConfig = TM.createPassConfig(PM);
// Set PassConfig options provided by TargetMachine.
PassConfig->setDisableVerify(DisableVerify);
PM.add(PassConfig);
PM.add(&MMIWP);
if (PassConfig->addISelPasses())
return nullptr;
PassConfig->addMachinePasses();
PassConfig->setInitialized();
return PassConfig;
}
- createPassConfig : according to PM Create the corresponding target Of TargetPassConfig , Every target Will be based on this class , Re implement the important interfaces in the phase to add unique pass, It doesn't affect the others target
- PassConfig->addISelPasses: Add what is required in the instruction selection phase pass The main entrance
- PassConfig->addMachinePasses(): Instructions from IR After converting to machine code , Added pass, Including register allocation , And machine code level optimization pass etc.
AMDGPU TargetPassConfig
When writing a new backend , An important content is to realize this target Add as needed pass, With AMDGPU For example TargetPassConfig The inheritance relationship is as follows :

- AMDGPUPassConfig: It's all AMDGPU The backend must be added pass
- GCNPassConfig and R600PassConfig They are aimed at GCN and R600 platform .
边栏推荐
- 2022 crane driver (limited to bridge crane) examination question bank simulated examination platform operation
- Thermodynamic diagram display correlation matrix
- Danish Technical University pioneered the application of quantum computing to power flow modeling of energy system
- Sanic service startup failed
- Activity startup process
- I'd like to ask how to open an account at industrial securities? Is it safe to open a stock account through the link
- Using tcp/udp tools to debug the yeelight ribbon
- Scala adapter pattern
- 2022年起重机司机(限桥式起重机)考试题库模拟考试平台操作
- Mobile security tool jarsigner
猜你喜欢

Thermodynamic diagram display correlation matrix

Preliminary understanding of qtoolbutton

Danish Technical University pioneered the application of quantum computing to power flow modeling of energy system
![[micro service sentinel] real time monitoring | RT | throughput | concurrency | QPS](/img/fc/6b36759570b9b1007d2640009576d9.png)
[micro service sentinel] real time monitoring | RT | throughput | concurrency | QPS

生成订单30分钟未支付,则自动取消,该怎么实现?

Network request -volley

热力图展示相关矩阵

Zuckerberg demonstrated four VR head display prototypes, and meta revealed the "family" of metauniverse

大厂高频软件测试面试题和答案都帮你准备好啦,备战金九银十

Using tcp/udp tools to debug the yeelight ribbon
随机推荐
QT (36) -rapidjson parsing nested JSON
改造一下 BeanUtils,优雅的实现 List 数据拷贝
移动安全工具-jar
Go语言运算符(第8课下)
Network request -volley
ros(25):rqt_ image_ View reports an error unable to load plugin for transport 'compressed', error string
2022 crane driver (limited to bridge crane) examination question bank simulated examination platform operation
C#和C 的CAN通信实验
Scala trait exercise
A plug-in framework for implementing registration free and login verification with hook technology
Practical operation notes - notebook plus memory and ash cleaning
Text editor for QT project practice -- Episode 9
2022R1快开门式压力容器操作考题及答案
LLVM TargetPassConfig
最新QQ微信域名防红PHP程序源码+强制跳转打开
I brush the question I - copy the linked list with random pointer
Thingsboard - rest API obtains and refreshes tokens
JSON file of China's provincial boundaries
I 刷题 I — 复制带随机指针的链表
EVM Brief