文档介绍:毕业设计(论文)报告
题目基于 Minisystem 的 GCC 编译器的移植
计算机科学与工程学院院(系) 计算机科学与技术专业
学号 09006309
学生姓名马小京
指导教师王晓蔚
起讫日期 —
设计地点计算机楼
2010 年 6 月 7 日
基于 Minisystem 的 GCC 编译器的移植
09006309 马小京
指导教师王晓蔚
摘要
根据 MiniSystem 系统的编译需要,研究并分析 GCC 的编译过程以及移植原理。通
过对 GCC 编译器后端的研究和 RTL 语言的理解,说明后端编译时编译器的处理过程;
给出移植过程中对机器定义中 INSN 的修改和新建的方法,以及机器定义中 RTL 的含
义和作用。以编译过程中典型的指令模板为例子,使用移植后的编译器对 C 程序片段
进行编译,说明了 GCC 移植的方法并列出编译产生的结果。同时,在移植过程中根据
指令集设置对编译器进行优化,讨论并且对优化前后的编译器进行了对比。
关键词: 编译器, GCC, 移植, RTL
i
GCC Porting on MiniSystem
09006309 Ma Xiaojing
Wang Xiaowei
Abstract
Based on the demand of pile on MiniSystem, the project prepared for re-
search and analyse pile process and porting principle of GCC. Through a study in the
back-end of GCC and to understand the RTL language, the thesis explains the operation pro-
cesses of the back-pile. Then shows how to modify or create a INSN definition in
the machine-definition of the porting, also indicates the meaning and function of RTL in the
machine-definition. Takes several typical instruction templates as example, piled the C
language program by piler and illustrate the result of user-pile through
GCC porting. Meanwhile, piler was optimized based on the set of instructions. Then
the thesis discussed pared with the original and optimized cimpiler.
Keywords: Compiler, GCC, Porting, RTL
ii
本论文专用术语的注释表
GCC: GNU 编译器集合。
移植: 使得 GCC 可以编译在新定义处理器体系下运作。
RTL: 寄存器转换语言,在 GCC 编译中间起转换作用的描述语言。
前端:Front-end,GCC 编译器中跟机器无关而跟编程语言相关的前向处理部分。
后端:Back-end,GCC 编译器中跟语言无关而跟目标机器平台相关的后续处理部分。
汇编语言:一种与机器硬件紧密相关的底层程序语言,与机器语言存在部分对应关系。
机器语言:二进制程序代码,计算机能够直接识别并且执行,程序直接通过计算机硬件结构赋
予操作功能。同时,与硬件对应意味着无法再不同结构的计算机上执行。
指令集:计算机架构中与程序运行的相关内容。包含了本身的数据类型,指令,寄存器,地址
模型,存储结构,中断以及意外处理,I/O 处理等。一个指令集包括一系列的指令(机器语言)定
义,以及和处理器相关的运行命令。
机器描述:GCC 后端编译中对目标平台指令集进行描述的文件,编译过程中 GCC 会将中间代
码来匹配机器描述用来生成汇编程序。
iii
目录
要· · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · i
Abstract · · · · · · · · · · · · · · · · · · · · · · · · · ·