GCC's bacl-end & assemble emission (47)
来源:互联网 发布:vscode java 开发环境 编辑:程序博客网 时间:2024/06/05 11:51
17. Toolof gencheck
Program after processing by front-end, is transformed into rtl form.Program in this intermediate form is constructed as a tree. Can conceive thatthe nodes in the tree are various and complex, to put node creation in easierand more controllable way. Nodes are described in tree.def and C-common.def(file specified for c & c++) similar as rtx object in rtl.def.
The instruction used to describe tree nodes is in following form.
DEFTREECODE(SYM, NAME, TYPE, LENGTH)
For example in tree.def, we can get following lines.
DEFTREECODE (IDENTIFIER_NODE,"identifier_node", 'x', 0)
In gencheck.c we can see below code snippet.
27 #define DEFTREECODE(SYM, NAME, TYPE, LEN) #SYM, ingencheck.c
28
29 static const char *const tree_codes[] = {
30 #include "tree.def"
31 #include "c-common.def"
32 #include "gencheck.h"
33 (char*) 0
34 };
At line 32 above, gencheck.h will be created by Makefile which willinclude appropriate def files according to the target language.
44 int
45 main (int argc, char **argvATTRIBUTE_UNUSED) ingencheck.c
46 {
47 int i, j;
48
49 switch (argc)
50 {
51 case 1:
52 break;
53
54 default:
55 usage ();
56 return (1);
57 }
58
59 puts ("/* This file is generated using gencheck. Do not edit.*/\n");
60 puts ("#ifndef GCC_TREE_CHECK_H");
61 puts ("#define GCC_TREE_CHECK_H\n");
62
63 /* Print macros for checks based on each ofthe tree code names. However,
64 since we include the tree nodes from alllanguages, we must check
65 for duplicate names to avoid defining thesame macro twice. */
66 for(i = 0; tree_codes[i];i++)
67 {
68 for(j = 0; j < i; j++)
69 if (strcmp (tree_codes[i], tree_codes[j]) == 0)
70 break;
71
72 if (i == j)
73 printf ("#define %s_CHECK(t)\tTREE_CHECK (t, %s)\n",
74 tree_codes[i], tree_codes[i]);
75 }
76
77 puts ("\n#endif /* GCC_TREE_CHECK_H */");
78 return 0;
79 }
Then as for IDENTIFIER_NODE, following code will be output intotree-check.h
#define IDENTIFIER_NODE_CHECK(t) TREE_CHECK (t, IDENTIFIER_NODE)
18. Toolof genconstants
The tool will output insn-constants.h defining constants used inmachine description file.
52 int
53 main (int argc, char **argv) ingenconstants.c
54 {
55 int dummy1, dummy2;
56 rtx desc;
57
58 progname= "genconstants";
59
60 if (argc <= 1)
61 fatal ("no input file name");
62
63 if (init_md_reader (argv[1]) != SUCCESS_EXIT_CODE)
64 return (FATAL_EXIT_CODE);
65
66 /* Scan and discard the entire file. This hasthe side effect
67 of loading up the constants table that wewish to scan. */
68 do
69 desc = read_md_rtx (&dummy1,&dummy2);
70 while (desc);
71
72 puts ("/* Generated automatically by the program`genconstants'");
73 puts (" from the machinedescription file `md'. */\n");
74 puts ("#ifndef GCC_INSN_CONSTANTS_H");
75 puts ("#defineGCC_INSN_CONSTANTS_H\n");
76
77 traverse_md_constants (print_md_constant, stdout);
78
79 puts ("\n#endif /*GCC_INSN_CONSTANTS_H */");
80
81 if (ferror (stdout) || fflush(stdout) || fclose (stdout))
82 return FATAL_EXIT_CODE;
83
84 return SUCCESS_EXIT_CODE;
85 }
477 void
478 traverse_md_constants (htab_trav callback, void *info) inread-rtl.c
479 {
480 if (md_constants)
481 htab_traverse (md_constants, callback, info);
482 }
In i386.md, it uses define_constants to define constants to be used.md_constantsabove records the constants read byread_constants.
- GCC's bacl-end & assemble emission (47)
- GCC's bacl-end & assemble emission (1)
- GCC's bacl-end & assemble emission (2)
- GCC's bacl-end & assemble emission (3)
- GCC's bacl-end & assemble emission (4)
- GCC's bacl-end & assemble emission (5)
- GCC's bacl-end & assemble emission (6)
- GCC's bacl-end & assemble emission (7)
- GCC's bacl-end & assemble emission (8)
- GCC's bacl-end & assemble emission (9)
- GCC's bacl-end & assemble emission (10)
- GCC's bacl-end & assemble emission (11)
- GCC's bacl-end & assemble emission (12)
- GCC's bacl-end & assemble emission (13)
- GCC's bacl-end & assemble emission (14)
- GCC's bacl-end & assemble emission (15)
- GCC's bacl-end & assemble emission (16)
- GCC's bacl-end & assemble emission (17)
- java zip
- javascript之对象学习笔记(二)--对象原型,继承
- 10Web开发者相关的资源博客
- GCC后端及汇编发布(47)
- ora-12505
- GCC's bacl-end & assemble emission (47)
- 二维数组的指针变量笔记
- GCC's back-end & assemble emission - Current content
- Android[中级教程] 深入剖析Android消息机制
- 计算机自动更新变灰色,无法修改解决方法。
- 造成商业软件失败的13种原因
- 刀削面之心伤
- ORM框架
- MDK 下STM32内嵌汇编