home *** CD-ROM | disk | FTP | other *** search
/ APDL Public Domain 1 / APDL_PD1A.iso / program / assembler / as / src / h / reloc < prev    next >
Encoding:
Text File  |  1993-03-07  |  2.1 KB  |  62 lines

  1. /*
  2.  * reloc.h
  3.  * Copyright © 1992 Niklas Röjemo
  4.  */
  5.  
  6. #ifndef _reloc_h
  7. #define _reloc_h
  8.  
  9. #ifndef _symbol_h
  10. #include "symbol.h"
  11. #endif
  12.  
  13. #ifndef _value_h
  14. #include "value.h"
  15. #endif
  16.  
  17. typedef enum {
  18.         RelocShiftImm,      /* An immediate shift constant 0-32 may need patching of shiftop */
  19.         RelocImm8s4,        /* An immediate constant 8 bits rotated by 4 bits */
  20.         RelocImmFloat,      /* An immediate constant float (only 0.0 1.0 2.0, 3.0, 4.0, 5.0, 10.0 or 0.5) */
  21.         RelocBranch,        /* Branch immediate */
  22.         RelocSwi,           /* Swi immediate */
  23.         RelocCpuOffset,     /* An offset in ldr/str */
  24.         RelocCopOffset,     /* An offset in ldf/stf */
  25.         RelocAdr,           /* Used in pdeudoinstruction adr */
  26.         RelocImmN,          /* extra = 4: A word constant (linker can handle this) */
  27.                             /* extra = 2: A halfword constant, also used in ldm/stm with immediate mask */
  28.                             /* extra = 1: A byte constant */
  29.                             /* all others are illegal */
  30.         RelocFloat,         /* extra = 8: A double constant */
  31.                             /* extra = 4: A float constant */
  32.                             /* all others are illegal */
  33.         RelocNone           /* No relocation necessary */
  34. } RelocTag;
  35.  
  36. typedef struct RELOC {
  37.   struct RELOC *more;
  38.   RelocTag      Tag;
  39.   int           lineno;   /* For error messages */
  40.   int           offset;   /* Offset in area */
  41.   WORD          extra;    /* e.g. shiftop in ShiftImm, size in RelocImmN, e.t.c. */
  42.   Value         value;
  43. } Reloc;
  44.  
  45. char *reloc2String(RelocTag tag);
  46. int   relocFix(Symbol *area);
  47. void  relocOutput(FILE *outfile,Symbol *area);
  48.  
  49. void relocShiftImm(WORD shiftop, Value shift);
  50. void relocImm8s4(WORD ir,Value im8s4);
  51. void relocImmFloat(WORD ir,Value value);
  52. void relocBranch(Value offset);
  53. void relocSwi(Value code);
  54. void relocCopOffset(WORD ir,Value offset);
  55. void relocCpuOffset(WORD ir,Value offset);
  56. void relocAdr(WORD ir,Value addr);
  57. void relocMask(Value mask);
  58. void relocInt(int size, Value value);
  59. void relocFloat(int size, Value value);
  60. void relocAdd(Reloc *new);
  61. #endif
  62.