internal.tex 20 KB

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