MIPS上的“对齐"指令 [英] 'align' instruction on MIPS

查看:275
本文介绍了MIPS上的“对齐"指令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

此指令的确切作用是什么?我知道它会尝试将数据与特定数字的倍数对齐,但是为什么要这样做呢?其他汇编程序中是否有等效的说明?

What exactly does this instruction do? I know that it tries to align data with a multiple of a specific number but why would you need to do this? Is there an equivalent instruction in other assemblers?

推荐答案

通常,您可以对齐数据以获得更好的性能.对于大多数处理器,当不访问特定的字节边界时,内存访问会受到一定的影响.对于其他汇编程序,通常会有某种伪操作 为此.大多数编译器还会对齐其数据结构(尽管您可以出于调试目的将其禁用).

You usually align data to get better performance. For most processors, memory access has some penalty when not accessing specific byte boundaries. For other assemblers, there often is some kind of pseudo-op .align for this. Most compilers also align their data structures (though you can disable it for debug purposes).

也请参见维基百科条目.

请注意,如果您尝试访问未对齐的存储单元,则非仿真MIPS系统甚至可能崩溃(请参阅 此处).

Note that non-emulated MIPS systems might even crash if you try to access unaligned memory cells (see here and here).

这篇关于MIPS上的“对齐"指令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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