raatt.pas 46 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473
  1. {
  2. $Id$
  3. Copyright (c) 1998-2002 by Carl Eric Codere and Peter Vreman
  4. Does the parsing for the GAS styled inline assembler.
  5. This program is free software; you can redistribute it and/or modify
  6. it under the terms of the GNU General Public License as published by
  7. the Free Software Foundation; either version 2 of the License, or
  8. (at your option) any later version.
  9. This program is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. GNU General Public License for more details.
  13. You should have received a copy of the GNU General Public License
  14. along with this program; if not, write to the Free Software
  15. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  16. ****************************************************************************
  17. }
  18. unit raatt;
  19. {$i fpcdefs.inc}
  20. interface
  21. uses
  22. { common }
  23. cutils,cclasses,
  24. { global }
  25. globtype,
  26. { aasm }
  27. cpubase,cpuinfo,aasmbase,aasmtai,aasmcpu,
  28. { assembler reader }
  29. rabase,
  30. rasm,
  31. rautils,
  32. { symtable }
  33. symconst,
  34. { cg }
  35. cgbase,node;
  36. type
  37. tasmtoken = (
  38. AS_NONE,AS_LABEL,AS_LLABEL,AS_STRING,AS_INTNUM,
  39. AS_REALNUM,AS_COMMA,AS_LPAREN,
  40. AS_RPAREN,AS_COLON,AS_DOT,AS_PLUS,AS_MINUS,AS_STAR,
  41. AS_SEPARATOR,AS_ID,AS_REGISTER,AS_OPCODE,AS_SLASH,AS_DOLLAR,AS_HASH,AS_LSBRACKET,AS_RSBRACKET,
  42. {------------------ Assembler directives --------------------}
  43. AS_DB,AS_DW,AS_DD,AS_DQ,AS_GLOBAL,
  44. AS_ALIGN,AS_BALIGN,AS_P2ALIGN,AS_ASCII,
  45. AS_ASCIIZ,AS_LCOMM,AS_COMM,AS_SINGLE,AS_DOUBLE,AS_EXTENDED,
  46. AS_DATA,AS_TEXT,AS_END,
  47. {------------------ Assembler Operators --------------------}
  48. AS_TYPE,AS_MOD,AS_SHL,AS_SHR,AS_NOT,AS_AND,AS_OR,AS_XOR,AS_NOR,AS_AT);
  49. tasmkeyword = string[10];
  50. const
  51. { These tokens should be modified accordingly to the modifications }
  52. { in the different enumerations. }
  53. firstdirective = AS_DB;
  54. lastdirective = AS_END;
  55. token2str : array[tasmtoken] of tasmkeyword=(
  56. '','Label','LLabel','string','integer',
  57. 'float',',','(',
  58. ')',':','.','+','-','*',
  59. ';','identifier','register','opcode','/','$','#','{','}',
  60. '.byte','.word','.long','.quad','.globl',
  61. '.align','.balign','.p2align','.ascii',
  62. '.asciz','.lcomm','.comm','.single','.double','.tfloat',
  63. '.data','.text','END',
  64. 'TYPE','%','<<','>>','!','&','|','^','~','@');
  65. type
  66. tattreader = class(tasmreader)
  67. actasmtoken : tasmtoken;
  68. prevasmtoken : tasmtoken;
  69. procedure SetupTables;
  70. procedure BuildConstant(maxvalue: longint);
  71. procedure BuildConstantOperand(oper : toperand);
  72. procedure BuildRealConstant(typ : tfloattype);
  73. procedure BuildStringConstant(asciiz: boolean);
  74. procedure BuildRecordOffsetSize(const expr: string;var offset:longint;var size:longint);
  75. procedure BuildConstSymbolExpression(allowref,betweenbracket,needofs:boolean;var value:longint;var asmsym:string);
  76. function BuildConstExpression(allowref,betweenbracket:boolean): longint;
  77. function Assemble: tlinkedlist;override;
  78. procedure handleopcode;virtual;abstract;
  79. function is_asmopcode(const s: string) : boolean;virtual;abstract;
  80. Function is_asmdirective(const s: string):boolean;
  81. function is_register(const s:string):boolean;virtual;
  82. function is_locallabel(const s: string):boolean;
  83. procedure GetToken;
  84. function consume(t : tasmtoken):boolean;
  85. procedure RecoverConsume(allowcomma:boolean);
  86. procedure handlepercent;virtual;
  87. end;
  88. tcattreader = class of tattreader;
  89. var
  90. cattreader : tcattreader;
  91. implementation
  92. uses
  93. { globals }
  94. verbose,systems,
  95. { input }
  96. scanner,
  97. { symtable }
  98. symbase,symtype,symsym,symtable,
  99. {$ifdef x86}
  100. rax86,
  101. {$endif x86}
  102. itcpugas;
  103. procedure tattreader.SetupTables;
  104. { creates uppercased symbol tables for speed access }
  105. var
  106. i : tasmop;
  107. str2opentry: tstr2opentry;
  108. Begin
  109. { opcodes }
  110. iasmops:=TDictionary.Create;
  111. iasmops.delete_doubles:=true;
  112. for i:=firstop to lastop do
  113. begin
  114. str2opentry:=tstr2opentry.createname(upper(gas_op2str[i]));
  115. str2opentry.op:=i;
  116. iasmops.insert(str2opentry);
  117. end;
  118. end;
  119. function tattreader.is_asmdirective(const s: string):boolean;
  120. var
  121. i : tasmtoken;
  122. hs : string;
  123. Begin
  124. { GNU as is also not casesensitive with this }
  125. hs:=lower(s);
  126. for i:=firstdirective to lastdirective do
  127. if hs=token2str[i] then
  128. begin
  129. actasmtoken:=i;
  130. is_asmdirective:=true;
  131. exit;
  132. end;
  133. is_asmdirective:=false;
  134. end;
  135. function tattreader.is_register(const s:string):boolean;
  136. begin
  137. is_register:=false;
  138. actasmregister:=gas_regnum_search(lower(s));
  139. if actasmregister<>NR_NO then
  140. begin
  141. is_register:=true;
  142. actasmtoken:=AS_REGISTER;
  143. end;
  144. end;
  145. function tattreader.is_locallabel(const s: string):boolean;
  146. begin
  147. is_locallabel:=(length(s)>=2) and (s[1]='.') and (s[2]='L');
  148. end;
  149. procedure tattreader.handlepercent;
  150. begin
  151. actasmtoken:=AS_MOD;
  152. end;
  153. procedure tattreader.GetToken;
  154. var
  155. len : longint;
  156. srsym : tsym;
  157. srsymtable : tsymtable;
  158. begin
  159. { save old token and reset new token }
  160. prevasmtoken:=actasmtoken;
  161. actasmtoken:=AS_NONE;
  162. { reset }
  163. actasmpattern:='';
  164. { while space and tab , continue scan... }
  165. while c in [' ',#9] do
  166. c:=current_scanner.asmgetchar;
  167. { get token pos }
  168. {$ifdef arm}
  169. if not (c in [#10,#13,';']) then
  170. current_scanner.gettokenpos;
  171. {$else arm}
  172. if not (c in [#10,#13,'{',';']) then
  173. current_scanner.gettokenpos;
  174. {$endif arm}
  175. { Local Label, Label, Directive, Prefix or Opcode }
  176. {$ifdef arm}
  177. if firsttoken and not(c in [#10,#13,';']) then
  178. {$else arm}
  179. if firsttoken and not(c in [#10,#13,'{',';']) then
  180. {$endif arm}
  181. begin
  182. firsttoken:=FALSE;
  183. len:=0;
  184. { directive or local label }
  185. if c = '.' then
  186. begin
  187. inc(len);
  188. actasmpattern[len]:=c;
  189. { Let us point to the next character }
  190. c:=current_scanner.asmgetchar;
  191. while c in ['A'..'Z','a'..'z','0'..'9','_','$'] do
  192. begin
  193. inc(len);
  194. actasmpattern[len]:=c;
  195. c:=current_scanner.asmgetchar;
  196. end;
  197. actasmpattern[0]:=chr(len);
  198. { this is a local label... }
  199. if (c=':') and is_locallabel(actasmpattern) then
  200. Begin
  201. { local variables are case sensitive }
  202. actasmtoken:=AS_LLABEL;
  203. c:=current_scanner.asmgetchar;
  204. firsttoken:=true;
  205. exit;
  206. end
  207. { must be a directive }
  208. else
  209. Begin
  210. { directives are case sensitive!! }
  211. if is_asmdirective(actasmpattern) then
  212. exit;
  213. Message1(asmr_e_not_directive_or_local_symbol,actasmpattern);
  214. end;
  215. end;
  216. { only opcodes and global labels are allowed now. }
  217. while c in ['A'..'Z','a'..'z','0'..'9','_'] do
  218. begin
  219. inc(len);
  220. actasmpattern[len]:=c;
  221. c:=current_scanner.asmgetchar;
  222. end;
  223. actasmpattern[0]:=chr(len);
  224. { Label ? }
  225. if c = ':' then
  226. begin
  227. actasmtoken:=AS_LABEL;
  228. { let us point to the next character }
  229. c:=current_scanner.asmgetchar;
  230. firsttoken:=true;
  231. exit;
  232. end;
  233. {$ifdef POWERPC}
  234. { some PowerPC instructions can have the postfix -, + or .
  235. this code could be moved to is_asmopcode but I think
  236. it's better to ifdef it here (FK)
  237. }
  238. case c of
  239. '.', '-', '+':
  240. begin
  241. actasmpattern:=actasmpattern+c;
  242. c:=current_scanner.asmgetchar;
  243. end
  244. end;
  245. {$endif POWERPC}
  246. { Opcode ? }
  247. If is_asmopcode(upper(actasmpattern)) then
  248. Begin
  249. uppervar(actasmpattern);
  250. exit;
  251. end;
  252. { End of assemblerblock ? }
  253. if upper(actasmpattern) = 'END' then
  254. begin
  255. actasmtoken:=AS_END;
  256. exit;
  257. end;
  258. message1(asmr_e_unknown_opcode,actasmpattern);
  259. actasmtoken:=AS_NONE;
  260. end
  261. else { else firsttoken }
  262. { Here we must handle all possible cases }
  263. begin
  264. case c of
  265. '.' : { possiblities : - local label reference , such as in jmp @local1 }
  266. { - field of object/record }
  267. { - directive. }
  268. begin
  269. if (prevasmtoken in [AS_ID,AS_RPAREN]) then
  270. begin
  271. c:=current_scanner.asmgetchar;
  272. actasmtoken:=AS_DOT;
  273. exit;
  274. end;
  275. actasmpattern:=c;
  276. c:=current_scanner.asmgetchar;
  277. while c in ['A'..'Z','a'..'z','0'..'9','_','$'] do
  278. begin
  279. actasmpattern:=actasmpattern + c;
  280. c:=current_scanner.asmgetchar;
  281. end;
  282. if is_asmdirective(actasmpattern) then
  283. exit;
  284. { local label references and directives }
  285. { are case sensitive }
  286. actasmtoken:=AS_ID;
  287. exit;
  288. end;
  289. { identifier, register, prefix or directive }
  290. '_','A'..'Z','a'..'z':
  291. begin
  292. len:=0;
  293. while c in ['A'..'Z','a'..'z','0'..'9','_','$'] do
  294. begin
  295. inc(len);
  296. actasmpattern[len]:=c;
  297. c:=current_scanner.asmgetchar;
  298. end;
  299. actasmpattern[0]:=chr(len);
  300. uppervar(actasmpattern);
  301. {$ifdef x86}
  302. { only x86 architectures have instruction prefixes }
  303. { Opcode, can only be when the previous was a prefix }
  304. If is_prefix(actopcode) and is_asmopcode(actasmpattern) then
  305. Begin
  306. uppervar(actasmpattern);
  307. exit;
  308. end;
  309. {$endif x86}
  310. { check for end which is a reserved word unlike the opcodes }
  311. if actasmpattern = 'END' then
  312. Begin
  313. actasmtoken:=AS_END;
  314. exit;
  315. end;
  316. if actasmpattern = 'TYPE' then
  317. Begin
  318. actasmtoken:=AS_TYPE;
  319. exit;
  320. end;
  321. if is_register(actasmpattern) then
  322. begin
  323. actasmtoken:=AS_REGISTER;
  324. exit;
  325. end;
  326. { if next is a '.' and this is a unitsym then we also need to
  327. parse the identifier }
  328. if (c='.') then
  329. begin
  330. searchsym(actasmpattern,srsym,srsymtable);
  331. if assigned(srsym) and
  332. (srsym.typ=unitsym) and
  333. (srsym.owner.unitid=0) then
  334. begin
  335. actasmpattern:=actasmpattern+c;
  336. c:=current_scanner.asmgetchar;
  337. while c in ['A'..'Z','a'..'z','0'..'9','_','$'] do
  338. begin
  339. actasmpattern:=actasmpattern + upcase(c);
  340. c:=current_scanner.asmgetchar;
  341. end;
  342. end;
  343. end;
  344. actasmtoken:=AS_ID;
  345. exit;
  346. end;
  347. '%' : { register or modulo }
  348. handlepercent;
  349. '1'..'9': { integer number }
  350. begin
  351. len:=0;
  352. while c in ['0'..'9'] do
  353. Begin
  354. inc(len);
  355. actasmpattern[len]:=c;
  356. c:=current_scanner.asmgetchar;
  357. end;
  358. actasmpattern[0]:=chr(len);
  359. actasmpattern:=tostr(ValDecimal(actasmpattern));
  360. actasmtoken:=AS_INTNUM;
  361. exit;
  362. end;
  363. '0' : { octal,hexa,real or binary number. }
  364. begin
  365. actasmpattern:=c;
  366. c:=current_scanner.asmgetchar;
  367. case upcase(c) of
  368. 'B': { binary }
  369. Begin
  370. c:=current_scanner.asmgetchar;
  371. while c in ['0','1'] do
  372. Begin
  373. actasmpattern:=actasmpattern + c;
  374. c:=current_scanner.asmgetchar;
  375. end;
  376. actasmpattern:=tostr(ValBinary(actasmpattern));
  377. actasmtoken:=AS_INTNUM;
  378. exit;
  379. end;
  380. 'D': { real }
  381. Begin
  382. c:=current_scanner.asmgetchar;
  383. { get ridd of the 0d }
  384. if (c in ['+','-']) then
  385. begin
  386. actasmpattern:=c;
  387. c:=current_scanner.asmgetchar;
  388. end
  389. else
  390. actasmpattern:='';
  391. while c in ['0'..'9'] do
  392. Begin
  393. actasmpattern:=actasmpattern + c;
  394. c:=current_scanner.asmgetchar;
  395. end;
  396. if c='.' then
  397. begin
  398. actasmpattern:=actasmpattern + c;
  399. c:=current_scanner.asmgetchar;
  400. while c in ['0'..'9'] do
  401. Begin
  402. actasmpattern:=actasmpattern + c;
  403. c:=current_scanner.asmgetchar;
  404. end;
  405. if upcase(c) = 'E' then
  406. begin
  407. actasmpattern:=actasmpattern + c;
  408. c:=current_scanner.asmgetchar;
  409. if (c in ['+','-']) then
  410. begin
  411. actasmpattern:=actasmpattern + c;
  412. c:=current_scanner.asmgetchar;
  413. end;
  414. while c in ['0'..'9'] do
  415. Begin
  416. actasmpattern:=actasmpattern + c;
  417. c:=current_scanner.asmgetchar;
  418. end;
  419. end;
  420. actasmtoken:=AS_REALNUM;
  421. exit;
  422. end
  423. else
  424. begin
  425. Message1(asmr_e_invalid_float_const,actasmpattern+c);
  426. actasmtoken:=AS_NONE;
  427. end;
  428. end;
  429. 'X': { hexadecimal }
  430. Begin
  431. c:=current_scanner.asmgetchar;
  432. while c in ['0'..'9','a'..'f','A'..'F'] do
  433. Begin
  434. actasmpattern:=actasmpattern + c;
  435. c:=current_scanner.asmgetchar;
  436. end;
  437. actasmpattern:=tostr(ValHexaDecimal(actasmpattern));
  438. actasmtoken:=AS_INTNUM;
  439. exit;
  440. end;
  441. '1'..'7': { octal }
  442. begin
  443. actasmpattern:=actasmpattern + c;
  444. while c in ['0'..'7'] do
  445. Begin
  446. actasmpattern:=actasmpattern + c;
  447. c:=current_scanner.asmgetchar;
  448. end;
  449. actasmpattern:=tostr(ValOctal(actasmpattern));
  450. actasmtoken:=AS_INTNUM;
  451. exit;
  452. end;
  453. else { octal number zero value...}
  454. Begin
  455. actasmpattern:=tostr(ValOctal(actasmpattern));
  456. actasmtoken:=AS_INTNUM;
  457. exit;
  458. end;
  459. end; { end case }
  460. end;
  461. '&' :
  462. begin
  463. c:=current_scanner.asmgetchar;
  464. actasmtoken:=AS_AND;
  465. end;
  466. '''' : { char }
  467. begin
  468. current_scanner.in_asm_string:=true;
  469. actasmpattern:='';
  470. repeat
  471. c:=current_scanner.asmgetchar;
  472. case c of
  473. '\' :
  474. begin
  475. { copy also the next char so \" is parsed correctly }
  476. actasmpattern:=actasmpattern+c;
  477. c:=current_scanner.asmgetchar;
  478. actasmpattern:=actasmpattern+c;
  479. end;
  480. '''' :
  481. begin
  482. c:=current_scanner.asmgetchar;
  483. break;
  484. end;
  485. #10,#13:
  486. Message(scan_f_string_exceeds_line);
  487. else
  488. actasmpattern:=actasmpattern+c;
  489. end;
  490. until false;
  491. actasmpattern:=EscapeToPascal(actasmpattern);
  492. actasmtoken:=AS_STRING;
  493. current_scanner.in_asm_string:=false;
  494. exit;
  495. end;
  496. '"' : { string }
  497. begin
  498. current_scanner.in_asm_string:=true;
  499. actasmpattern:='';
  500. repeat
  501. c:=current_scanner.asmgetchar;
  502. case c of
  503. '\' :
  504. begin
  505. { copy also the next char so \" is parsed correctly }
  506. actasmpattern:=actasmpattern+c;
  507. c:=current_scanner.asmgetchar;
  508. actasmpattern:=actasmpattern+c;
  509. end;
  510. '"' :
  511. begin
  512. c:=current_scanner.asmgetchar;
  513. break;
  514. end;
  515. #10,#13:
  516. Message(scan_f_string_exceeds_line);
  517. else
  518. actasmpattern:=actasmpattern+c;
  519. end;
  520. until false;
  521. actasmpattern:=EscapeToPascal(actasmpattern);
  522. actasmtoken:=AS_STRING;
  523. current_scanner.in_asm_string:=false;
  524. exit;
  525. end;
  526. '$' :
  527. begin
  528. actasmtoken:=AS_DOLLAR;
  529. c:=current_scanner.asmgetchar;
  530. exit;
  531. end;
  532. '#' :
  533. begin
  534. actasmtoken:=AS_HASH;
  535. c:=current_scanner.asmgetchar;
  536. exit;
  537. end;
  538. {$ifdef arm}
  539. // the arm assembler uses { ... } for register sets
  540. '{' :
  541. begin
  542. actasmtoken:=AS_LSBRACKET;
  543. c:=current_scanner.asmgetchar;
  544. exit;
  545. end;
  546. '}' :
  547. begin
  548. actasmtoken:=AS_RSBRACKET;
  549. c:=current_scanner.asmgetchar;
  550. exit;
  551. end;
  552. {$endif arm}
  553. ',' :
  554. begin
  555. actasmtoken:=AS_COMMA;
  556. c:=current_scanner.asmgetchar;
  557. exit;
  558. end;
  559. '<' :
  560. begin
  561. actasmtoken:=AS_SHL;
  562. c:=current_scanner.asmgetchar;
  563. if c = '<' then
  564. c:=current_scanner.asmgetchar;
  565. exit;
  566. end;
  567. '>' :
  568. begin
  569. actasmtoken:=AS_SHL;
  570. c:=current_scanner.asmgetchar;
  571. if c = '>' then
  572. c:=current_scanner.asmgetchar;
  573. exit;
  574. end;
  575. '|' :
  576. begin
  577. actasmtoken:=AS_OR;
  578. c:=current_scanner.asmgetchar;
  579. exit;
  580. end;
  581. '^' :
  582. begin
  583. actasmtoken:=AS_XOR;
  584. c:=current_scanner.asmgetchar;
  585. exit;
  586. end;
  587. '(' :
  588. begin
  589. actasmtoken:=AS_LPAREN;
  590. c:=current_scanner.asmgetchar;
  591. exit;
  592. end;
  593. ')' :
  594. begin
  595. actasmtoken:=AS_RPAREN;
  596. c:=current_scanner.asmgetchar;
  597. exit;
  598. end;
  599. ':' :
  600. begin
  601. actasmtoken:=AS_COLON;
  602. c:=current_scanner.asmgetchar;
  603. exit;
  604. end;
  605. '+' :
  606. begin
  607. actasmtoken:=AS_PLUS;
  608. c:=current_scanner.asmgetchar;
  609. exit;
  610. end;
  611. '-' :
  612. begin
  613. actasmtoken:=AS_MINUS;
  614. c:=current_scanner.asmgetchar;
  615. exit;
  616. end;
  617. '*' :
  618. begin
  619. actasmtoken:=AS_STAR;
  620. c:=current_scanner.asmgetchar;
  621. exit;
  622. end;
  623. '/' :
  624. begin
  625. actasmtoken:=AS_SLASH;
  626. c:=current_scanner.asmgetchar;
  627. exit;
  628. end;
  629. '@' :
  630. begin
  631. actasmtoken:=AS_AT;
  632. c:=current_scanner.asmgetchar;
  633. exit;
  634. end;
  635. {$ifndef arm}
  636. '{',
  637. {$endif arm}
  638. #13,#10,';' :
  639. begin
  640. { the comment is read by asmgetchar }
  641. c:=current_scanner.asmgetchar;
  642. firsttoken:=TRUE;
  643. actasmtoken:=AS_SEPARATOR;
  644. exit;
  645. end;
  646. else
  647. current_scanner.illegal_char(c);
  648. end;
  649. end;
  650. end;
  651. function tattreader.consume(t : tasmtoken):boolean;
  652. begin
  653. Consume:=true;
  654. if t<>actasmtoken then
  655. begin
  656. Message2(scan_f_syn_expected,token2str[t],token2str[actasmtoken]);
  657. Consume:=false;
  658. end;
  659. repeat
  660. gettoken;
  661. until actasmtoken<>AS_NONE;
  662. end;
  663. procedure tattreader.RecoverConsume(allowcomma:boolean);
  664. begin
  665. While not (actasmtoken in [AS_SEPARATOR,AS_END]) do
  666. begin
  667. if allowcomma and (actasmtoken=AS_COMMA) then
  668. break;
  669. Consume(actasmtoken);
  670. end;
  671. end;
  672. Procedure tattreader.BuildConstant(maxvalue: longint);
  673. var
  674. asmsym,
  675. expr: string;
  676. value : longint;
  677. Begin
  678. Repeat
  679. Case actasmtoken of
  680. AS_STRING:
  681. Begin
  682. expr:=actasmpattern;
  683. if length(expr) > 1 then
  684. Message(asmr_e_string_not_allowed_as_const);
  685. Consume(AS_STRING);
  686. Case actasmtoken of
  687. AS_COMMA: Consume(AS_COMMA);
  688. AS_END,
  689. AS_SEPARATOR: ;
  690. else
  691. Message(asmr_e_invalid_string_expression);
  692. end; { end case }
  693. ConcatString(curlist,expr);
  694. end;
  695. AS_INTNUM,
  696. AS_PLUS,
  697. AS_MINUS,
  698. AS_LPAREN,
  699. AS_NOT,
  700. AS_ID :
  701. Begin
  702. BuildConstSymbolExpression(false,false,false,value,asmsym);
  703. if asmsym<>'' then
  704. begin
  705. if maxvalue<>longint($ffffffff) then
  706. Message(asmr_w_32bit_const_for_address);
  707. ConcatConstSymbol(curlist,asmsym,value)
  708. end
  709. else
  710. ConcatConstant(curlist,value,maxvalue);
  711. end;
  712. AS_COMMA:
  713. Consume(AS_COMMA);
  714. AS_END,
  715. AS_SEPARATOR:
  716. break;
  717. else
  718. begin
  719. Message(asmr_e_syn_constant);
  720. RecoverConsume(false);
  721. end
  722. end; { end case }
  723. Until false;
  724. end;
  725. Procedure tattreader.BuildRealConstant(typ : tfloattype);
  726. var
  727. expr : string;
  728. r : bestreal;
  729. code : integer;
  730. negativ : boolean;
  731. errorflag: boolean;
  732. Begin
  733. errorflag:=FALSE;
  734. Repeat
  735. negativ:=false;
  736. expr:='';
  737. if actasmtoken=AS_PLUS then
  738. Consume(AS_PLUS)
  739. else
  740. if actasmtoken=AS_MINUS then
  741. begin
  742. negativ:=true;
  743. consume(AS_MINUS);
  744. end;
  745. Case actasmtoken of
  746. AS_INTNUM:
  747. Begin
  748. expr:=actasmpattern;
  749. Consume(AS_INTNUM);
  750. if negativ then
  751. expr:='-'+expr;
  752. val(expr,r,code);
  753. if code<>0 then
  754. Begin
  755. r:=0;
  756. Message(asmr_e_invalid_float_expr);
  757. End;
  758. ConcatRealConstant(curlist,r,typ);
  759. end;
  760. AS_REALNUM:
  761. Begin
  762. expr:=actasmpattern;
  763. Consume(AS_REALNUM);
  764. { in ATT syntax you have 0d in front of the real }
  765. { should this be forced ? yes i think so, as to }
  766. { conform to gas as much as possible. }
  767. if (expr[1]='0') and (upper(expr[2])='D') then
  768. Delete(expr,1,2);
  769. if negativ then
  770. expr:='-'+expr;
  771. val(expr,r,code);
  772. if code<>0 then
  773. Begin
  774. r:=0;
  775. Message(asmr_e_invalid_float_expr);
  776. End;
  777. ConcatRealConstant(curlist,r,typ);
  778. end;
  779. AS_COMMA:
  780. begin
  781. Consume(AS_COMMA);
  782. end;
  783. AS_END,
  784. AS_SEPARATOR:
  785. begin
  786. break;
  787. end;
  788. else
  789. Begin
  790. Consume(actasmtoken);
  791. if not errorflag then
  792. Message(asmr_e_invalid_float_expr);
  793. errorflag:=TRUE;
  794. end;
  795. end;
  796. Until false;
  797. end;
  798. Procedure tattreader.BuildStringConstant(asciiz: boolean);
  799. var
  800. expr: string;
  801. errorflag : boolean;
  802. Begin
  803. errorflag:=FALSE;
  804. Repeat
  805. Case actasmtoken of
  806. AS_STRING:
  807. Begin
  808. expr:=actasmpattern;
  809. if asciiz then
  810. expr:=expr+#0;
  811. ConcatPasString(curlist,expr);
  812. Consume(AS_STRING);
  813. end;
  814. AS_COMMA:
  815. begin
  816. Consume(AS_COMMA);
  817. end;
  818. AS_END,
  819. AS_SEPARATOR:
  820. begin
  821. break;
  822. end;
  823. else
  824. Begin
  825. Consume(actasmtoken);
  826. if not errorflag then
  827. Message(asmr_e_invalid_string_expression);
  828. errorflag:=TRUE;
  829. end;
  830. end;
  831. Until false;
  832. end;
  833. Function tattreader.Assemble: tlinkedlist;
  834. Var
  835. hl : tasmlabel;
  836. commname : string;
  837. lasTSec : TSection;
  838. l1,l2 : longint;
  839. Begin
  840. Message1(asmr_d_start_reading,'GNU AS');
  841. firsttoken:=TRUE;
  842. { sets up all opcode and register tables in uppercase }
  843. if not _asmsorted then
  844. Begin
  845. SetupTables;
  846. _asmsorted:=TRUE;
  847. end;
  848. curlist:=TAAsmoutput.Create;
  849. lasTSec:=sec_code;
  850. { setup label linked list }
  851. LocalLabelList:=TLocalLabelList.Create;
  852. { start tokenizer }
  853. c:=current_scanner.asmgetcharstart;
  854. gettoken;
  855. { main loop }
  856. repeat
  857. case actasmtoken of
  858. AS_LLABEL:
  859. Begin
  860. if CreateLocalLabel(actasmpattern,hl,true) then
  861. ConcatLabel(curlist,hl);
  862. Consume(AS_LLABEL);
  863. end;
  864. AS_LABEL:
  865. Begin
  866. if SearchLabel(upper(actasmpattern),hl,true) then
  867. ConcatLabel(curlist,hl)
  868. else
  869. Message1(asmr_e_unknown_label_identifier,actasmpattern);
  870. Consume(AS_LABEL);
  871. end;
  872. AS_DW:
  873. Begin
  874. Consume(AS_DW);
  875. BuildConstant($ffff);
  876. end;
  877. AS_DATA:
  878. Begin
  879. curList.Concat(Tai_section.Create(sec_data));
  880. lasTSec:=sec_data;
  881. Consume(AS_DATA);
  882. end;
  883. AS_TEXT:
  884. Begin
  885. curList.Concat(Tai_section.Create(sec_code));
  886. lasTSec:=sec_code;
  887. Consume(AS_TEXT);
  888. end;
  889. AS_DB:
  890. Begin
  891. Consume(AS_DB);
  892. BuildConstant($ff);
  893. end;
  894. AS_DD:
  895. Begin
  896. Consume(AS_DD);
  897. BuildConstant(longint($ffffffff));
  898. end;
  899. AS_DQ:
  900. Begin
  901. Consume(AS_DQ);
  902. BuildRealConstant(s64comp);
  903. end;
  904. AS_SINGLE:
  905. Begin
  906. Consume(AS_SINGLE);
  907. BuildRealConstant(s32real);
  908. end;
  909. AS_DOUBLE:
  910. Begin
  911. Consume(AS_DOUBLE);
  912. BuildRealConstant(s64real);
  913. end;
  914. AS_EXTENDED:
  915. Begin
  916. Consume(AS_EXTENDED);
  917. BuildRealConstant(s80real);
  918. end;
  919. AS_GLOBAL:
  920. Begin
  921. Consume(AS_GLOBAL);
  922. if actasmtoken=AS_ID then
  923. ConcatPublic(curlist,actasmpattern);
  924. Consume(AS_ID);
  925. if actasmtoken<>AS_SEPARATOR then
  926. Consume(AS_SEPARATOR);
  927. end;
  928. AS_ALIGN:
  929. Begin
  930. Consume(AS_ALIGN);
  931. l1:=BuildConstExpression(false,false);
  932. if (target_info.system in [system_i386_GO32V2]) then
  933. begin
  934. l2:=1;
  935. if (l1>=0) and (l1<=16) then
  936. while (l1>0) do
  937. begin
  938. l2:=2*l2;
  939. dec(l1);
  940. end;
  941. l1:=l2;
  942. end;
  943. ConcatAlign(curlist,l1);
  944. Message(asmr_n_align_is_target_specific);
  945. if actasmtoken<>AS_SEPARATOR then
  946. Consume(AS_SEPARATOR);
  947. end;
  948. AS_BALIGN:
  949. Begin
  950. Consume(AS_BALIGN);
  951. ConcatAlign(curlist,BuildConstExpression(false,false));
  952. if actasmtoken<>AS_SEPARATOR then
  953. Consume(AS_SEPARATOR);
  954. end;
  955. AS_P2ALIGN:
  956. Begin
  957. Consume(AS_P2ALIGN);
  958. l1:=BuildConstExpression(false,false);
  959. l2:=1;
  960. if (l1>=0) and (l1<=16) then
  961. while (l1>0) do
  962. begin
  963. l2:=2*l2;
  964. dec(l1);
  965. end;
  966. l1:=l2;
  967. ConcatAlign(curlist,l1);
  968. if actasmtoken<>AS_SEPARATOR then
  969. Consume(AS_SEPARATOR);
  970. end;
  971. AS_ASCIIZ:
  972. Begin
  973. Consume(AS_ASCIIZ);
  974. BuildStringConstant(TRUE);
  975. end;
  976. AS_ASCII:
  977. Begin
  978. Consume(AS_ASCII);
  979. BuildStringConstant(FALSE);
  980. end;
  981. AS_LCOMM:
  982. Begin
  983. Consume(AS_LCOMM);
  984. commname:=actasmpattern;
  985. Consume(AS_ID);
  986. Consume(AS_COMMA);
  987. ConcatLocalBss(commname,BuildConstExpression(false,false));
  988. if actasmtoken<>AS_SEPARATOR then
  989. Consume(AS_SEPARATOR);
  990. end;
  991. AS_COMM:
  992. Begin
  993. Consume(AS_COMM);
  994. commname:=actasmpattern;
  995. Consume(AS_ID);
  996. Consume(AS_COMMA);
  997. ConcatGlobalBss(commname,BuildConstExpression(false,false));
  998. if actasmtoken<>AS_SEPARATOR then
  999. Consume(AS_SEPARATOR);
  1000. end;
  1001. AS_OPCODE:
  1002. Begin
  1003. HandleOpCode;
  1004. end;
  1005. AS_SEPARATOR:
  1006. Begin
  1007. Consume(AS_SEPARATOR);
  1008. end;
  1009. AS_END:
  1010. begin
  1011. break; { end assembly block }
  1012. end;
  1013. else
  1014. Begin
  1015. Message(asmr_e_syntax_error);
  1016. RecoverConsume(false);
  1017. end;
  1018. end;
  1019. until false;
  1020. { Check LocalLabelList }
  1021. LocalLabelList.CheckEmitted;
  1022. LocalLabelList.Free;
  1023. { are we back in the code section? }
  1024. if lasTSec<>sec_code then
  1025. begin
  1026. Message(asmr_w_assembler_code_not_returned_to_text);
  1027. curList.Concat(Tai_section.Create(sec_code));
  1028. end;
  1029. { Return the list in an asmnode }
  1030. assemble:=curlist;
  1031. Message1(asmr_d_finish_reading,'GNU AS');
  1032. end;
  1033. {*****************************************************************************
  1034. Parsing Helpers
  1035. *****************************************************************************}
  1036. Procedure tattreader.BuildRecordOffsetSize(const expr: string;var offset:longint;var size:longint);
  1037. { Description: This routine builds up a record offset after a AS_DOT }
  1038. { token is encountered. }
  1039. { On entry actasmtoken should be equal to AS_DOT }
  1040. var
  1041. s : string;
  1042. Begin
  1043. offset:=0;
  1044. size:=0;
  1045. s:=expr;
  1046. while (actasmtoken=AS_DOT) do
  1047. begin
  1048. Consume(AS_DOT);
  1049. if actasmtoken=AS_ID then
  1050. s:=s+'.'+actasmpattern;
  1051. if not Consume(AS_ID) then
  1052. begin
  1053. RecoverConsume(true);
  1054. break;
  1055. end;
  1056. end;
  1057. if not GetRecordOffsetSize(s,offset,size) then
  1058. Message(asmr_e_building_record_offset);
  1059. end;
  1060. procedure tattreader.BuildConstSymbolExpression(allowref,betweenbracket,needofs:boolean;var value:longint;var asmsym:string);
  1061. var
  1062. hs,tempstr,expr : string;
  1063. parenlevel,l,k : longint;
  1064. errorflag : boolean;
  1065. prevtok : tasmtoken;
  1066. sym : tsym;
  1067. srsymtable : tsymtable;
  1068. hl : tasmlabel;
  1069. Begin
  1070. asmsym:='';
  1071. value:=0;
  1072. errorflag:=FALSE;
  1073. tempstr:='';
  1074. expr:='';
  1075. parenlevel:=0;
  1076. Repeat
  1077. Case actasmtoken of
  1078. AS_LPAREN:
  1079. Begin
  1080. { Exit if ref? }
  1081. if allowref and (prevasmtoken in [AS_INTNUM,AS_ID]) then
  1082. break;
  1083. Consume(AS_LPAREN);
  1084. expr:=expr + '(';
  1085. inc(parenlevel);
  1086. end;
  1087. AS_RPAREN:
  1088. Begin
  1089. { end of ref ? }
  1090. if (parenlevel=0) and betweenbracket then
  1091. break;
  1092. Consume(AS_RPAREN);
  1093. expr:=expr + ')';
  1094. dec(parenlevel);
  1095. end;
  1096. AS_SHL:
  1097. Begin
  1098. Consume(AS_SHL);
  1099. expr:=expr + '<';
  1100. end;
  1101. AS_SHR:
  1102. Begin
  1103. Consume(AS_SHR);
  1104. expr:=expr + '>';
  1105. end;
  1106. AS_SLASH:
  1107. Begin
  1108. Consume(AS_SLASH);
  1109. expr:=expr + '/';
  1110. end;
  1111. AS_MOD:
  1112. Begin
  1113. Consume(AS_MOD);
  1114. expr:=expr + '%';
  1115. end;
  1116. AS_STAR:
  1117. Begin
  1118. Consume(AS_STAR);
  1119. expr:=expr + '*';
  1120. end;
  1121. AS_PLUS:
  1122. Begin
  1123. Consume(AS_PLUS);
  1124. expr:=expr + '+';
  1125. end;
  1126. AS_MINUS:
  1127. Begin
  1128. Consume(AS_MINUS);
  1129. expr:=expr + '-';
  1130. end;
  1131. AS_AND:
  1132. Begin
  1133. Consume(AS_AND);
  1134. expr:=expr + '&';
  1135. end;
  1136. AS_NOT:
  1137. Begin
  1138. Consume(AS_NOT);
  1139. expr:=expr + '~';
  1140. end;
  1141. AS_XOR:
  1142. Begin
  1143. Consume(AS_XOR);
  1144. expr:=expr + '^';
  1145. end;
  1146. AS_OR:
  1147. Begin
  1148. Consume(AS_OR);
  1149. expr:=expr + '|';
  1150. end;
  1151. AS_INTNUM:
  1152. Begin
  1153. expr:=expr + actasmpattern;
  1154. Consume(AS_INTNUM);
  1155. end;
  1156. AS_DOLLAR:
  1157. begin
  1158. Consume(AS_DOLLAR);
  1159. if actasmtoken<>AS_ID then
  1160. Message(asmr_e_dollar_without_identifier);
  1161. end;
  1162. AS_STRING:
  1163. Begin
  1164. l:=0;
  1165. case Length(actasmpattern) of
  1166. 1 :
  1167. l:=ord(actasmpattern[1]);
  1168. 2 :
  1169. l:=ord(actasmpattern[2]) + ord(actasmpattern[1]) shl 8;
  1170. 3 :
  1171. l:=ord(actasmpattern[3]) +
  1172. Ord(actasmpattern[2]) shl 8 + ord(actasmpattern[1]) shl 16;
  1173. 4 :
  1174. l:=ord(actasmpattern[4]) + ord(actasmpattern[3]) shl 8 +
  1175. Ord(actasmpattern[2]) shl 16 + ord(actasmpattern[1]) shl 24;
  1176. else
  1177. Message1(asmr_e_invalid_string_as_opcode_operand,actasmpattern);
  1178. end;
  1179. str(l, tempstr);
  1180. expr:=expr + tempstr;
  1181. Consume(AS_STRING);
  1182. end;
  1183. AS_TYPE:
  1184. begin
  1185. l:=0;
  1186. Consume(AS_TYPE);
  1187. if actasmtoken<>AS_ID then
  1188. Message(asmr_e_type_without_identifier)
  1189. else
  1190. begin
  1191. tempstr:=actasmpattern;
  1192. Consume(AS_ID);
  1193. if actasmtoken=AS_DOT then
  1194. BuildRecordOffsetSize(tempstr,k,l)
  1195. else
  1196. begin
  1197. searchsym(tempstr,sym,srsymtable);
  1198. if assigned(sym) then
  1199. begin
  1200. case sym.typ of
  1201. varsym :
  1202. l:=tvarsym(sym).getsize;
  1203. typedconstsym :
  1204. l:=ttypedconstsym(sym).getsize;
  1205. typesym :
  1206. l:=ttypesym(sym).restype.def.size;
  1207. else
  1208. Message(asmr_e_wrong_sym_type);
  1209. end;
  1210. end
  1211. else
  1212. Message1(sym_e_unknown_id,tempstr);
  1213. end;
  1214. end;
  1215. str(l, tempstr);
  1216. expr:=expr + tempstr;
  1217. end;
  1218. AS_ID:
  1219. Begin
  1220. hs:='';
  1221. tempstr:=actasmpattern;
  1222. prevtok:=prevasmtoken;
  1223. consume(AS_ID);
  1224. if SearchIConstant(tempstr,l) then
  1225. begin
  1226. str(l, tempstr);
  1227. expr:=expr + tempstr;
  1228. end
  1229. else
  1230. begin
  1231. if is_locallabel(tempstr) then
  1232. begin
  1233. CreateLocalLabel(tempstr,hl,false);
  1234. hs:=hl.name
  1235. end
  1236. else
  1237. if SearchLabel(tempstr,hl,false) then
  1238. hs:=hl.name
  1239. else
  1240. begin
  1241. searchsym(tempstr,sym,srsymtable);
  1242. if assigned(sym) then
  1243. begin
  1244. case sym.typ of
  1245. varsym :
  1246. begin
  1247. if sym.owner.symtabletype in [localsymtable,parasymtable] then
  1248. Message(asmr_e_no_local_or_para_allowed);
  1249. hs:=tvarsym(sym).mangledname;
  1250. end;
  1251. typedconstsym :
  1252. hs:=ttypedconstsym(sym).mangledname;
  1253. procsym :
  1254. begin
  1255. if Tprocsym(sym).procdef_count>1 then
  1256. Message(asmr_w_calling_overload_func);
  1257. hs:=tprocsym(sym).first_procdef.mangledname;
  1258. end;
  1259. typesym :
  1260. begin
  1261. if not(ttypesym(sym).restype.def.deftype in [recorddef,objectdef]) then
  1262. Message(asmr_e_wrong_sym_type);
  1263. end;
  1264. else
  1265. Message(asmr_e_wrong_sym_type);
  1266. end;
  1267. end
  1268. else
  1269. Message1(sym_e_unknown_id,tempstr);
  1270. end;
  1271. { symbol found? }
  1272. if hs<>'' then
  1273. begin
  1274. if needofs and (prevtok<>AS_DOLLAR) then
  1275. Message(asmr_e_need_dollar);
  1276. if asmsym='' then
  1277. asmsym:=hs
  1278. else
  1279. Message(asmr_e_cant_have_multiple_relocatable_symbols);
  1280. if (expr='') or (expr[length(expr)]='+') then
  1281. begin
  1282. { don't remove the + if there could be a record field }
  1283. if actasmtoken<>AS_DOT then
  1284. delete(expr,length(expr),1);
  1285. end
  1286. else
  1287. Message(asmr_e_only_add_relocatable_symbol);
  1288. end;
  1289. if actasmtoken=AS_DOT then
  1290. begin
  1291. BuildRecordOffsetSize(tempstr,l,k);
  1292. str(l, tempstr);
  1293. expr:=expr + tempstr;
  1294. end
  1295. else
  1296. begin
  1297. if (expr='') or (expr[length(expr)] in ['+','-','/','*']) then
  1298. delete(expr,length(expr),1);
  1299. end;
  1300. end;
  1301. { check if there are wrong operator used like / or mod etc. }
  1302. if (hs<>'') and not(actasmtoken in [AS_MINUS,AS_PLUS,AS_COMMA,AS_SEPARATOR,AS_LPAREN,AS_END]) then
  1303. Message(asmr_e_only_add_relocatable_symbol);
  1304. end;
  1305. AS_END,
  1306. AS_SEPARATOR,
  1307. AS_COMMA:
  1308. break;
  1309. else
  1310. Begin
  1311. { write error only once. }
  1312. if not errorflag then
  1313. Message(asmr_e_invalid_constant_expression);
  1314. { consume tokens until we find COMMA or SEPARATOR }
  1315. Consume(actasmtoken);
  1316. errorflag:=TRUE;
  1317. end;
  1318. end;
  1319. Until false;
  1320. { calculate expression }
  1321. if not ErrorFlag then
  1322. value:=CalculateExpression(expr)
  1323. else
  1324. value:=0;
  1325. end;
  1326. function tattreader.BuildConstExpression(allowref,betweenbracket:boolean): longint;
  1327. var
  1328. l : longint;
  1329. hs : string;
  1330. begin
  1331. BuildConstSymbolExpression(allowref,betweenbracket,false,l,hs);
  1332. if hs<>'' then
  1333. Message(asmr_e_relocatable_symbol_not_allowed);
  1334. BuildConstExpression:=l;
  1335. end;
  1336. Procedure tattreader.BuildConstantOperand(oper : toperand);
  1337. var
  1338. l : longint;
  1339. tempstr : string;
  1340. begin
  1341. BuildConstSymbolExpression(false,false,true,l,tempstr);
  1342. if tempstr<>'' then
  1343. begin
  1344. oper.opr.typ:=OPR_SYMBOL;
  1345. oper.opr.symofs:=l;
  1346. oper.opr.symbol:=objectlibrary.newasmsymbol(tempstr);
  1347. end
  1348. else
  1349. begin
  1350. oper.opr.typ:=OPR_CONSTANT;
  1351. oper.opr.val:=l;
  1352. end;
  1353. end;
  1354. end.
  1355. {
  1356. $Log$
  1357. Revision 1.4 2003-11-29 16:27:19 jonas
  1358. * fixed several ppc assembler reader related problems
  1359. * local vars in assembler procedures now start at offset 4
  1360. * fixed second_int_to_bool (apparently an integer can be in LOC_JUMP??)
  1361. Revision 1.3 2003/11/17 23:23:47 florian
  1362. + first part of arm assembler reader
  1363. Revision 1.2 2003/11/15 19:00:10 florian
  1364. * fixed ppc assembler reader
  1365. Revision 1.1 2003/11/12 16:05:39 florian
  1366. * assembler readers OOPed
  1367. + typed currency constants
  1368. + typed 128 bit float constants if the CPU supports it
  1369. }