汇编:寄存器/register,基础概念
如果想将所有的信息放到一篇里,会发现这个文章会变得难于管理。所以要分开,要wiki。
关于寄存器的一些说明;https://handwiki.org/wiki/Processor%20register
cpu register
这个算是一个通用词,就是CPU的寄存器,x86有x86的寄存器;arm有arm的寄存器。
hard register
就是CPU含有的寄存器。硬件上实际存在的寄存器。和伪寄存器相对。
https://gcc.gnu.org/git/?p=gcc.git&a=commit;h=d321551cea11f27a9afd67ece9bbda095a579950
这个提到了硬件寄存器与伪寄存器之间的一个区别与应用。有助于理解概念。
i386: Separate costs of pseudo registers from hard registers
processor_costs has costs of RTL expressions with pseudo registers and
and costs of hard register moves:
1. Costs of RTL expressions are used to generate the most efficient RTL
operations with pseudo registers.
2. Costs of hard register moves are used by register allocator to
decide how to allocate and move hard registers.
Since relative costs of pseudo register load and store versus pseudo
register moves in RTL expressions can be different from relative costs
of hard registers, we should separate costs of RTL expressions with
pseudo registers from costs of hard registers so that register allocator
and RTL expressions can be improved independently.
This patch moves costs of hard register moves to the new hard_register
field and duplicates costs of moves which are also used for costs of RTL
expressions.
PR target/90878
* config/i386/i386.c (inline_memory_move_cost): Use hard_register
for costs of hard register moves.
(ix86_register_move_cost): Likewise.
* config/i386/i386.h (processor_costs): Move costs of hard
register moves to hard_register. Add int_load, int_store,
xmm_move, ymm_move, zmm_move, sse_to_integer, integer_to_sse,
sse_load, sse_store, sse_unaligned_load and sse_unaligned_store
for costs of RTL expressions.
* config/i386/x86-tune-costs.h: Move costs of hard register
moves to hard_register. Duplicate int_load, int_store,
xmm_move, ymm_move, zmm_move, sse_to_integer, integer_to_sse,
sse_load, sse_store for costs of RTL expressions.
general register
这个是一般寄存器,可以用来存放临时数据,做计算用的寄存器。当然是相对于特殊寄存器来说的一个概念。有些寄存器有特殊的用途。
整数寄存器
当有人写了一段代码,做了代码描述,怎样才能更好的理解其产生的作用;还是要从理解基本概念开始,理解了所有的基本概念之后,才能从整体理解改动到底是改了个啥事情。比如下面这个commit提到整数寄存器,与SSE寄存器。
整数寄存器就是和浮点寄存器相对应的一种寄存器。
commit d321551cea11f27a9afd67ece9bbda095a579950
Author: H.J. Lu <hongjiu.lu@intel.com>
Date: Thu Aug 15 18:15:33 2019 +0000
+ const int int_store[3]; /* cost of storing integer register
+ in QImode, HImode and SImode */
+ const int sse_to_integer; /* cost of moving SSE register to integer. */
这个整数寄存器其实说的是GPR,一般目的寄存器,可以存放整数的寄存器,没有什么特殊的含义。
http://x86asm.net/articles/using-xmm-for-general-purpose-simd-with-gpr/index.html
https://handwiki.org/wiki/Processor%20register
Intel 手册里出现的情况,还将GP(general-purpose)与整数寄存器放到了一块。
15.6.2 OpMask Instructions
• Mask read/write instructions: These instructions move data between a general-purpose integer register or memory and an opmask mask register, or between two opmask registers. For example:
si Doubleword integer register (for example: eax).
SSE 寄存器
这个是CPU的一个功能,专门用来做
register file
https://handwiki.org/wiki/Register_file
伪寄存器
https://learn.microsoft.com/en-us/windows-hardware/drivers/debugger/pseudo-register-syntax?redirectedfrom=MSDN
https://www.cnblogs.com/awpatp/archive/2011/01/01/1923726.html
许多寄存器的名字取决于处理器的架构, 因此对于那些偶尔使用调试器的用户来说很难记住所有平台上的寄存器名字. 为了克服这个问题, 调试器的开发团队引入了各种伪寄存器(Pseudo-Register), 由调试器将这些伪寄存器对应到不同的硬件架构上.
在编译器内部也是在实际转换到硬件语言之前,有一个伪寄存器使用的一个阶段,用来做一些优化功能。
https://gcc.gnu.org/git/?p=gcc.git&a=commit;h=d321551cea11f27a9afd67ece9bbda095a579950
相关文章
- 自定义 WorkManager —— 基础概念
- ROS1云课→07基础概念
- 数据库ER图基础概念知识
- 什么是ER图?数据库ER图基础概念整理
- 【web Django学习】概念基础快速入门
- Linux环境编程必须搞懂的几个概念
- Kubernetes微服务常见概念及应用
- HarmonyOS实战[一]——原理概念介绍安装:基础篇
- 【一】知识图谱基础概念、开发流程以及落地策略
- 【K8S 系列】k8s 学习二,kubernetes 核心概念及初步了解安装部署方式
- 【数据挖掘】分类任务简介 ( 分类概念 | 分类和预测 | 分类过程 | 训练集 | 测试集 | 数据预处理 | 有监督学习 )
- 【运筹学】整数规划 ( 相关概念 | 整数规划 | 整数线性规划 | 整数线性规划分类 )
- 【Git】Git 基础命令 ( Git 版本库概念 | 创建版本库 git init | 克隆版本库 git clone )
- 【Linux 内核】SMP 对称多处理器结构 ( SMP 对称多处理器结构概念 | SMP 对称多处理器结构的优势与缺陷 | Linux 内核兼容多处理器要求 )
- 【Android 屏幕适配】屏幕适配基础概念 ① ( Android 与 iOS 屏幕宽高比种类 | 屏幕像素密度 DPI )
- 网络基础概念
- 【移动端网页布局】移动端网页布局基础概念 ① ( 移动端浏览器 | 移动端屏幕分辨率 | 移动端网页调试方法 )
- 【移动端网页布局】移动端网页布局基础概念 ⑥ ( 背景图像缩放 | 不等比例拉伸 - 同时设置宽高值 | 等比例拉伸 - 设置宽度 / cover / contain 值 )
- Oracle触发器:基础概念与类型 (oracle触发器类型)
- 集群概念介绍
- Linux集群系列之①—集群基础概念
- 学习Linux基础知识:重要概念和实践技能(linux基础课程)
- MySQL数据库的一瞥:快速把握基础概念(mysql数据库快照)
- 深入理解Oracle中的函数概念(oracle中的函数概念)
- PHP面向对象学习笔记之一基础概念