cpubase.pas 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684
  1. {
  2. $Id$
  3. Copyright (c) 1998-2002 by Florian Klaempfl and Peter Vreman
  4. Contains the base types for the ARM
  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. {# Base unit for processor information. This unit contains
  19. enumerations of registers, opcodes, sizes, and other
  20. such things which are processor specific.
  21. }
  22. unit cpubase;
  23. {$i fpcdefs.inc}
  24. interface
  25. uses
  26. cutils,cclasses,
  27. globtype,globals,
  28. cpuinfo,
  29. aasmbase,
  30. cginfo
  31. {$ifdef delphi}
  32. ,dmisc
  33. {$endif}
  34. ;
  35. {*****************************************************************************
  36. Assembler Opcodes
  37. *****************************************************************************}
  38. type
  39. TAsmOp=(A_None,A_ADC,A_ADD,A_AND,A_N,A_BIC,A_BKPT,A_B,A_BL,A_BLX,A_BX,
  40. A_CDP,A_CDP2,A_CLZ,A_CMN,A_CMP,A_EOR,A_LDC,_A_LDC2,
  41. A_LDM,A_LDR,A_LDRB,A_LDRD,A_LDRBT,A_LDRH,A_LDRSB,
  42. A_LDRSH,A_LDRT,A_MCR,A_MCR2,A_MCRR,A_MLA,A_MOV,
  43. A_MRC,A_MRC2,A_MRRC,A_RS,A_MSR,A_MUL,A_MVN,
  44. A_ORR,A_PLD,A_QADD,A_QDADD,A_QDSUB,A_QSUB,A_RSB,A_RSC,
  45. A_SBC,A_SMLAL,A_SMULL,A_SMUL,
  46. A_SMULW,A_STC,A_STC2,A_STM,A_STR,A_STRB,A_STRBT,A_STRD,
  47. A_STRH,A_STRT,A_SUB,A_SWI,A_SWP,A_SWPB,A_TEQ,A_TST,
  48. A_UMLAL,A_UMULL,
  49. { FPA coprocessor instructions }
  50. A_LDF,A_STF,A_LFM,A_SFM,A_FLT,A_FIX,A_WFS,A_RFS,A_RFC,
  51. A_ADF,A_DVF,A_FDV,A_FML,A_FRD,A_MUF,A_POL,A_PW,A_RDF,
  52. A_RMF,A_RPW,A_RSF,A_SUF,A_ABS,A_ACS,A_ASN,A_ATN,A_COS,
  53. A_EXP,A_LOG,A_LGN,A_MVF,A_MNF,A_NRM,A_RND,A_SIN,A_SQT,A_TAN,A_URD,
  54. A_CMF,A_CNF
  55. { VPA coprocessor codes }
  56. );
  57. { This should define the array of instructions as string }
  58. op2strtable=array[tasmop] of string[11];
  59. Const
  60. { First value of opcode enumeration }
  61. firstop = low(tasmop);
  62. { Last value of opcode enumeration }
  63. lastop = high(tasmop);
  64. {*****************************************************************************
  65. Registers
  66. *****************************************************************************}
  67. type
  68. {# Enumeration for all possible registers for cpu. It
  69. is to note that all registers of the same type
  70. (for example all FPU registers), should be grouped
  71. together.
  72. }
  73. { don't change the order }
  74. { it's used by the register size conversions }
  75. toldregister = (R_NO,
  76. R_R0,R_R1,R_R2,R_R3,R_R4,R_R5,R_R6,R_R7,
  77. R_R8,R_R9,R_R10,R_R11,R_R12,R_R13,R_R14,R_PC,
  78. R_CPSR,
  79. { FPA registers }
  80. R_F0,R_F1,R_F2,R_F3,R_F4,R_F5,R_F6,R_F7,
  81. R_F8,R_F9,R_F10,R_F11,R_F12,R_F13,R_F14,R_F15,
  82. { VPA registers }
  83. R_S0,R_S1,R_S2,R_S3,R_S4,R_S5,R_S6,R_S7,
  84. R_S8,R_S9,R_S10,R_S11,R_S12,R_S13,R_S14,R_S15,
  85. R_S16,R_S17,R_S18,R_S19,R_S20,R_S21,R_S22,R_S23,
  86. R_S24,R_S25,R_S26,R_S27,R_S28,R_S29,R_S30,R_S31,
  87. R_D0,R_D1,R_D2,R_D3,R_D4,R_D5,R_D6,R_D7,
  88. R_D8,R_D9,R_D10,R_D11,R_D12,R_D13,R_D14,R_D15,
  89. R_INTREGISTER,R_FLOATREGISTER,R_MMXREGISTER,R_KNIREGISTER
  90. );
  91. const
  92. { special registers }
  93. { Invalid register }
  94. NR_NO = $0000;
  95. { Normal registers:}
  96. { General purpose registers }
  97. NR_R0 = $0100; NR_R1 = $0200; NR_R2 = $0300;
  98. NR_R3 = $0400; NR_R4 = $0500; NR_R5 = $0600;
  99. NR_R6 = $0700; NR_R7 = $0800; NR_R8 = $0900;
  100. NR_R9 = $0A00; NR_R10 = $0B00; NR_R11 = $0C00;
  101. NR_R12 = $0D00; NR_R13 = $0E00; NR_R14 = $0F00;
  102. NR_R15 = $1000;
  103. NR_PC = NR_R15;
  104. { Super registers: }
  105. RS_NONE=$00;
  106. RS_R0 = $01; RS_R1 = $02; RS_R2 = $03;
  107. RS_R3 = $04; RS_R4 = $05; RS_R5 = $06;
  108. RS_R6 = $07; RS_R7 = $08; RS_R8 = $09;
  109. RS_R9 = $0A; RS_R10 = $0B; RS_R11 = $0C;
  110. RS_R12 = $0D; RS_R13 = $0E; RS_R14 = $0F;
  111. RS_R15 = $10;
  112. RS_PC = RS_R15;
  113. first_supreg = RS_R0;
  114. last_supreg = RS_R15;
  115. { registers which may be destroyed by calls }
  116. VOLATILE_INTREGISTERS = [RS_R0..RS_R3];
  117. VOLATILE_FPUREGISTERS = [R_F0..R_F3];
  118. { Number of first and last imaginary register. }
  119. first_imreg = $21;
  120. last_imreg = $ff;
  121. { Subregisters, situation unknown!!.}
  122. R_SUBWHOLE=$00;
  123. R_SUBL=$00;
  124. type
  125. tnewregister=word;
  126. Tregister = packed record
  127. enum : Toldregister;
  128. { This is a word for now, change to cardinal
  129. when the old register coding is away.}
  130. number : Tnewregister;
  131. end;
  132. Tsuperregister = byte;
  133. Tsubregister = byte;
  134. { A type to store register locations for 64 Bit values. }
  135. tregister64 = packed record
  136. reglo,reghi : tregister;
  137. end;
  138. { alias for compact code }
  139. treg64 = tregister64;
  140. { Set type definition for registers }
  141. tregisterset = set of toldregister;
  142. tsupregset = set of tsuperregister;
  143. const
  144. { First register in the tregister enumeration }
  145. firstreg = low(toldregister);
  146. { Last register in the tregister enumeration }
  147. lastreg = R_D15;
  148. type
  149. { Type definition for the array of string of register names }
  150. reg2strtable = array[firstreg..lastreg] of string[6];
  151. regname2regnumrec = record
  152. name:string[6];
  153. number:Tnewregister;
  154. end;
  155. {*****************************************************************************
  156. Instruction post fixes
  157. *****************************************************************************}
  158. type
  159. { ARM instructions load/store and arithmetic instructions
  160. can have several instruction post fixes which are collected
  161. in this enumeration
  162. }
  163. TOpPostfix = (PF_None,
  164. { update condition flags
  165. or floating point single }
  166. PF_S,
  167. { floating point size }
  168. PF_D,PF_E,PF_P,FP_EP,
  169. { load/store }
  170. PF_B,PF_SB,PF_BT,PF_H,PF_SH,PF_T,
  171. { multiple load/store address modes }
  172. PF_IA,PF_IB,PF_DA,PF_DB,PF_DF,PF_FA,PF_ED,PF_EA
  173. );
  174. TRoundingMode = (RM_None,RM_P,RM_M,RM_Z);
  175. const
  176. oppostfix2str : array[TOpPostfix] of string[2] = ('',
  177. 's',
  178. 'd','e','p','ep',
  179. 'b','sb','bt','h','sh','t',
  180. 'ia','ib','da','db','df','fa','ed','ea');
  181. roundingmode2str : array[TRoundingMode] of string[1] = ('',
  182. 'p','m','z');
  183. {*****************************************************************************
  184. Conditions
  185. *****************************************************************************}
  186. type
  187. TAsmCond=(C_None,
  188. C_EQ,C_NE,C_CS,C_CC,C_MI,C_PL,C_VS,C_VC,C_HI,C_LS,
  189. C_GE,C_LT,C_GT,C_LE,C_AL,C_NV
  190. );
  191. const
  192. cond2str : array[TAsmCond] of string[2]=('',
  193. 'eq','ne','cs','cc','mi','pl','vs','vc','hi','ls',
  194. 'ge','lt','gt','le','al','nv'
  195. );
  196. inverse_cond : array[TAsmCond] of TAsmCond=(C_None,
  197. C_NE,C_EQ,C_CC,C_CS,C_PL,C_MI,C_VC,C_VS,C_LS,C_HI,
  198. C_LT,C_GE,C_LE,C_GT,C_None,C_None
  199. );
  200. {*****************************************************************************
  201. Flags
  202. *****************************************************************************}
  203. type
  204. TResFlags = (F_EQ,F_NE,F_CS,F_CC,F_MI,F_PL,F_VS,F_VC,F_HI,F_LS,
  205. F_GE,F_LT,F_GT,F_LE);
  206. {*****************************************************************************
  207. Reference
  208. *****************************************************************************}
  209. type
  210. trefoptions=(ref_none,ref_parafixup,ref_localfixup,ref_selffixup);
  211. taddressmode = (AM_OFFSET,AM_PREINDEXED,AM_POSTINDEXED);
  212. tshiftmode = (SM_LSL,SM_LSR,SM_ASR,SM_ROR,SM_RRX);
  213. { reference record }
  214. preference = ^treference;
  215. treference = packed record
  216. base,
  217. index : tregister;
  218. scalefactor : byte;
  219. offset : longint;
  220. symbol : tasmsymbol;
  221. offsetfixup : longint;
  222. options : trefoptions;
  223. addressmode : taddressmode;
  224. shiftmode : tshiftmode;
  225. end;
  226. { reference record }
  227. pparareference = ^tparareference;
  228. tparareference = packed record
  229. index : tregister;
  230. offset : longint;
  231. end;
  232. {*****************************************************************************
  233. Operands
  234. *****************************************************************************}
  235. { Types of operand }
  236. toptype=(top_none,top_reg,top_ref,top_const,top_symbol,top_regset,top_shifterop);
  237. tupdatereg = (UR_None,UR_Update);
  238. tshiftertype = (SO_None,SO_ASR,SO_LSL,SO_LSR,SO_ROR,SO_RRX);
  239. pshifterop = ^tshifterop;
  240. tshifterop = record
  241. shiftertype : tshiftertype;
  242. rs : tregister;
  243. shiftimm : byte;
  244. end;
  245. toper = record
  246. case typ : toptype of
  247. top_none : ();
  248. top_reg : (reg:tregister;update:tupdatereg);
  249. top_ref : (ref:preference);
  250. top_const : (val:aword);
  251. top_symbol : (sym:tasmsymbol;symofs:longint);
  252. top_regset : (regset:tsupregset);
  253. top_shifterop : (shifterop : pshifterop);
  254. end;
  255. {*****************************************************************************
  256. Generic Location
  257. *****************************************************************************}
  258. type
  259. { tparamlocation describes where a parameter for a procedure is stored.
  260. References are given from the caller's point of view. The usual
  261. TLocation isn't used, because contains a lot of unnessary fields.
  262. }
  263. tparalocation = packed record
  264. size : TCGSize;
  265. loc : TCGLoc;
  266. sp_fixup : longint;
  267. case TCGLoc of
  268. LOC_REFERENCE : (reference : tparareference);
  269. { segment in reference at the same place as in loc_register }
  270. LOC_REGISTER,LOC_CREGISTER : (
  271. case longint of
  272. 1 : (register,registerhigh : tregister);
  273. { overlay a registerlow }
  274. 2 : (registerlow : tregister);
  275. { overlay a 64 Bit register type }
  276. 3 : (reg64 : tregister64);
  277. 4 : (register64 : tregister64);
  278. );
  279. { it's only for better handling }
  280. LOC_MMXREGISTER,LOC_CMMXREGISTER : (mmxreg : tregister);
  281. end;
  282. tlocation = packed record
  283. loc : TCGLoc;
  284. size : TCGSize;
  285. case TCGLoc of
  286. LOC_FLAGS : (resflags : tresflags);
  287. LOC_CONSTANT : (
  288. case longint of
  289. 1 : (value : AWord);
  290. { can't do this, this layout depends on the host cpu. Use }
  291. { lo(valueqword)/hi(valueqword) instead (JM) }
  292. { 2 : (valuelow, valuehigh:AWord); }
  293. { overlay a complete 64 Bit value }
  294. 3 : (valueqword : qword);
  295. );
  296. LOC_CREFERENCE,
  297. LOC_REFERENCE : (reference : treference);
  298. { segment in reference at the same place as in loc_register }
  299. LOC_REGISTER,LOC_CREGISTER : (
  300. case longint of
  301. 1 : (register,registerhigh,segment : tregister);
  302. { overlay a registerlow }
  303. 2 : (registerlow : tregister);
  304. { overlay a 64 Bit register type }
  305. 3 : (reg64 : tregister64);
  306. 4 : (register64 : tregister64);
  307. );
  308. { it's only for better handling }
  309. LOC_MMXREGISTER,LOC_CMMXREGISTER : (mmxreg : tregister);
  310. end;
  311. {*****************************************************************************
  312. Constants
  313. *****************************************************************************}
  314. const
  315. { declare aliases }
  316. LOC_MMREGISTER = LOC_SSEREGISTER;
  317. LOC_CMMREGISTER = LOC_CSSEREGISTER;
  318. max_operands = 3;
  319. {# Constant defining possibly all registers which might require saving }
  320. ALL_REGISTERS = [firstreg..lastreg];
  321. general_registers = [R_R0..R_PC];
  322. general_superregisters = [RS_R0..RS_PC];
  323. {# low and high of the available maximum width integer general purpose }
  324. { registers }
  325. LoGPReg = R_R0;
  326. HiGPReg = R_R14;
  327. {# low and high of every possible width general purpose register (same as }
  328. { above on most architctures apart from the 80x86) }
  329. LoReg = R_R0;
  330. HiReg = R_R14;
  331. {# Table of registers which can be allocated by the code generator
  332. internally, when generating the code.
  333. }
  334. { legend: }
  335. { xxxregs = set of all possibly used registers of that type in the code }
  336. { generator }
  337. { usableregsxxx = set of all 32bit components of registers that can be }
  338. { possible allocated to a regvar or using getregisterxxx (this }
  339. { excludes registers which can be only used for parameter }
  340. { passing on ABI's that define this) }
  341. { c_countusableregsxxx = amount of registers in the usableregsxxx set }
  342. maxintregs = 15;
  343. maxintscratchregs = 2;
  344. intregs = [R_R0..R_R14];
  345. usableregsint = [RS_R4..RS_R10];
  346. c_countusableregsint = 7;
  347. maxfpuregs = 8;
  348. fpuregs = [R_F0..R_F7];
  349. usableregsfpu = [R_F4..R_F7];
  350. c_countusableregsfpu = 4;
  351. mmregs = [R_S0..R_D7];
  352. usableregsmm = [R_S16..R_S31];
  353. c_countusableregsmm = 16;
  354. {*****************************************************************************
  355. Operand Sizes
  356. *****************************************************************************}
  357. type
  358. topsize = (S_NO,
  359. S_B,S_W,S_L,S_BW,S_BL,S_WL,
  360. S_IS,S_IL,S_IQ,
  361. S_FS,S_FL,S_FX,S_D,S_Q,S_FV,S_FXX
  362. );
  363. {*****************************************************************************
  364. Registers
  365. *****************************************************************************}
  366. const
  367. { Standard opcode string table (for each tasmop enumeration). The
  368. opcode strings should conform to the names as defined by the
  369. processor manufacturer.
  370. }
  371. std_op2str : op2strtable = (
  372. '','adc','add','and','n','bic','bkpt','b','bl','blx','bx',
  373. 'cdp','cdp2','clz','cmn','cmp','eor','ldc','ldc2',
  374. 'ldm','ldr','ldrb','ldrd','ldrbt','ldrh','ldrsb',
  375. 'ldrsh','ldrt','mcr','mcr2','mcrr','mla','mov',
  376. 'mrc','mrc2','mrrc','rs','msr','mul','mvn',
  377. 'orr','pld','qadd','qdadd','qdsub','qsub','rsb','rsc',
  378. 'sbc','smlal','smull','smul',
  379. 'smulw','stc','stc2','stm','str','strb','strbt','strd',
  380. 'strh','strt','sub','swi','swp','swpb','teq','tst',
  381. 'umlal','umull',
  382. { FPA coprocessor codes }
  383. 'ldf','stf','lfm','sfm','flt','fix','wfs','rfs','rfc',
  384. 'adf','dvf','fdv','fml','frd','muf','pol','pw','rdf',
  385. 'rmf','rpw','rsf','suf','abs','acs','asn','atn','cos',
  386. 'exp','log','lgn','mvf','mnf','nrm','rnd','sin','sqt','tan','urd',
  387. 'cmf','cnf'
  388. { VPA coprocessor codes }
  389. );
  390. { Standard register table (for each tregister enumeration). The
  391. register strings should conform to the the names as defined
  392. by the processor manufacturer
  393. }
  394. std_reg2str : reg2strtable = ('',
  395. 'r0','r1','r2','r3','r4','r5','r6','r7',
  396. 'r8','r9','r10','r11','r12','r13','r14','pc',
  397. 'cpsr',
  398. { FPA registers }
  399. 'f0','f1','f2','f3','f4','f5','f6','f7',
  400. 'f8','f9','f10','f11','f12','f13','f14','f15',
  401. { VPA registers }
  402. 's0','s1','s2','s3','s4','s5','s6','s7',
  403. 's8','s9','s10','s11','s12','s13','s14','s15',
  404. 's16','s17','s18','s19','s20','s21','s22','s23',
  405. 's24','s25','s26','s27','s28','s29','s30','s31',
  406. 'd0','d1','d2','d3','d4','d5','d6','d7',
  407. 'd8','d9','d10','d11','d12','d13','d14','d15'
  408. );
  409. {*****************************************************************************
  410. Constants
  411. *****************************************************************************}
  412. firstsaveintreg = R_R4;
  413. lastsaveintreg = R_R10;
  414. firstsavefpureg = R_F4;
  415. lastsavefpureg = R_F7;
  416. firstsavemmreg = R_S16;
  417. lastsavemmreg = R_S31;
  418. //!!! general_registers = [R_EAX,R_EBX,R_ECX,R_EDX];
  419. //!!! general_superregisters = [RS_EAX,RS_EBX,RS_ECX,RS_EDX];
  420. //!!! usableregsint = [first_imreg..last_imreg];
  421. //!!! c_countusableregsint = 4;
  422. maxaddrregs = 0;
  423. addrregs = [];
  424. usableregsaddr = [];
  425. c_countusableregsaddr = 0;
  426. maxvarregs = 7;
  427. varregs : Array [1..maxvarregs] of Tnewregister =
  428. (RS_R4,RS_R5,RS_R6,RS_R7,RS_R8,RS_R9,RS_R10);
  429. maxfpuvarregs = 4;
  430. fpuvarregs : Array [1..maxfpuvarregs] of Toldregister =
  431. (R_F4,R_F5,R_F6,R_F7);
  432. {*****************************************************************************
  433. GDB Information
  434. *****************************************************************************}
  435. {
  436. I don't know where I could get this information for the arm
  437. }
  438. stab_regindex : array[0..0] of shortint =
  439. (0
  440. );
  441. {*****************************************************************************
  442. Default generic sizes
  443. *****************************************************************************}
  444. { Defines the default address size for a processor, }
  445. OS_ADDR = OS_32;
  446. { the natural int size for a processor, }
  447. OS_INT = OS_32;
  448. { the maximum float size for a processor, }
  449. OS_FLOAT = OS_F64;
  450. { the size of a vector register for a processor }
  451. OS_VECTOR = OS_M32;
  452. {*****************************************************************************
  453. Generic Register names
  454. *****************************************************************************}
  455. { Stack pointer register }
  456. NR_STACK_POINTER_REG = NR_R13;
  457. RS_STACK_POINTER_REG = RS_R13;
  458. { Frame pointer register }
  459. frame_pointer_reg = R_R11;
  460. RS_FRAME_POINTER_REG = RS_R11;
  461. NR_FRAME_POINTER_REG = NR_R11;
  462. { Register for addressing absolute data in a position independant way,
  463. such as in PIC code. The exact meaning is ABI specific. For
  464. further information look at GCC source : PIC_OFFSET_TABLE_REGNUM
  465. }
  466. NR_PIC_OFFSET_REG = NR_R9;
  467. { Results are returned in this register (32-bit values) }
  468. NR_FUNCTION_RETURN_REG = NR_R0;
  469. RS_FUNCTION_RETURN_REG = RS_R0;
  470. { Low part of 64bit return value }
  471. NR_FUNCTION_RETURN64_LOW_REG = NR_R0;
  472. RS_FUNCTION_RETURN64_LOW_REG = RS_R0;
  473. { High part of 64bit return value }
  474. NR_FUNCTION_RETURN64_HIGH_REG = NR_R1;
  475. RS_FUNCTION_RETURN64_HIGH_REG = RS_R1;
  476. { The value returned from a function is available in this register }
  477. NR_FUNCTION_RESULT_REG = NR_FUNCTION_RETURN_REG;
  478. RS_FUNCTION_RESULT_REG = RS_FUNCTION_RETURN_REG;
  479. { The lowh part of 64bit value returned from a function }
  480. NR_FUNCTION_RESULT64_LOW_REG = NR_FUNCTION_RETURN64_LOW_REG;
  481. RS_FUNCTION_RESULT64_LOW_REG = RS_FUNCTION_RETURN64_LOW_REG;
  482. { The high part of 64bit value returned from a function }
  483. NR_FUNCTION_RESULT64_HIGH_REG = NR_FUNCTION_RETURN64_HIGH_REG;
  484. RS_FUNCTION_RESULT64_HIGH_REG = RS_FUNCTION_RETURN64_HIGH_REG;
  485. fpu_result_reg = R_F0;
  486. //!!! mmresultreg = R_MM0;
  487. { Offset where the parent framepointer is pushed }
  488. PARENT_FRAMEPOINTER_OFFSET = 0;
  489. {*****************************************************************************
  490. GCC /ABI linking information
  491. *****************************************************************************}
  492. const
  493. { Registers which must be saved when calling a routine declared as
  494. cppdecl, cdecl, stdcall, safecall, palmossyscall. The registers
  495. saved should be the ones as defined in the target ABI and / or GCC.
  496. This value can be deduced from the CALLED_USED_REGISTERS array in the
  497. GCC source.
  498. }
  499. std_saved_registers = [R_R4..R_R10];
  500. { Required parameter alignment when calling a routine declared as
  501. stdcall and cdecl. The alignment value should be the one defined
  502. by GCC or the target ABI.
  503. The value of this constant is equal to the constant
  504. PARM_BOUNDARY / BITS_PER_UNIT in the GCC source.
  505. }
  506. std_param_align = 4;
  507. {*****************************************************************************
  508. Helpers
  509. *****************************************************************************}
  510. procedure convert_register_to_enum(var r:Tregister);
  511. function cgsize2subreg(s:Tcgsize):Tsubregister;
  512. function reg2opsize(r:tregister):topsize;
  513. function is_calljmp(o:tasmop):boolean;
  514. procedure inverse_flags(var f: TResFlags);
  515. function flags_to_cond(const f: TResFlags) : TAsmCond;
  516. function supreg_name(r:Tsuperregister):string;
  517. procedure shifterop_reset(var so : tshifterop);
  518. implementation
  519. procedure convert_register_to_enum(var r:Tregister);
  520. begin
  521. end;
  522. function cgsize2subreg(s:Tcgsize):Tsubregister;
  523. begin
  524. end;
  525. function reg2opsize(r:tregister):topsize;
  526. begin
  527. end;
  528. function is_calljmp(o:tasmop):boolean;
  529. begin
  530. { This isn't 100% perfect because the arm allows jumps also by writing to PC=R15.
  531. To overcome this problem we simply forbid that FPC generates jumps by loading R15 }
  532. is_calljmp:= o in [A_B,A_BL,A_BX,A_BLX];
  533. end;
  534. procedure inverse_flags(var f: TResFlags);
  535. begin
  536. end;
  537. function flags_to_cond(const f: TResFlags) : TAsmCond;
  538. begin
  539. end;
  540. function supreg_name(r:Tsuperregister):string;
  541. begin
  542. end;
  543. procedure shifterop_reset(var so : tshifterop);
  544. begin
  545. FillChar(so,sizeof(so),0);
  546. end;
  547. end.
  548. {
  549. $Log$
  550. Revision 1.7 2003-08-25 23:20:38 florian
  551. + started to implement FPU support for the ARM
  552. * fixed a lot of other things
  553. Revision 1.6 2003/08/24 12:27:26 florian
  554. * continued to work on the arm port
  555. Revision 1.5 2003/08/21 03:14:00 florian
  556. * arm compiler can be compiled; far from being working
  557. Revision 1.4 2003/08/20 15:50:13 florian
  558. * more arm stuff
  559. Revision 1.3 2003/08/16 13:23:01 florian
  560. * several arm related stuff fixed
  561. Revision 1.2 2003/07/26 00:55:57 florian
  562. * basic stuff fixed
  563. Revision 1.1 2003/07/21 16:35:30 florian
  564. * very basic stuff for the arm
  565. }