internal.tex 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622
  1. %
  2. % $Id$
  3. % This file is part of the FPC documentation.
  4. % Copyright (C) 1998 by Florian Klaempfl
  5. %
  6. % The FPC documentation is free text; you can redistribute it and/or
  7. % modify it under the terms of the GNU Library General Public License as
  8. % published by the Free Software Foundation; either version 2 of the
  9. % License, or (at your option) any later version.
  10. %
  11. % The FPC Documentation is distributed in the hope that it will be useful,
  12. % but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  14. % Library General Public License for more details.
  15. %
  16. % You should have received a copy of the GNU Library General Public
  17. % License along with the FPC documentation; see the file COPYING.LIB. If not,
  18. % write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  19. % Boston, MA 02111-1307, USA.
  20. %
  21. \documentclass{report}
  22. %
  23. % Preamble
  24. %
  25. \usepackage{ifthen}
  26. \usepackage{xspace}
  27. \usepackage{a4dutch}
  28. \usepackage{makeidx}
  29. \usepackage{fancyheadings}
  30. \usepackage{epsfig}
  31. \usepackage{multicol}
  32. \ifx\pdfoutput\undefined
  33. \usepackage{html}
  34. \usepackage{htmllist}
  35. \fi
  36. \usepackage{fpc}
  37. \latex{%
  38. \ifpdf
  39. \pdfcompresslevel=9
  40. \pdfpagewidth=210mm
  41. \pdfpageheight=297mm
  42. \pdfinfo{/Author(Michael Van Canneyt)
  43. /Title(Compiler documentation)
  44. /Subject(Free Pascal Compiler documentation)
  45. /Keywords(Free Pascal, Compiler, Internals)
  46. }
  47. \fi
  48. }
  49. %
  50. \html{\input{fpc-html.tex}}
  51. %
  52. % Settings
  53. %
  54. \pagestyle{fancy}
  55. \makeindex
  56. %
  57. % Start of document.
  58. %
  59. \begin{document}
  60. \title{Free Pascal :\\ Compiler documentation}
  61. \docdescription{Compiler documentation for \fpc, version \fpcversion}
  62. \docversion{1.0}
  63. \input{date.inc}
  64. \author{Micha\"el Van Canneyt\\Florian Kl\"ampfl}
  65. \maketitle
  66. \tableofcontents
  67. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  68. % Introduction
  69. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  70. \chapter{Introduction}
  71. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  72. % About this document
  73. \section{About this document}
  74. This document tries to make the internal workings of \fpc more clear.
  75. It is assumed that the reader has some knowledge about compiler
  76. building.
  77. This document describes the compiler as it is/functions at the time of
  78. writing. Since the compiler is under continuous development, some of the
  79. things described here may be outdated. In case of doubt, consult the
  80. \file{README} files distributed with the compiler.
  81. The \file{README} files are, in case of conflict with this manual,
  82. authoritative.
  83. I hope, my poor english is quite understandable. Feel free to correct
  84. spelling mistakes.
  85. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  86. % About the compiler
  87. \section{About the compiler}
  88. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  89. % Getting more information.
  90. \section{Getting more information.}
  91. The ultimate source for information about compiler internals is
  92. the compiler source, though it isn't very well documented. If you
  93. need more information you should join the developers mailing
  94. list or you can contact the developers.
  95. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  96. % Overview
  97. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  98. \chapter{Overview}
  99. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  100. % History
  101. \section{History}
  102. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  103. % The compiler passes
  104. \section{The compiler passes}
  105. It isn't easy to divide the compilation process of \fpc into passes
  106. how it is described by many thesis about compiler building,
  107. but I would say \fpc does the compilation in five passes:
  108. \begin{enumerate}
  109. \item Scanning and Parsing. The compiler reads the input file,
  110. does preprocessing (i. e.
  111. reading include files, expanding macros ...) (\ref{ch:scanner})
  112. and the parser (\ref{ch:parser}) creates a parse tree (\ref{ch:parse_tree}).
  113. While this pass the compiler builds also the symbol tables
  114. (\ref{ch:symbol_tables}).
  115. \item Semantic analysis. This pass checks if semantic of
  116. the code is correct, i.e. if the types of expressions matches
  117. to the operators (\ref{ch:semantical_analysis}). This pass determines
  118. also how many registers are needed to evalute an expression, this
  119. information is used by the code generator later.
  120. \item Code generation
  121. \item Optimizing of the assembler
  122. \item Assembler writing
  123. \end{enumerate}
  124. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  125. % The scanner
  126. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  127. %% \chapter{The scanner}
  128. \label{ch:scanner}
  129. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  130. % The symbol tables
  131. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  132. \chapter{The symbol tables}
  133. \label{ch:symbol_tables}
  134. The symbol table is used to store information about all
  135. symbols, declarations and definitions in a program.
  136. In an abstract view, a symbol table is a data base with a string field
  137. as index. \fpc implements the symbol table mainly as a binary tree, but
  138. for big symbol tables some hash technics are used. The implementation
  139. can be found in symtable.pas, object tsymtable.
  140. The symbol table module can't be associated with a stage of the compiler,
  141. each stage accesses it.
  142. The scanner uses a symbol table to handle preprocessor symbols, the
  143. parser inserts declaration and the code generator uses the collected
  144. information about symbols and types to generate the code.
  145. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  146. % Definitions
  147. \section{Definitions}
  148. Definitions are one of the most important data structures in \fpc.
  149. They are used to describe types, for example the type of a variable
  150. symbol is given by a definition and the result type
  151. of a expression is given as a definition.
  152. They have nothing to do with the definition of a procedure.
  153. Definitions are implemented as an object (in file \file{symtable.pas},
  154. \var{tdef} and its descendents). There are a lot of different
  155. definitions, for example to describe
  156. ordinal types, arrays, pointers, procedures, ...
  157. To make it more clear let's have a look at the fields of tdef:
  158. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  159. % Symbols
  160. %% \section{Symbols}
  161. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  162. % Working with symbol tables
  163. %% \section{Working with symbol tables}
  164. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  165. % The parse tree
  166. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  167. %% \chapter{The parse tree}
  168. \label{ch:parse_tree}
  169. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  170. % The parser
  171. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  172. %% \chapter{The parser}
  173. \label{ch:parser}
  174. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  175. % The semantical analysis
  176. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  177. %% \chapter{The semantical analysis}
  178. \label{ch:semantical_analysis}
  179. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  180. % The code generation
  181. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  182. %% \chapter{The code generation}
  183. \label{ch:code_generation}
  184. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  185. % The assembler writers
  186. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  187. \chapter{The assembler writers}
  188. \label{ch:assembler_writers}
  189. \fpc doesn't generate machine language, it generates
  190. assembler which must be assembled and linked.
  191. The assembler output is configurable, \fpc can create
  192. assembler for the \file{GNU AS}, the \file{NASM} (Netwide assembler) and
  193. the assemblers of Borland and Microsoft. The default assembler
  194. is the \file{GNU AS}, because it is fast and and available on
  195. many platforms. Why don't we use the \file{NASM}? It is 2-4 times
  196. slower than the \file{GNU AS} and it is created for
  197. hand-written assembler, while the \file{GNU AS} is designed
  198. as back end for a compiler.
  199. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  200. % Miscalleanous
  201. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  202. %% \chapter{Miscalleanous}
  203. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  204. % The register allocation
  205. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  206. \chapter{The register allocation}
  207. The register allocation is very hairy, so it gets
  208. an own chapter in this manual. Please be careful when changing things
  209. regarding the register allocation and test such changes intensive.
  210. Future versions will may implement another kind of register allocation
  211. to make this part of the compiler more robust, see
  212. \ref{se:future_plans}. But the current
  213. system is less or more working and changing it would be a lot of
  214. work, so we have to live with it.
  215. The current register allocation mechanism was implemented 5 years
  216. ago and I didn't think that the compiler would become
  217. so popular, so not much time was spent in the design of it.
  218. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  219. % Basics
  220. \section{Basics}
  221. The register allocation is done in the first and the second pass of
  222. the compiler.
  223. The first pass of a node has to calculate how much registers
  224. are necessary to generate code for the node, but it also has
  225. to take care of child nodes i.e. how much registers
  226. they need.
  227. The register allocation is done via \var{getregister\*}
  228. %(where * is \var{32} or \var{mmx}).
  229. Registers can be released via \var{ungetregister\*}. All registers
  230. of a reference (i.e. base and index) can be released by
  231. \var{del\_reference}. These procedures take care of the register type,
  232. i.e. stack/base registers and registers allocated by register
  233. variables aren't added to the set of unused registers.
  234. If there is a problem in the register allocation an \var{internalerror(10)}
  235. occurs.
  236. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  237. % A simple example
  238. \section{A simple example}
  239. \subsection{The first pass}
  240. This is a part of the first pass for a pointer dereferencation
  241. (\var{p\^\ }), the type determination and some other stuff are left out.
  242. \begin{verbatim}
  243. procedure firstderef(var p : ptree);
  244. begin
  245. // .....
  246. // first pass of the child node
  247. firstpass(p^.left);
  248. // .....
  249. // to dereference a pointer we need one one register
  250. // but if the child node needs more registers, we
  251. // have to pass this to our parent node
  252. p^.registers32:=max(p^.left^.registers32,1);
  253. // a pointer dereferencation doesn't need
  254. // fpu or mmx registers
  255. p^.registersfpu:=p^.left^.registersfpu;
  256. p^.registersmmx:=p^.left^.registersmmx;
  257. // .....
  258. end;
  259. \end{verbatim}
  260. \subsection{The second pass}
  261. The following code contains the complete second pass for
  262. a pointer dereferencing node as it is used by current
  263. compiler versions:
  264. \begin{verbatim}
  265. procedure secondderef(var p : ptree);
  266. var
  267. hr : tregister;
  268. begin
  269. // second pass of the child node, this generates also
  270. // the code of the child node
  271. secondpass(p^.left);
  272. // setup the reference (this sets all values to nil, zero or
  273. // R_NO)
  274. clear_reference(p^.location.reference);
  275. // now we have to distinguish the different locations where
  276. // the child node could be stored
  277. case p^.left^.location.loc of
  278. LOC_REGISTER:
  279. // LOC_REGISTER allows us to use simply the
  280. // result register of the left node
  281. p^.location.reference.base:=p^.left^.location.register;
  282. LOC_CREGISTER:
  283. begin
  284. // we shouldn't destroy the result register of the
  285. // result node, because it is a register variable
  286. // so we allocate a register
  287. hr:=getregister32;
  288. // generate the loading instruction
  289. emit_reg_reg(A_MOV,S_L,p^.left^.location.register,hr);
  290. // setup the result location of the current node
  291. p^.location.reference.base:=hr;
  292. end;
  293. LOC_MEM,LOC_REFERENCE:
  294. begin
  295. // first, we have to release the registers of
  296. // the reference, before we can allocate
  297. // register, del_reference release only the
  298. // registers used by the reference,
  299. // the contents of the registers isn't destroyed
  300. del_reference(p^.left^.location.reference);
  301. // now there should be at least one register free, so
  302. // we can allocate one for the base of the result
  303. hr:=getregister32;
  304. // generate dereferencing instruction
  305. exprasmlist^.concat(new(pai386,op_ref_reg(
  306. A_MOV,S_L,newreference(p^.left^.location.reference),
  307. hr)));
  308. // setup the location of the new created reference
  309. p^.location.reference.base:=hr;
  310. end;
  311. end;
  312. end;
  313. \end{verbatim}
  314. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  315. % Binary nodes
  316. \section{Binary nodes}
  317. The whole thing becomes a little bit more hairy if you have to
  318. generate code for a binary+ node (a node with two or more
  319. childs). If a node calls second pass for a child node,
  320. it has to ensure that enough registers are free
  321. to evaluate the child node (\var{usableregs>=childnode\^.registers32}).
  322. If this condition isn't met, the current node has
  323. to store and restore all registers which the node owns to
  324. release registers. This should be done using the
  325. procedures \var{maybe\_push} and \var{restore}. If still
  326. \var{usableregs<childnode\^.registers32}, the child nodes have to solve
  327. the problem. The point is: if \var{usableregs<childnode\^.registers32},
  328. the current node has to release all registers which it owns
  329. before the second pass is called. An example for generating
  330. code of a binary node is \var{cg386add.secondadd}.
  331. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  332. % FPU registers
  333. \section{FPU registers}
  334. The number of required FPU registers also has to be calculated, but
  335. there's one difference: you don't have to save registers. If not
  336. enough FPU registers are free, an error message is generated, as the user
  337. has to take care of this situation since this is a consequence
  338. of the stack structure of the FPU.
  339. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  340. % Testing register allocation
  341. \section{Testing register allocation}
  342. To test new stuff, you should compile a procedure which contains some local
  343. longint variables with \file{-Or}, to limit the number of
  344. registers:
  345. \begin{verbatim}
  346. procedure test;
  347. var
  348. l,i,j,k : longint;
  349. begin
  350. l:=i; // this forces the compiler to assign as much as
  351. j:=k; // possible variables to registers
  352. // here you should insert your code
  353. end;
  354. \end{verbatim}
  355. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  356. % Future plans
  357. \section{Future plans}
  358. \label{se:future_plans}
  359. \appendix
  360. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  361. % Coding style guide
  362. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  363. \chapter{Coding style guide}
  364. This chapter describes what you should consider if you modify the
  365. compiler sources.
  366. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  367. % The formatting of the source
  368. \section{The formatting of the sources}
  369. Rules how to format the sources.
  370. \begin{itemize}
  371. \item All compiler files should be saved in UNIX format i.e. only
  372. a line feed (\#10), no carrige return (\#13).
  373. \item Don't use tabs
  374. \end{itemize}
  375. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  376. % Some hints how to write the code
  377. \section{Some hints how to write the code}
  378. \begin{itemize}
  379. \item Assigned should be used instead of checking for nil directly, as
  380. it can help solving pointer problems when in real mode.
  381. \end{itemize}
  382. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  383. % Compiler Defines
  384. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  385. \chapter{Compiler Defines}
  386. The compiler can be configured using command line defines, the
  387. basic set is decribed here, switches which change rapidly or
  388. which are only used temporarly are described in the header
  389. of \file{PP.PAS}.
  390. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  391. % Target Processor
  392. \section{Target processor}
  393. The target processor must be set always and it can be:
  394. \begin{description}
  395. \item [\var{I386}] for Intel 32 bit processors of the i386 class
  396. \item [\var{M68K}] for Motorola processors of the 68000 class
  397. \end{description}
  398. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  399. % Include compiler Parts
  400. \section{Include compiler Parts}
  401. \subsection{General}
  402. \begin{description}
  403. \item[\var{GDB}] include GDB stab debugging (\file{-g}) support
  404. \item[\var{UseBrowser}] include Browser (\file{-b}) support
  405. \end{description}
  406. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  407. % Leave Out specific Parts
  408. \section{Leave Out specific Parts}
  409. Leaving out parts of the compiler can be useful if you want to create
  410. a compiler which should also run on systems with less memory
  411. requirements (for example a real mode version compiled with Turbo Pascal).
  412. \subsection{General}
  413. \begin{description}
  414. \item[\var{NoOpt}] will leave out the optimizer
  415. \end{description}
  416. \subsection{I386 specific}
  417. The following defines apply only to the i386 version of the compiler.
  418. \begin{description}
  419. \item[\var{NoAg386Int}] No Intel styled assembler (for MASM/TASM) writer
  420. \item[\var{NoAg386Nsm}] No NASM assembler writer
  421. \item[\var{NoAg386Att}] No AT\&T assembler (for the GNU AS) writer
  422. \item[\var{NoRA386Int}] No Intel assembler parser
  423. \item[\var{NoRA386Dir}] No direct assembler parser
  424. \item[\var{NoRA386Att}] No AT\&T assembler parser
  425. \end{description}
  426. \subsection{M68k specific}
  427. The following defines apply only to the M68k version of the compiler.
  428. \begin{description}
  429. \item[\var{NoAg68kGas}] No gas asm writer
  430. \item[\var{NoAg68kMit}] No mit asm writer
  431. \item[\var{NoAg68kMot}] No mot asm writer
  432. \item[\var{NoRA68kMot}] No Motorola assembler parser
  433. \end{description}
  434. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  435. % Location of the code generator functions
  436. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  437. \chapter{Location of the code generator functions}
  438. This appendix describes where to find the functions of
  439. the code generator. The file names are given for the
  440. i386, for the m68k rename the 386 to 68k
  441. \begin{description}
  442. \item[\file{cg386con}] Constant generation
  443. \begin{description}
  444. \item[\var{secondordconst}]
  445. \item[\var{secondrealconst}]
  446. \item[\var{secondstringconst}]
  447. \item[\var{secondfixconst}]
  448. \item[\var{secondsetconst}]
  449. \item[\var{secondniln}]
  450. \end{description}
  451. \item[\file{cg386mat}] Mathematic functions
  452. \begin{description}
  453. \item[\var{secondmoddiv}]
  454. \item[\var{secondshlshr}]
  455. \item[\var{secondumminus}]
  456. \item[\var{secondnot}]
  457. \end{description}
  458. \item[\file{cg386cnv}] Type conversion functions
  459. \begin{description}
  460. \item[\var{secondtypeconv}]
  461. \item[\var{secondis}]
  462. \item[\var{secondas}]
  463. \end{description}
  464. \item[\file{cg386add}] Add/concat functions
  465. \begin{description}
  466. \item[\var{secondadd}]
  467. \end{description}
  468. \item[\file{cg386mem}] Memory functions
  469. \begin{description}
  470. \item[\var{secondvecn}]
  471. \item[\var{secondaddr}]
  472. \item[\var{seconddoubleaddr}]
  473. \item[\var{secondsimplenewdispose}]
  474. \item[\var{secondhnewn}]
  475. \item[\var{secondhdisposen}]
  476. \item[\var{secondselfn}]
  477. \item[\var{secondwith}]
  478. \item[\var{secondloadvmt}]
  479. \item[\var{secondsubscriptn}]
  480. \item[\var{secondderef}]
  481. \end{description}
  482. \item[\file{cg386flw}] Flow functions
  483. \begin{description}
  484. \item[\var{secondifn}]
  485. \item[\var{second\_while\_repeatn}]
  486. \item[\var{secondfor}]
  487. \item[\var{secondcontinuen}]
  488. \item[\var{secondbreakn}]
  489. \item[\var{secondexitn}]
  490. \item[\var{secondlabel}]
  491. \item[\var{secondgoto}]
  492. \item[\var{secondtryfinally}]
  493. \item[\var{secondtryexcept}]
  494. \item[\var{secondraise}]
  495. \item[\var{secondfail}]
  496. \end{description}
  497. \item[\file{cg386ld}] Load/Store functions
  498. \begin{description}
  499. \item[\var{secondload}]
  500. \item[\var{secondassignment}]
  501. \item[\var{secondfuncret}]
  502. \end{description}
  503. \item[\file{cg386set}] Set functions
  504. \begin{description}
  505. \item[\var{secondcase}]
  506. \item[\var{secondin}]
  507. \end{description}
  508. \item[\file{cg386cal}] Call/inline functions
  509. \begin{description}
  510. \item[\var{secondparacall}]
  511. \item[\var{secondcall}]
  512. \item[\var{secondprocinline}]
  513. \item[\var{secondinline}]
  514. \end{description}
  515. \item[\file{cgi386}] Main secondpass handling
  516. \begin{description}
  517. \item[\var{secondnothing}]
  518. \item[\var{seconderror}]
  519. \item[\var{secondasm}]
  520. \item[\var{secondblockn}]
  521. \item[\var{secondstatement}]
  522. \end{description}
  523. \end{description}
  524. \end{document}