MIPS VS英特尔的x86 VS LLVM作为第一个汇编语言学习呢? [英] MIPS vs Intel x86 vs LLVM as the first assembly language to learn?

查看:254
本文介绍了MIPS VS英特尔的x86 VS LLVM作为第一个汇编语言学习呢?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我应该学哪种汇编语言作为我的第一个汇编语言? MIPS (更容易并经常用于教育的目的),英特尔的x86(全present)或 LLVM项目背后的便携式汇编语言?

Which assembly language should I learn as my first assembly language? MIPS (easier and often used for educational purposes), Intel x86 (omnipresent) or the portable assembly language behind the LLVM project?

针对LLVM装配一个优势是,我可能会尝试使用它作为一个学习的过程编写使用LLVM作为未来后端一个简单的编译器。

One advantage for the LLVM assembly is that I may attempt to use it as a learning exercise to write a simple compiler using LLVM as the backend in the future.

推荐答案

以上都不是。 86是你要学习的最后汇编语言。 MIPS 是对于许多原因相当教育,但它不是一个良好的第一指令集,主要是因为这是一个有点不标准,不使用标志,设有分公司推迟插槽,你必须忘掉一些事情要移动到另一个处理器。 MIPS也许第二或第三。

None of the above. x86 is the last assembly language you want to learn. MIPS is quite educational for a number of reasons, but it is not a good first instruction set mostly because it is a bit non-standard, doesn't use flags, has branch defer slots, you have to unlearn some things to move to another processor. MIPS maybe second or third.

LLVM 是不是真的组装,这是一个字节code。我有一个我创造了只为这,的 lsasim 的,搜索它在GitHub上。即使你不实际运行的例子,给它一个半小时阅读或更少。它应该给许多其他指令集的基础。 拇指(没有的 Thumb-2的扩展)是不错的。 MSP430 是真的不错,的 LatticeMico8 是pretty不错。 AVR 是不坏。 ARM 是pretty不错。获得舒适与一对夫妇三,然后MIPS或 DLX 。 86应该是最后的一个,如果你甚至不屑。如果你怕麻烦,学会八十六分之八千零八十八先工作,然后你向着present方式。

LLVM isn't really assembly, it is a bytecode. I have one I created just for this, lsasim, search for it at GitHub. Even if you don't actually run the examples, give it a half an hour read or less. It should give a foundation for many other instruction sets. Thumb (without Thumb-2 extensions) is good. MSP430 is really good, LatticeMico8 is pretty good. AVR is not bad. ARM is pretty good. Get comfortable with a couple-three and then MIPS or DLX. x86 should be one of the last, if you even bother. If you bother, learn 8088/86 first then work your way toward the present.

对于每个指令集它变得更容易,在第三或第四,你可以了解它,你写吧,你只是看一个快速参考卡上的说明,偶尔从全手动越来越详细,但大多只是爆炸出装配code。至少在理智的人,也有一些你必须做一些研究,以了解所有的规则。你不想学习这些后来在硬件上运行,首先找到一个模拟器,硬件如果需要的话。

With each instruction set it gets easier, by the third or fourth, you can learn it as you write it, you simply look up the instructions on a quick reference card, occasionally getting detail from a full manual, but mostly just bang out assembly code. At least for the sane ones, there are some you have to do some research to understand all the rules. You don't want to run on hardware for learning these, find a simulator first, hardware later if so desired.

您可以使用任何东西作为后端到前端(实际上是中间)。您的编译器的前端应解析为一个内部code,这是不汇编语言,然后从内部code键后端是靶特异性的(汇编语言或机器code)所示。 LLVM的中间发布,有可能实际使用这种方式,其他的编译器中/内部codeS充其量倾倒用于调试,但没有真正使用原样。我不会用汇编教育编译器的中间。如果你想编写一个后端,开始与LLVM或其他的东西存在,retargettable编译器,并写入后端到(在的 VBCC 编译器是第一个编译器后端的一个不错的选择,或获取LCC书,或一个超级简单:的小-C )。如果你想要写的前端,对于一些新的或现有的语言,然后LLVM可能不是一个坏的内部code使用,后端来作为赠品。

You can use anything as your backend to the front end (actually the middle). Your front end of the compiler should resolve to an internal code, which is not assembly language, then from the internal code to the backend which is target specific (assembly language or machine code). The LLVM middle is published and it is possible to actually use it that way, other compiler middle/internal codes are at best dumped for debugging but not really used as-is. I wouldn't use the assembly education for the middle of a compiler. If you want to write a backend, start with LLVM or something other existing, retargettable compiler, and write a backend to that (the vbcc compiler is a good choice for a first compiler backend, or get the LCC book, or a super simple one: Small-C). If you want to write a front end, for some new or existing language, then LLVM is probably not a bad internal code to use, the backends come as freebies.

这篇关于MIPS VS英特尔的x86 VS LLVM作为第一个汇编语言学习呢?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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