为什么编译器不生成微指令而是生成汇编代码?

发布于 2024-12-10 14:11:55 字数 421 浏览 0 评论 0原文

我想知道为什么在现实世界中,编译器生成汇编代码,而不是微指令

如果您已经绑定到一种架构,为什么不更进一步,让处理器不必在运行时将汇编代码转换为微指令呢?

我认为也许某个地方存在实施瓶颈,但我在 Google 上没有找到任何信息。

通过微指令编辑 我的意思是:如果您的汇编指令是ADD(R1,R2),那么微指令就是。将R1加载到ALU,将R2加载到ALU,执行运算,将结果加载回R1。另一种看待这一问题的方法是将一条微指令等同于一个时钟周期。

我的印象是微指令是'官方'名称。显然这里存在一些里程变化。

FA

I would like to know why, in the real world, compilers produce Assembly code, rather than microinstructions.

If you're already bound to one architecture, why not go one step further and free the processor from having to turn assembly-code into microinstructions at Runtime?

I think perhaps there's a implementation bottleneck somewhere but I haven't found anything on Google.

EDIT by microinstructions I mean: if you assembly instruction is ADD(R1,R2), the microinstructions would be. Load R1 to the ALU, load R2 to the ALU, execute the operation, load the results back onto R1. Another way to see this is to equate one microinstruction to one clock-cycle.

I was under the impression that microinstruction was the 'official' name. Apparently there's some mileage variation here.

FA

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

时光倒影 2024-12-17 14:11:56

编译器不产生微指令,因为处理器不执行微指令。它们是芯片的实现细节,而不是暴露在芯片外部的东西。无法向芯片提供微指令。

Compilers don't produce micro-instructions because processors don't execute micro-instructions. They are an implementation detail of the chip, not something exposed outside the chip. There's no way to provide micro-instructions to a chip.

森末i 2024-12-17 14:11:56

因为 x86 CPU 不执行微操作,所以它执行操作码。您无法创建包含微操作的二进制映像,因为无法以 CPU 理解的方式对它们进行编码。

您所建议的基本上是针对 x86 CPU 的新 RISC 风格指令集。之所以没有发生,是因为它会破坏与为 x86 指令集编写的大量应用程序和操作系统的兼容性。

Because an x86 CPU doesn't execute micro operations, it executes opcodes. You can not create a binary image that contains micro operations since there is no way to encode them in a way that the CPU understands.

What you are suggesting is basically a new RISC-style instruction set for x86 CPUs. The reason that isn't happening is because it would break compatibility with the vast amount of applications and operating systems written for the x86 instruction set.

穿越时光隧道 2024-12-17 14:11:56

答案很简单。

(某些)编译器确实会生成代码序列,例如加载 r1、加载 r2、将 r2 添加到 r1。但这正是机器代码指令(您称为微代码)。这些指令是外部世界和处理器内部之间唯一的接口。

(其他编译器只生成 C,并让像 gcc 这样的 C 后端关心脏细节。)

The answer is quite easy.

(Some) compilers do indeed generate code sequences like load r1, load r2, add r2 to r1. But this are precisely the machine code instructions (that you call microcode). These instructions are the one and only interface between the outer world and the innards of a processor.

(Other compilers generate just C and let a C backend like gcc care about the dirty details.)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文