ld-cache.h 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. /* This file is part of the program psim.
  2. Copyright 1994, 1995, 1996, 1997, 2003, Andrew Cagney
  3. This program is free software; you can redistribute it and/or modify
  4. it under the terms of the GNU General Public License as published by
  5. the Free Software Foundation; either version 3 of the License, or
  6. (at your option) any later version.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. GNU General Public License for more details.
  11. You should have received a copy of the GNU General Public License
  12. along with this program; if not, see <http://www.gnu.org/licenses/>.
  13. */
  14. /* Instruction unpacking:
  15. Once the instruction has been decoded, the register (and other)
  16. fields within the instruction need to be extracted.
  17. The table that follows determines how each field should be treated.
  18. Importantly it considers the case where the extracted field is to
  19. be used immediately or stored in an instruction cache.
  20. <type>
  21. Indicates what to do with the cache entry. If a cache is to be
  22. used. SCRATCH and CACHE values are defined when a cache entry is
  23. being filled while CACHE and COMPUTE values are defined in the
  24. semantic code.
  25. Zero marks the end of the table. More importantly 1. indicates
  26. that the entry is valid and can be cached. 2. indicates that that
  27. the entry is valid but can not be cached.
  28. <field_name>
  29. The field name as given in the instruction spec.
  30. <derived_name>
  31. A new name for <field_name> once it has been extracted from the
  32. instruction (and possibly stored in the instruction cache).
  33. <type>
  34. String specifying the storage type for <new_name> (the extracted
  35. field>.
  36. <expression>
  37. Specifies how to get <new_name> from <old_name>. If null, old and
  38. new name had better be the same. */
  39. typedef enum {
  40. scratch_value,
  41. cache_value,
  42. compute_value,
  43. } cache_rule_type;
  44. typedef struct _cache_table cache_table;
  45. struct _cache_table {
  46. cache_rule_type type;
  47. const char *field_name;
  48. const char *derived_name;
  49. const char *type_def;
  50. const char *expression;
  51. table_entry *file_entry;
  52. cache_table *next;
  53. };
  54. extern cache_table *load_cache_table
  55. (const char *file_name,
  56. int hi_bit_nr);
  57. extern void append_cache_rule
  58. (cache_table **table,
  59. const char *type,
  60. const char *field_name,
  61. const char *derived_name,
  62. const char *type_def,
  63. const char *expression,
  64. table_entry *file_entry);