| Digital Signal Processor (DSP) uses the architecture that is different from the general processor, so the compiler that uses the traditional compile techniques can't generate code that can meet the performance requirement of digital processing. Untraditional compile techniques need to be developed to handle the problem. The pragma and the embedded assembly language are two feasible and popular methods of the methods adopted by the industry.BWDSP100 is a high performance DSP which is developed by some domestic institute. Our work discussed by the paper is to design and implement the pragma and the embedded assembly language for BWDSP100. We use the famous retargeting compiler IMPACT as our compile infrastructure.Pragma related work includes the design and implementation. We designed three kinds of pragma which are pragma DATA_ALIGN, pragma DATA_MEM_BANK and pragma DATA_SECTION for BWDSP100. Pragma DATA_ALIGN and pragma DATA_MEM_BANK are mainly used to solve the problem caused by the call between a C source code and the hand-written assembly library. Pragma DATA_SECTION is used to locate the data among the several memory blocks. We also develop an optimization algorithm which uses the information of pragma DATA_SCTION to allocate AGU for address computing instructions and memory access instructions. Experiments show that the algorithm is very effective in optimization. The implementation requires that the information of pragma can be represented in the IMPACT's high level intermediate representation Pcode and the IMPACT's low level intermediate representation Lcode exactly.We design the syntax and semantics of the embedded assembly language for BWDSP100 and implement the embedded assembly language in IMPACT. The design of the embedded assembly language not only refers to the industry's existing designs but also refers to features of BWDSP100's instructions. The compiler's frontend and backend need to be changed to implement the embedded assembly language. Compiler frontend translates the embedded assembly statement into Lcode form of embedded assembly, which involves the conversion from abstract syntax tree to the Pcode and the conversion from Pcode to Lcode. The stages of backend that should be changed include instruction clustering, register allocation and instruction scheduling. In this paper, the stages influenced by the embedded assembly language are described in detail. |