internal.tex 20 KB

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