raatt.pas 46 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471
  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 prefix - or .
  235. this code could be moved to is_asmopcode but I think
  236. it's better to ifdef it here (FK)
  237. }
  238. if c='.' then
  239. begin
  240. actasmpattern:=actasmpattern+'.';
  241. c:=current_scanner.asmgetchar;
  242. end
  243. else if c='-' then
  244. begin
  245. actasmpattern:=actasmpattern+'-';
  246. c:=current_scanner.asmgetchar;
  247. end;
  248. {$endif POWERPC}
  249. { Opcode ? }
  250. If is_asmopcode(upper(actasmpattern)) then
  251. Begin
  252. uppervar(actasmpattern);
  253. exit;
  254. end;
  255. { End of assemblerblock ? }
  256. if upper(actasmpattern) = 'END' then
  257. begin
  258. actasmtoken:=AS_END;
  259. exit;
  260. end;
  261. message1(asmr_e_unknown_opcode,actasmpattern);
  262. actasmtoken:=AS_NONE;
  263. end
  264. else { else firsttoken }
  265. { Here we must handle all possible cases }
  266. begin
  267. case c of
  268. '.' : { possiblities : - local label reference , such as in jmp @local1 }
  269. { - field of object/record }
  270. { - directive. }
  271. begin
  272. if (prevasmtoken in [AS_ID,AS_RPAREN]) then
  273. begin
  274. c:=current_scanner.asmgetchar;
  275. actasmtoken:=AS_DOT;
  276. exit;
  277. end;
  278. actasmpattern:=c;
  279. c:=current_scanner.asmgetchar;
  280. while c in ['A'..'Z','a'..'z','0'..'9','_','$'] do
  281. begin
  282. actasmpattern:=actasmpattern + c;
  283. c:=current_scanner.asmgetchar;
  284. end;
  285. if is_asmdirective(actasmpattern) then
  286. exit;
  287. { local label references and directives }
  288. { are case sensitive }
  289. actasmtoken:=AS_ID;
  290. exit;
  291. end;
  292. { identifier, register, prefix or directive }
  293. '_','A'..'Z','a'..'z':
  294. begin
  295. len:=0;
  296. while c in ['A'..'Z','a'..'z','0'..'9','_','$'] do
  297. begin
  298. inc(len);
  299. actasmpattern[len]:=c;
  300. c:=current_scanner.asmgetchar;
  301. end;
  302. actasmpattern[0]:=chr(len);
  303. uppervar(actasmpattern);
  304. {$ifdef x86}
  305. { only x86 architectures have instruction prefixes }
  306. { Opcode, can only be when the previous was a prefix }
  307. If is_prefix(actopcode) and is_asmopcode(actasmpattern) then
  308. Begin
  309. uppervar(actasmpattern);
  310. exit;
  311. end;
  312. {$endif x86}
  313. { check for end which is a reserved word unlike the opcodes }
  314. if actasmpattern = 'END' then
  315. Begin
  316. actasmtoken:=AS_END;
  317. exit;
  318. end;
  319. if actasmpattern = 'TYPE' then
  320. Begin
  321. actasmtoken:=AS_TYPE;
  322. exit;
  323. end;
  324. if is_register(actasmpattern) then
  325. begin
  326. actasmtoken:=AS_REGISTER;
  327. exit;
  328. end;
  329. { if next is a '.' and this is a unitsym then we also need to
  330. parse the identifier }
  331. if (c='.') then
  332. begin
  333. searchsym(actasmpattern,srsym,srsymtable);
  334. if assigned(srsym) and
  335. (srsym.typ=unitsym) and
  336. (srsym.owner.unitid=0) then
  337. begin
  338. actasmpattern:=actasmpattern+c;
  339. c:=current_scanner.asmgetchar;
  340. while c in ['A'..'Z','a'..'z','0'..'9','_','$'] do
  341. begin
  342. actasmpattern:=actasmpattern + upcase(c);
  343. c:=current_scanner.asmgetchar;
  344. end;
  345. end;
  346. end;
  347. actasmtoken:=AS_ID;
  348. exit;
  349. end;
  350. '%' : { register or modulo }
  351. handlepercent;
  352. '1'..'9': { integer number }
  353. begin
  354. len:=0;
  355. while c in ['0'..'9'] do
  356. Begin
  357. inc(len);
  358. actasmpattern[len]:=c;
  359. c:=current_scanner.asmgetchar;
  360. end;
  361. actasmpattern[0]:=chr(len);
  362. actasmpattern:=tostr(ValDecimal(actasmpattern));
  363. actasmtoken:=AS_INTNUM;
  364. exit;
  365. end;
  366. '0' : { octal,hexa,real or binary number. }
  367. begin
  368. actasmpattern:=c;
  369. c:=current_scanner.asmgetchar;
  370. case upcase(c) of
  371. 'B': { binary }
  372. Begin
  373. c:=current_scanner.asmgetchar;
  374. while c in ['0','1'] do
  375. Begin
  376. actasmpattern:=actasmpattern + c;
  377. c:=current_scanner.asmgetchar;
  378. end;
  379. actasmpattern:=tostr(ValBinary(actasmpattern));
  380. actasmtoken:=AS_INTNUM;
  381. exit;
  382. end;
  383. 'D': { real }
  384. Begin
  385. c:=current_scanner.asmgetchar;
  386. { get ridd of the 0d }
  387. if (c in ['+','-']) then
  388. begin
  389. actasmpattern:=c;
  390. c:=current_scanner.asmgetchar;
  391. end
  392. else
  393. actasmpattern:='';
  394. while c in ['0'..'9'] do
  395. Begin
  396. actasmpattern:=actasmpattern + c;
  397. c:=current_scanner.asmgetchar;
  398. end;
  399. if c='.' then
  400. begin
  401. actasmpattern:=actasmpattern + c;
  402. c:=current_scanner.asmgetchar;
  403. while c in ['0'..'9'] do
  404. Begin
  405. actasmpattern:=actasmpattern + c;
  406. c:=current_scanner.asmgetchar;
  407. end;
  408. if upcase(c) = 'E' then
  409. begin
  410. actasmpattern:=actasmpattern + c;
  411. c:=current_scanner.asmgetchar;
  412. if (c in ['+','-']) then
  413. begin
  414. actasmpattern:=actasmpattern + c;
  415. c:=current_scanner.asmgetchar;
  416. end;
  417. while c in ['0'..'9'] do
  418. Begin
  419. actasmpattern:=actasmpattern + c;
  420. c:=current_scanner.asmgetchar;
  421. end;
  422. end;
  423. actasmtoken:=AS_REALNUM;
  424. exit;
  425. end
  426. else
  427. begin
  428. Message1(asmr_e_invalid_float_const,actasmpattern+c);
  429. actasmtoken:=AS_NONE;
  430. end;
  431. end;
  432. 'X': { hexadecimal }
  433. Begin
  434. c:=current_scanner.asmgetchar;
  435. while c in ['0'..'9','a'..'f','A'..'F'] do
  436. Begin
  437. actasmpattern:=actasmpattern + c;
  438. c:=current_scanner.asmgetchar;
  439. end;
  440. actasmpattern:=tostr(ValHexaDecimal(actasmpattern));
  441. actasmtoken:=AS_INTNUM;
  442. exit;
  443. end;
  444. '1'..'7': { octal }
  445. begin
  446. actasmpattern:=actasmpattern + c;
  447. while c in ['0'..'7'] do
  448. Begin
  449. actasmpattern:=actasmpattern + c;
  450. c:=current_scanner.asmgetchar;
  451. end;
  452. actasmpattern:=tostr(ValOctal(actasmpattern));
  453. actasmtoken:=AS_INTNUM;
  454. exit;
  455. end;
  456. else { octal number zero value...}
  457. Begin
  458. actasmpattern:=tostr(ValOctal(actasmpattern));
  459. actasmtoken:=AS_INTNUM;
  460. exit;
  461. end;
  462. end; { end case }
  463. end;
  464. '&' :
  465. begin
  466. c:=current_scanner.asmgetchar;
  467. actasmtoken:=AS_AND;
  468. end;
  469. '''' : { char }
  470. begin
  471. current_scanner.in_asm_string:=true;
  472. actasmpattern:='';
  473. repeat
  474. c:=current_scanner.asmgetchar;
  475. case c of
  476. '\' :
  477. begin
  478. { copy also the next char so \" is parsed correctly }
  479. actasmpattern:=actasmpattern+c;
  480. c:=current_scanner.asmgetchar;
  481. actasmpattern:=actasmpattern+c;
  482. end;
  483. '''' :
  484. begin
  485. c:=current_scanner.asmgetchar;
  486. break;
  487. end;
  488. #10,#13:
  489. Message(scan_f_string_exceeds_line);
  490. else
  491. actasmpattern:=actasmpattern+c;
  492. end;
  493. until false;
  494. actasmpattern:=EscapeToPascal(actasmpattern);
  495. actasmtoken:=AS_STRING;
  496. current_scanner.in_asm_string:=false;
  497. exit;
  498. end;
  499. '"' : { string }
  500. begin
  501. current_scanner.in_asm_string:=true;
  502. actasmpattern:='';
  503. repeat
  504. c:=current_scanner.asmgetchar;
  505. case c of
  506. '\' :
  507. begin
  508. { copy also the next char so \" is parsed correctly }
  509. actasmpattern:=actasmpattern+c;
  510. c:=current_scanner.asmgetchar;
  511. actasmpattern:=actasmpattern+c;
  512. end;
  513. '"' :
  514. begin
  515. c:=current_scanner.asmgetchar;
  516. break;
  517. end;
  518. #10,#13:
  519. Message(scan_f_string_exceeds_line);
  520. else
  521. actasmpattern:=actasmpattern+c;
  522. end;
  523. until false;
  524. actasmpattern:=EscapeToPascal(actasmpattern);
  525. actasmtoken:=AS_STRING;
  526. current_scanner.in_asm_string:=false;
  527. exit;
  528. end;
  529. '$' :
  530. begin
  531. actasmtoken:=AS_DOLLAR;
  532. c:=current_scanner.asmgetchar;
  533. exit;
  534. end;
  535. '#' :
  536. begin
  537. actasmtoken:=AS_HASH;
  538. c:=current_scanner.asmgetchar;
  539. exit;
  540. end;
  541. {$ifdef arm}
  542. // the arm assembler uses { ... } for register sets
  543. '{' :
  544. begin
  545. actasmtoken:=AS_LSBRACKET;
  546. c:=current_scanner.asmgetchar;
  547. exit;
  548. end;
  549. '}' :
  550. begin
  551. actasmtoken:=AS_RSBRACKET;
  552. c:=current_scanner.asmgetchar;
  553. exit;
  554. end;
  555. {$endif arm}
  556. ',' :
  557. begin
  558. actasmtoken:=AS_COMMA;
  559. c:=current_scanner.asmgetchar;
  560. exit;
  561. end;
  562. '<' :
  563. begin
  564. actasmtoken:=AS_SHL;
  565. c:=current_scanner.asmgetchar;
  566. if c = '<' then
  567. c:=current_scanner.asmgetchar;
  568. exit;
  569. end;
  570. '>' :
  571. begin
  572. actasmtoken:=AS_SHL;
  573. c:=current_scanner.asmgetchar;
  574. if c = '>' then
  575. c:=current_scanner.asmgetchar;
  576. exit;
  577. end;
  578. '|' :
  579. begin
  580. actasmtoken:=AS_OR;
  581. c:=current_scanner.asmgetchar;
  582. exit;
  583. end;
  584. '^' :
  585. begin
  586. actasmtoken:=AS_XOR;
  587. c:=current_scanner.asmgetchar;
  588. exit;
  589. end;
  590. '(' :
  591. begin
  592. actasmtoken:=AS_LPAREN;
  593. c:=current_scanner.asmgetchar;
  594. exit;
  595. end;
  596. ')' :
  597. begin
  598. actasmtoken:=AS_RPAREN;
  599. c:=current_scanner.asmgetchar;
  600. exit;
  601. end;
  602. ':' :
  603. begin
  604. actasmtoken:=AS_COLON;
  605. c:=current_scanner.asmgetchar;
  606. exit;
  607. end;
  608. '+' :
  609. begin
  610. actasmtoken:=AS_PLUS;
  611. c:=current_scanner.asmgetchar;
  612. exit;
  613. end;
  614. '-' :
  615. begin
  616. actasmtoken:=AS_MINUS;
  617. c:=current_scanner.asmgetchar;
  618. exit;
  619. end;
  620. '*' :
  621. begin
  622. actasmtoken:=AS_STAR;
  623. c:=current_scanner.asmgetchar;
  624. exit;
  625. end;
  626. '/' :
  627. begin
  628. actasmtoken:=AS_SLASH;
  629. c:=current_scanner.asmgetchar;
  630. exit;
  631. end;
  632. '@' :
  633. begin
  634. actasmtoken:=AS_AT;
  635. c:=current_scanner.asmgetchar;
  636. exit;
  637. end;
  638. {$ifndef arm}
  639. '{',
  640. {$endif arm}
  641. #13,#10,';' :
  642. begin
  643. { the comment is read by asmgetchar }
  644. c:=current_scanner.asmgetchar;
  645. firsttoken:=TRUE;
  646. actasmtoken:=AS_SEPARATOR;
  647. exit;
  648. end;
  649. else
  650. current_scanner.illegal_char(c);
  651. end;
  652. end;
  653. end;
  654. function tattreader.consume(t : tasmtoken):boolean;
  655. begin
  656. Consume:=true;
  657. if t<>actasmtoken then
  658. begin
  659. Message2(scan_f_syn_expected,token2str[t],token2str[actasmtoken]);
  660. Consume:=false;
  661. end;
  662. repeat
  663. gettoken;
  664. until actasmtoken<>AS_NONE;
  665. end;
  666. procedure tattreader.RecoverConsume(allowcomma:boolean);
  667. begin
  668. While not (actasmtoken in [AS_SEPARATOR,AS_END]) do
  669. begin
  670. if allowcomma and (actasmtoken=AS_COMMA) then
  671. break;
  672. Consume(actasmtoken);
  673. end;
  674. end;
  675. Procedure tattreader.BuildConstant(maxvalue: longint);
  676. var
  677. asmsym,
  678. expr: string;
  679. value : longint;
  680. Begin
  681. Repeat
  682. Case actasmtoken of
  683. AS_STRING:
  684. Begin
  685. expr:=actasmpattern;
  686. if length(expr) > 1 then
  687. Message(asmr_e_string_not_allowed_as_const);
  688. Consume(AS_STRING);
  689. Case actasmtoken of
  690. AS_COMMA: Consume(AS_COMMA);
  691. AS_END,
  692. AS_SEPARATOR: ;
  693. else
  694. Message(asmr_e_invalid_string_expression);
  695. end; { end case }
  696. ConcatString(curlist,expr);
  697. end;
  698. AS_INTNUM,
  699. AS_PLUS,
  700. AS_MINUS,
  701. AS_LPAREN,
  702. AS_NOT,
  703. AS_ID :
  704. Begin
  705. BuildConstSymbolExpression(false,false,false,value,asmsym);
  706. if asmsym<>'' then
  707. begin
  708. if maxvalue<>longint($ffffffff) then
  709. Message(asmr_w_32bit_const_for_address);
  710. ConcatConstSymbol(curlist,asmsym,value)
  711. end
  712. else
  713. ConcatConstant(curlist,value,maxvalue);
  714. end;
  715. AS_COMMA:
  716. Consume(AS_COMMA);
  717. AS_END,
  718. AS_SEPARATOR:
  719. break;
  720. else
  721. begin
  722. Message(asmr_e_syn_constant);
  723. RecoverConsume(false);
  724. end
  725. end; { end case }
  726. Until false;
  727. end;
  728. Procedure tattreader.BuildRealConstant(typ : tfloattype);
  729. var
  730. expr : string;
  731. r : bestreal;
  732. code : integer;
  733. negativ : boolean;
  734. errorflag: boolean;
  735. Begin
  736. errorflag:=FALSE;
  737. Repeat
  738. negativ:=false;
  739. expr:='';
  740. if actasmtoken=AS_PLUS then
  741. Consume(AS_PLUS)
  742. else
  743. if actasmtoken=AS_MINUS then
  744. begin
  745. negativ:=true;
  746. consume(AS_MINUS);
  747. end;
  748. Case actasmtoken of
  749. AS_INTNUM:
  750. Begin
  751. expr:=actasmpattern;
  752. Consume(AS_INTNUM);
  753. if negativ then
  754. expr:='-'+expr;
  755. val(expr,r,code);
  756. if code<>0 then
  757. Begin
  758. r:=0;
  759. Message(asmr_e_invalid_float_expr);
  760. End;
  761. ConcatRealConstant(curlist,r,typ);
  762. end;
  763. AS_REALNUM:
  764. Begin
  765. expr:=actasmpattern;
  766. Consume(AS_REALNUM);
  767. { in ATT syntax you have 0d in front of the real }
  768. { should this be forced ? yes i think so, as to }
  769. { conform to gas as much as possible. }
  770. if (expr[1]='0') and (upper(expr[2])='D') then
  771. Delete(expr,1,2);
  772. if negativ then
  773. expr:='-'+expr;
  774. val(expr,r,code);
  775. if code<>0 then
  776. Begin
  777. r:=0;
  778. Message(asmr_e_invalid_float_expr);
  779. End;
  780. ConcatRealConstant(curlist,r,typ);
  781. end;
  782. AS_COMMA:
  783. begin
  784. Consume(AS_COMMA);
  785. end;
  786. AS_END,
  787. AS_SEPARATOR:
  788. begin
  789. break;
  790. end;
  791. else
  792. Begin
  793. Consume(actasmtoken);
  794. if not errorflag then
  795. Message(asmr_e_invalid_float_expr);
  796. errorflag:=TRUE;
  797. end;
  798. end;
  799. Until false;
  800. end;
  801. Procedure tattreader.BuildStringConstant(asciiz: boolean);
  802. var
  803. expr: string;
  804. errorflag : boolean;
  805. Begin
  806. errorflag:=FALSE;
  807. Repeat
  808. Case actasmtoken of
  809. AS_STRING:
  810. Begin
  811. expr:=actasmpattern;
  812. if asciiz then
  813. expr:=expr+#0;
  814. ConcatPasString(curlist,expr);
  815. Consume(AS_STRING);
  816. end;
  817. AS_COMMA:
  818. begin
  819. Consume(AS_COMMA);
  820. end;
  821. AS_END,
  822. AS_SEPARATOR:
  823. begin
  824. break;
  825. end;
  826. else
  827. Begin
  828. Consume(actasmtoken);
  829. if not errorflag then
  830. Message(asmr_e_invalid_string_expression);
  831. errorflag:=TRUE;
  832. end;
  833. end;
  834. Until false;
  835. end;
  836. Function tattreader.Assemble: tlinkedlist;
  837. Var
  838. hl : tasmlabel;
  839. commname : string;
  840. lasTSec : TSection;
  841. l1,l2 : longint;
  842. Begin
  843. Message1(asmr_d_start_reading,'GNU AS');
  844. firsttoken:=TRUE;
  845. { sets up all opcode and register tables in uppercase }
  846. if not _asmsorted then
  847. Begin
  848. SetupTables;
  849. _asmsorted:=TRUE;
  850. end;
  851. curlist:=TAAsmoutput.Create;
  852. lasTSec:=sec_code;
  853. { setup label linked list }
  854. LocalLabelList:=TLocalLabelList.Create;
  855. { start tokenizer }
  856. c:=current_scanner.asmgetcharstart;
  857. gettoken;
  858. { main loop }
  859. repeat
  860. case actasmtoken of
  861. AS_LLABEL:
  862. Begin
  863. if CreateLocalLabel(actasmpattern,hl,true) then
  864. ConcatLabel(curlist,hl);
  865. Consume(AS_LLABEL);
  866. end;
  867. AS_LABEL:
  868. Begin
  869. if SearchLabel(upper(actasmpattern),hl,true) then
  870. ConcatLabel(curlist,hl)
  871. else
  872. Message1(asmr_e_unknown_label_identifier,actasmpattern);
  873. Consume(AS_LABEL);
  874. end;
  875. AS_DW:
  876. Begin
  877. Consume(AS_DW);
  878. BuildConstant($ffff);
  879. end;
  880. AS_DATA:
  881. Begin
  882. curList.Concat(Tai_section.Create(sec_data));
  883. lasTSec:=sec_data;
  884. Consume(AS_DATA);
  885. end;
  886. AS_TEXT:
  887. Begin
  888. curList.Concat(Tai_section.Create(sec_code));
  889. lasTSec:=sec_code;
  890. Consume(AS_TEXT);
  891. end;
  892. AS_DB:
  893. Begin
  894. Consume(AS_DB);
  895. BuildConstant($ff);
  896. end;
  897. AS_DD:
  898. Begin
  899. Consume(AS_DD);
  900. BuildConstant(longint($ffffffff));
  901. end;
  902. AS_DQ:
  903. Begin
  904. Consume(AS_DQ);
  905. BuildRealConstant(s64comp);
  906. end;
  907. AS_SINGLE:
  908. Begin
  909. Consume(AS_SINGLE);
  910. BuildRealConstant(s32real);
  911. end;
  912. AS_DOUBLE:
  913. Begin
  914. Consume(AS_DOUBLE);
  915. BuildRealConstant(s64real);
  916. end;
  917. AS_EXTENDED:
  918. Begin
  919. Consume(AS_EXTENDED);
  920. BuildRealConstant(s80real);
  921. end;
  922. AS_GLOBAL:
  923. Begin
  924. Consume(AS_GLOBAL);
  925. if actasmtoken=AS_ID then
  926. ConcatPublic(curlist,actasmpattern);
  927. Consume(AS_ID);
  928. if actasmtoken<>AS_SEPARATOR then
  929. Consume(AS_SEPARATOR);
  930. end;
  931. AS_ALIGN:
  932. Begin
  933. Consume(AS_ALIGN);
  934. l1:=BuildConstExpression(false,false);
  935. if (target_info.system in [system_i386_GO32V2]) then
  936. begin
  937. l2:=1;
  938. if (l1>=0) and (l1<=16) then
  939. while (l1>0) do
  940. begin
  941. l2:=2*l2;
  942. dec(l1);
  943. end;
  944. l1:=l2;
  945. end;
  946. ConcatAlign(curlist,l1);
  947. Message(asmr_n_align_is_target_specific);
  948. if actasmtoken<>AS_SEPARATOR then
  949. Consume(AS_SEPARATOR);
  950. end;
  951. AS_BALIGN:
  952. Begin
  953. Consume(AS_BALIGN);
  954. ConcatAlign(curlist,BuildConstExpression(false,false));
  955. if actasmtoken<>AS_SEPARATOR then
  956. Consume(AS_SEPARATOR);
  957. end;
  958. AS_P2ALIGN:
  959. Begin
  960. Consume(AS_P2ALIGN);
  961. l1:=BuildConstExpression(false,false);
  962. l2:=1;
  963. if (l1>=0) and (l1<=16) then
  964. while (l1>0) do
  965. begin
  966. l2:=2*l2;
  967. dec(l1);
  968. end;
  969. l1:=l2;
  970. ConcatAlign(curlist,l1);
  971. if actasmtoken<>AS_SEPARATOR then
  972. Consume(AS_SEPARATOR);
  973. end;
  974. AS_ASCIIZ:
  975. Begin
  976. Consume(AS_ASCIIZ);
  977. BuildStringConstant(TRUE);
  978. end;
  979. AS_ASCII:
  980. Begin
  981. Consume(AS_ASCII);
  982. BuildStringConstant(FALSE);
  983. end;
  984. AS_LCOMM:
  985. Begin
  986. Consume(AS_LCOMM);
  987. commname:=actasmpattern;
  988. Consume(AS_ID);
  989. Consume(AS_COMMA);
  990. ConcatLocalBss(commname,BuildConstExpression(false,false));
  991. if actasmtoken<>AS_SEPARATOR then
  992. Consume(AS_SEPARATOR);
  993. end;
  994. AS_COMM:
  995. Begin
  996. Consume(AS_COMM);
  997. commname:=actasmpattern;
  998. Consume(AS_ID);
  999. Consume(AS_COMMA);
  1000. ConcatGlobalBss(commname,BuildConstExpression(false,false));
  1001. if actasmtoken<>AS_SEPARATOR then
  1002. Consume(AS_SEPARATOR);
  1003. end;
  1004. AS_OPCODE:
  1005. Begin
  1006. HandleOpCode;
  1007. end;
  1008. AS_SEPARATOR:
  1009. Begin
  1010. Consume(AS_SEPARATOR);
  1011. end;
  1012. AS_END:
  1013. begin
  1014. break; { end assembly block }
  1015. end;
  1016. else
  1017. Begin
  1018. Message(asmr_e_syntax_error);
  1019. RecoverConsume(false);
  1020. end;
  1021. end;
  1022. until false;
  1023. { Check LocalLabelList }
  1024. LocalLabelList.CheckEmitted;
  1025. LocalLabelList.Free;
  1026. { are we back in the code section? }
  1027. if lasTSec<>sec_code then
  1028. begin
  1029. Message(asmr_w_assembler_code_not_returned_to_text);
  1030. curList.Concat(Tai_section.Create(sec_code));
  1031. end;
  1032. { Return the list in an asmnode }
  1033. assemble:=curlist;
  1034. Message1(asmr_d_finish_reading,'GNU AS');
  1035. end;
  1036. {*****************************************************************************
  1037. Parsing Helpers
  1038. *****************************************************************************}
  1039. Procedure tattreader.BuildRecordOffsetSize(const expr: string;var offset:longint;var size:longint);
  1040. { Description: This routine builds up a record offset after a AS_DOT }
  1041. { token is encountered. }
  1042. { On entry actasmtoken should be equal to AS_DOT }
  1043. var
  1044. s : string;
  1045. Begin
  1046. offset:=0;
  1047. size:=0;
  1048. s:=expr;
  1049. while (actasmtoken=AS_DOT) do
  1050. begin
  1051. Consume(AS_DOT);
  1052. if actasmtoken=AS_ID then
  1053. s:=s+'.'+actasmpattern;
  1054. if not Consume(AS_ID) then
  1055. begin
  1056. RecoverConsume(true);
  1057. break;
  1058. end;
  1059. end;
  1060. if not GetRecordOffsetSize(s,offset,size) then
  1061. Message(asmr_e_building_record_offset);
  1062. end;
  1063. procedure tattreader.BuildConstSymbolExpression(allowref,betweenbracket,needofs:boolean;var value:longint;var asmsym:string);
  1064. var
  1065. hs,tempstr,expr : string;
  1066. parenlevel,l,k : longint;
  1067. errorflag : boolean;
  1068. prevtok : tasmtoken;
  1069. sym : tsym;
  1070. srsymtable : tsymtable;
  1071. hl : tasmlabel;
  1072. Begin
  1073. asmsym:='';
  1074. value:=0;
  1075. errorflag:=FALSE;
  1076. tempstr:='';
  1077. expr:='';
  1078. parenlevel:=0;
  1079. Repeat
  1080. Case actasmtoken of
  1081. AS_LPAREN:
  1082. Begin
  1083. { Exit if ref? }
  1084. if allowref and (prevasmtoken in [AS_INTNUM,AS_ID]) then
  1085. break;
  1086. Consume(AS_LPAREN);
  1087. expr:=expr + '(';
  1088. inc(parenlevel);
  1089. end;
  1090. AS_RPAREN:
  1091. Begin
  1092. { end of ref ? }
  1093. if (parenlevel=0) and betweenbracket then
  1094. break;
  1095. Consume(AS_RPAREN);
  1096. expr:=expr + ')';
  1097. dec(parenlevel);
  1098. end;
  1099. AS_SHL:
  1100. Begin
  1101. Consume(AS_SHL);
  1102. expr:=expr + '<';
  1103. end;
  1104. AS_SHR:
  1105. Begin
  1106. Consume(AS_SHR);
  1107. expr:=expr + '>';
  1108. end;
  1109. AS_SLASH:
  1110. Begin
  1111. Consume(AS_SLASH);
  1112. expr:=expr + '/';
  1113. end;
  1114. AS_MOD:
  1115. Begin
  1116. Consume(AS_MOD);
  1117. expr:=expr + '%';
  1118. end;
  1119. AS_STAR:
  1120. Begin
  1121. Consume(AS_STAR);
  1122. expr:=expr + '*';
  1123. end;
  1124. AS_PLUS:
  1125. Begin
  1126. Consume(AS_PLUS);
  1127. expr:=expr + '+';
  1128. end;
  1129. AS_MINUS:
  1130. Begin
  1131. Consume(AS_MINUS);
  1132. expr:=expr + '-';
  1133. end;
  1134. AS_AND:
  1135. Begin
  1136. Consume(AS_AND);
  1137. expr:=expr + '&';
  1138. end;
  1139. AS_NOT:
  1140. Begin
  1141. Consume(AS_NOT);
  1142. expr:=expr + '~';
  1143. end;
  1144. AS_XOR:
  1145. Begin
  1146. Consume(AS_XOR);
  1147. expr:=expr + '^';
  1148. end;
  1149. AS_OR:
  1150. Begin
  1151. Consume(AS_OR);
  1152. expr:=expr + '|';
  1153. end;
  1154. AS_INTNUM:
  1155. Begin
  1156. expr:=expr + actasmpattern;
  1157. Consume(AS_INTNUM);
  1158. end;
  1159. AS_DOLLAR:
  1160. begin
  1161. Consume(AS_DOLLAR);
  1162. if actasmtoken<>AS_ID then
  1163. Message(asmr_e_dollar_without_identifier);
  1164. end;
  1165. AS_STRING:
  1166. Begin
  1167. l:=0;
  1168. case Length(actasmpattern) of
  1169. 1 :
  1170. l:=ord(actasmpattern[1]);
  1171. 2 :
  1172. l:=ord(actasmpattern[2]) + ord(actasmpattern[1]) shl 8;
  1173. 3 :
  1174. l:=ord(actasmpattern[3]) +
  1175. Ord(actasmpattern[2]) shl 8 + ord(actasmpattern[1]) shl 16;
  1176. 4 :
  1177. l:=ord(actasmpattern[4]) + ord(actasmpattern[3]) shl 8 +
  1178. Ord(actasmpattern[2]) shl 16 + ord(actasmpattern[1]) shl 24;
  1179. else
  1180. Message1(asmr_e_invalid_string_as_opcode_operand,actasmpattern);
  1181. end;
  1182. str(l, tempstr);
  1183. expr:=expr + tempstr;
  1184. Consume(AS_STRING);
  1185. end;
  1186. AS_TYPE:
  1187. begin
  1188. l:=0;
  1189. Consume(AS_TYPE);
  1190. if actasmtoken<>AS_ID then
  1191. Message(asmr_e_type_without_identifier)
  1192. else
  1193. begin
  1194. tempstr:=actasmpattern;
  1195. Consume(AS_ID);
  1196. if actasmtoken=AS_DOT then
  1197. BuildRecordOffsetSize(tempstr,k,l)
  1198. else
  1199. begin
  1200. searchsym(tempstr,sym,srsymtable);
  1201. if assigned(sym) then
  1202. begin
  1203. case sym.typ of
  1204. varsym :
  1205. l:=tvarsym(sym).getsize;
  1206. typedconstsym :
  1207. l:=ttypedconstsym(sym).getsize;
  1208. typesym :
  1209. l:=ttypesym(sym).restype.def.size;
  1210. else
  1211. Message(asmr_e_wrong_sym_type);
  1212. end;
  1213. end
  1214. else
  1215. Message1(sym_e_unknown_id,tempstr);
  1216. end;
  1217. end;
  1218. str(l, tempstr);
  1219. expr:=expr + tempstr;
  1220. end;
  1221. AS_ID:
  1222. Begin
  1223. hs:='';
  1224. tempstr:=actasmpattern;
  1225. prevtok:=prevasmtoken;
  1226. consume(AS_ID);
  1227. if SearchIConstant(tempstr,l) then
  1228. begin
  1229. str(l, tempstr);
  1230. expr:=expr + tempstr;
  1231. end
  1232. else
  1233. begin
  1234. if is_locallabel(tempstr) then
  1235. begin
  1236. CreateLocalLabel(tempstr,hl,false);
  1237. hs:=hl.name
  1238. end
  1239. else
  1240. if SearchLabel(tempstr,hl,false) then
  1241. hs:=hl.name
  1242. else
  1243. begin
  1244. searchsym(tempstr,sym,srsymtable);
  1245. if assigned(sym) then
  1246. begin
  1247. case sym.typ of
  1248. varsym :
  1249. begin
  1250. if sym.owner.symtabletype in [localsymtable,parasymtable] then
  1251. Message(asmr_e_no_local_or_para_allowed);
  1252. hs:=tvarsym(sym).mangledname;
  1253. end;
  1254. typedconstsym :
  1255. hs:=ttypedconstsym(sym).mangledname;
  1256. procsym :
  1257. begin
  1258. if Tprocsym(sym).procdef_count>1 then
  1259. Message(asmr_w_calling_overload_func);
  1260. hs:=tprocsym(sym).first_procdef.mangledname;
  1261. end;
  1262. typesym :
  1263. begin
  1264. if not(ttypesym(sym).restype.def.deftype in [recorddef,objectdef]) then
  1265. Message(asmr_e_wrong_sym_type);
  1266. end;
  1267. else
  1268. Message(asmr_e_wrong_sym_type);
  1269. end;
  1270. end
  1271. else
  1272. Message1(sym_e_unknown_id,tempstr);
  1273. end;
  1274. { symbol found? }
  1275. if hs<>'' then
  1276. begin
  1277. if needofs and (prevtok<>AS_DOLLAR) then
  1278. Message(asmr_e_need_dollar);
  1279. if asmsym='' then
  1280. asmsym:=hs
  1281. else
  1282. Message(asmr_e_cant_have_multiple_relocatable_symbols);
  1283. if (expr='') or (expr[length(expr)]='+') then
  1284. begin
  1285. { don't remove the + if there could be a record field }
  1286. if actasmtoken<>AS_DOT then
  1287. delete(expr,length(expr),1);
  1288. end
  1289. else
  1290. Message(asmr_e_only_add_relocatable_symbol);
  1291. end;
  1292. if actasmtoken=AS_DOT then
  1293. begin
  1294. BuildRecordOffsetSize(tempstr,l,k);
  1295. str(l, tempstr);
  1296. expr:=expr + tempstr;
  1297. end
  1298. else
  1299. begin
  1300. if (expr='') or (expr[length(expr)] in ['+','-','/','*']) then
  1301. delete(expr,length(expr),1);
  1302. end;
  1303. end;
  1304. { check if there are wrong operator used like / or mod etc. }
  1305. if (hs<>'') and not(actasmtoken in [AS_MINUS,AS_PLUS,AS_COMMA,AS_SEPARATOR,AS_LPAREN,AS_END]) then
  1306. Message(asmr_e_only_add_relocatable_symbol);
  1307. end;
  1308. AS_END,
  1309. AS_SEPARATOR,
  1310. AS_COMMA:
  1311. break;
  1312. else
  1313. Begin
  1314. { write error only once. }
  1315. if not errorflag then
  1316. Message(asmr_e_invalid_constant_expression);
  1317. { consume tokens until we find COMMA or SEPARATOR }
  1318. Consume(actasmtoken);
  1319. errorflag:=TRUE;
  1320. end;
  1321. end;
  1322. Until false;
  1323. { calculate expression }
  1324. if not ErrorFlag then
  1325. value:=CalculateExpression(expr)
  1326. else
  1327. value:=0;
  1328. end;
  1329. function tattreader.BuildConstExpression(allowref,betweenbracket:boolean): longint;
  1330. var
  1331. l : longint;
  1332. hs : string;
  1333. begin
  1334. BuildConstSymbolExpression(allowref,betweenbracket,false,l,hs);
  1335. if hs<>'' then
  1336. Message(asmr_e_relocatable_symbol_not_allowed);
  1337. BuildConstExpression:=l;
  1338. end;
  1339. Procedure tattreader.BuildConstantOperand(oper : toperand);
  1340. var
  1341. l : longint;
  1342. tempstr : string;
  1343. begin
  1344. BuildConstSymbolExpression(false,false,true,l,tempstr);
  1345. if tempstr<>'' then
  1346. begin
  1347. oper.opr.typ:=OPR_SYMBOL;
  1348. oper.opr.symofs:=l;
  1349. oper.opr.symbol:=objectlibrary.newasmsymbol(tempstr);
  1350. end
  1351. else
  1352. begin
  1353. oper.opr.typ:=OPR_CONSTANT;
  1354. oper.opr.val:=l;
  1355. end;
  1356. end;
  1357. end.
  1358. {
  1359. $Log$
  1360. Revision 1.3 2003-11-17 23:23:47 florian
  1361. + first part of arm assembler reader
  1362. Revision 1.2 2003/11/15 19:00:10 florian
  1363. * fixed ppc assembler reader
  1364. Revision 1.1 2003/11/12 16:05:39 florian
  1365. * assembler readers OOPed
  1366. + typed currency constants
  1367. + typed 128 bit float constants if the CPU supports it
  1368. }