什么是clo子? [英] What is a clobber?

查看:55
本文介绍了什么是clo子?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Clang TargetInfo 的方法称为getClobbers :

以LLVM格式返回目标特定的字符串.

Returns a string of target-specific clobbers, in LLVM format.

那么,什么是clo子?

So, what is a clobber?

推荐答案

被破坏的寄存器是被破坏的寄存器,即由内联汇编器以不可预测的方式进行修改.这通常在您需要临时工时发生.注册或使用特定的指令,而该指令恰好将某些寄存器作为副产品进行修改.

A clobbered register is a register which is trashed i.e. modified in unpredictable way by inline assembler. This usually happens when you need a temp. register or use particular instruction which happens to modify some register as a by-product.

通常,程序员会显式地声明被其内联asm代码破坏的寄存器,但默认情况下可能会认为其中一些已被破坏,而这正是 getClobbers 发挥作用的地方.

Usually programmer explicitly declares registers which are clobbered by his inline asm code but some may be considered to be trashed by default and that's where getClobbers come into play.

getClobbers 对于大多数目标返回空结果.在MIPS上,GCC历来没有在生成的代码中使用 $ 1 ,因此大多数程序员不必费心将其声明为破坏者".为了降低可移植性成本,LLVM认为 $ 1 总是在嵌入式asm中被破坏.另一个示例是算术标志寄存器(cc),它是

getClobbers returns empty result for most targets. On MIPS GCC has historically not used $1 in generated code so most programmers didn't bother to declare it as clobbered. To reduce portability costs, LLVM considers $1 to be always clobbered in inline asm. Another example is arithmetic flags register (cc) which is considered to be always clobbered by inline asm by GCC on i386 and x86_64 targets.

这篇关于什么是clo子?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆