作者: 落人村
因为GCC利用gen*程序将md文件转换为insn*程序(gen*->insn*)
所以先对gen*进行分析。
第一个程序genflags
genflags-->insn-flags.h ( genflags avr.md > insn-flags.h )
功能: 将md文件中define_insn,define_expand中name不为空,且name[0]!='*'
的name及C test expression输出
如:
(define_insn "addqi3" /*define_expand也是处理第3个参数*/
[...]
"" /*第3个参数为空*/
"..."
[...])
==> #define HAVE_addqi3 1 /*宏定义为1*/
如:
(define_insn "mulqihi3"
[...]
"AVR_ENHANCED" /*第3个参数不为空*/
"..."
[...])
==> #define HAVE_mulqihi3 (AVR_ENHANCED) /*宏定义为C test expression*/
将前面处理过的define_insn和define_expand的rtx的指针保存在obstack堆栈中,
再遍历一遍。
如:
(define_insn "addqi3"
[ (set(match_operand:QI 0 ...) /*打印刚才省略的内容*/
(plus:QI(match_operand:QI 1...)
(match_operand:QI 2...)))]
""
"..."
[...])
==> extern rtx gen_addqi3( rtx, rtx, rtx ) /*有3个match_operand,所以有3个参数,如果没有,则为void*/
/*只统计match_operand、match_operator、match_parallel*/
当遇到"call"、"call_pop"、"sibcall"、"sibcall_pop"时,
产生类似"call"的如下宏定义:
#define GEN_CALL( A, B, C, D ) gen_call( ( A ), ( B ) ) /*"call"有2个match_operand,所以这里也是2个*/
当遇到"call_value"、"call_value_pop"、"sibcall_value"、"sibcall_value_pop"时,
产生类似"call_value"的如下宏定义:
#define GEN_CALL_VALUE( A, B, C, D, E ) gen_call_value( ( A ), ( B ), ( C ) ) /*"call_value"有3个match_operand,所以这里也是3个*/

没有评论:
发表评论