Automatically Generating Instruction Selectors Using Declarative Machine Descriptions

被引:9
作者
Dias, Joao [1 ]
Ramsey, Norman [1 ]
机构
[1] Tufts Univ, Medford, MA 02155 USA
来源
POPL'10: PROCEEDINGS OF THE 37TH ANNUAL ACM SIGPLAN-SIGACT SYMPOSIUM ON PRINCIPLES OF PROGRAMMING LANGUAGES | 2010年
关键词
Instruction selection; retargetable compilers; declarative machine descriptions; ALGORITHM; CODE;
D O I
10.1145/1706299.1706346
中图分类号
TP31 [计算机软件];
学科分类号
081202 ; 0835 ;
摘要
Despite years of work on retargetable compilers, creating a good, reliable back end for an optimizing compiler still entails a lot of hard work. Moreover, a critical component of the back end the instruction selector-must be written by a person who is expert in both the compiler's intermediate code and the target machine's instruction set. By generating the instruction selector from declarative machine descriptions we have (a) made it unnecessary for one person to be both a compiler expert and a machine expert, and (b) made creating an optimizing back end easier than ever before. Our achievement rests on two new results. First, finding a mapping from intermediate code to machine code is an undecidable problem. Second, using heuristic search, we can find mappings for machines of practical interest in at most a few minutes of CPU time. Our most significant new idea is that heuristic search should be controlled by algebraic laws. Laws are used not only to show when a sequence of instructions implements part of an intermediate code, but also to limit the search: we drop a sequence of instructions not when it gets too long or when it computes too complicated a result, but when too much reasoning will be required to show that the result computed might be useful.
引用
收藏
页码:403 / 416
页数:14
相关论文
共 39 条
[1]   CODE GENERATION USING TREE MATCHING AND DYNAMIC-PROGRAMMING [J].
AHO, AV ;
GANAPATHI, M ;
TJIANG, SWK .
ACM TRANSACTIONS ON PROGRAMMING LANGUAGES AND SYSTEMS, 1989, 11 (04) :491-516
[2]  
[Anonymous], 1976, A discipline of programming
[3]   Fast, effective dynamic compilation [J].
Auslander, J ;
Philipose, M ;
Chambers, C ;
Eggers, SJ ;
Bershad, BN .
ACM SIGPLAN NOTICES, 1996, 31 (05) :149-159
[4]   Automatic detection and diagnosis of faults in generated code for procedure calls [J].
Bailey, MW ;
Davidson, JW .
IEEE TRANSACTIONS ON SOFTWARE ENGINEERING, 2003, 29 (11) :1031-1042
[5]  
BENITEZ ME, 1994, LNCS, V782, P105
[6]  
Bezem M., 2003, Cambridge Tracts in Theoretical Computer Science
[7]  
Cattell R. G. G., 1980, ACM Transactions on Programming Languages and Systems, V2, P173, DOI 10.1145/357094.357097
[8]   C compiler retargeting based on instruction semantics models [J].
Ceng, JJ ;
Hohenauer, M ;
Braun, G .
DESIGN, AUTOMATION AND TEST IN EUROPE CONFERENCE AND EXHIBITION, VOLS 1 AND 2, PROCEEDINGS, 2005, :1150-1155
[9]  
CIFUENTES C, 1999, P WORK C REV ENG ATL, P280
[10]   Reverse interpretation plus mutation analysis equals automatic retargeting [J].
Collberg, CS .
ACM SIGPLAN NOTICES, 1997, 32 (05) :57-70