当前位置:网站首页>DCC888 :Register Allocation
DCC888 :Register Allocation
2022-06-27 17:32:00 【春江花月夜晨】
Register Allocation
Register Allocation
(0)These values might be stored either in registers, or in memory.
(1)Registers are fast, but they come in small quantity.
(2)Memory is plenty, but it has slower access time.
(3) A good register allocator should strive to keep in registers the variables used more often.

the three aspects of register allocation
register assignment
The task of determining in which register each variable will be kept
spill
If a variable must be mapped into memory, we call it a spill.
Spilling is the task of determining which variables must be mapped to memory.
coalescing
If we can assign the same register to two variables related by a move instruction, then we can eliminate this move. This optimization is called coalescing.

register constraints


maxLive :MaxLive is the maximum number of registers that are simultaneously alive at any program point of the program’s control flow graph.
MinReg :The minimum number of registers that a program needs,
MinReg > MaxLive

@ = e, c 该节点的input是c -> r1,e-> r2;
c = d, 该节点的input是d->r1, e->r2;
e = a, 该节点的input是d->r1, a->r2;此时发现与最开始的假设a->r1冲突。
Register Assignment is NP-Complete

Chaitin’s proof

the interference graph



Linear Scan
It is based on the greedy coloring of interval graphs:
– Given a sequence of intervals, we want to find the minimum number of colors necessary to paint them, so that overlapping intervals are given different colors.

Linearization of Basic Blocks
reverse post-order





first :r3 ->c
second: r1->a

intervals once spill
spill 到memory,将会打断variable生命周期

spill :need store/load placemeng


coalescing



live ranges with holes



graph coloring register allocation
the interference graph




simplification的时候,将node一次放入栈中。
r3 - r1 - r2 - e - c - b - a - d
reverse order : d - a - b - c - e - r2 - r1 - r3
greedy coloring



iterated register coalescing








spilling heuristics


spilling



其中以d为例:2是d在loop之外的def和use,10的一次方是d的loop nesting factor是1,乘以2是因为loop之内有def和use两次,d的degree为4.













边栏推荐
- Running lantern experiment based on stm32f103zet6 library function
- Function key input experiment based on stm32f103zet6 Library
- im即时通讯开发之双进程守护保活实践
- laravel框架中 定时任务的实现
- binder hwbinder vndbinder
- 明美新能源冲刺深交所:年应收账款超6亿 拟募资4.5亿
- Exporting coordinates of points in TXT format in ArcGIS
- 全面解析零知识证明:消解扩容难题 重新定义「隐私安全」
- External interrupt experiment based on stm32f103zet6 library function
- Recommend several open source IOT platforms
猜你喜欢

脉脉热帖:为啥大厂都热衷于造轮子?

Erreur Keil de Huada Single Chip Computer La solution de Weak

OpenSSL client programming: SSL session failure caused by an obscure function

Using WebDAV instead of 445 port file share

Vscode suggests that you enable gopls. What exactly is it?

在线文本按行批量反转工具

基于STM32F103ZET6库函数按键输入实验

Technology sharing | introduction to kubernetes pod

Redis 原理 - String

如何实现IM即时通讯“消息”列表卡顿优化
随机推荐
华大单片机KEIL报错_WEAK的解决方案
A simple calculation method of vanishing point
Market status and development prospect forecast of global active quality control air sampler industry in 2022
你知道 log4j2 各项配置的全部含义吗?带你了解 log4j2 的全部组件
Cloud native database: the outlet of the database, you can also take off
華大單片機KEIL報錯_WEAK的解决方案
Keras深度学习实战(12)——面部特征点检测
Current market situation and development prospect forecast of the global ductless heating, ventilation and air conditioning system industry in 2022
让单测变得如此简单 -- spock 框架初体验
华大单片机KEIL添加ST-LINK解决方法
一位平凡毕业生的大学四年
[notice of the Association] notice on holding summer special teacher training in the field of artificial intelligence and Internet of things
openssl客户端编程:一个不起眼的函数导致的SSL会话失败问题
Blink SQL built in functions
maxwell 报错(连接为mysql 8.x)解决方法
Market status and development prospect of resorcinol derivatives for skin products in the world in 2022
Blink SQL内置函数大全
信息学奥赛一本通 1335:【例2-4】连通块
9.OpenFeign服务接口调用
MySQL读取Binlog日志常见错误和解决方法