axe_array.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. /*
  2. * Andrea Di Biagio
  3. * Politecnico di Milano, 2007
  4. *
  5. * axe_array.h
  6. * Formal Languages & Compilers Machine, 2007/2008
  7. *
  8. */
  9. #ifndef _AXE_ARRAY_H
  10. #define _AXE_ARRAY_H
  11. #include "axe_engine.h"
  12. #include "axe_struct.h"
  13. /* This function generates instructions that load the content of
  14. * an element of an array in a register. This function takes as
  15. * input: a variable identifier (ID) that refers to an array
  16. * value; an index value that refers to a specific element of
  17. * the array. It returns the location identifier for the
  18. * register that will contain the value of the array element at
  19. * position `index'. `index' is an expression: its value can be
  20. * either a register location (i.e., the value of `index' is
  21. * stored inside a register) or an immediate value. */
  22. extern int loadArrayElement(t_program_infos *program
  23. , char *ID, t_axe_expression index);
  24. /* This function generates instructions that load the address of
  25. * an element of an array in a regester. This function takes as
  26. * input: a variable identifier (ID) that refers to an array
  27. * value; an index value that refers to a specific element of
  28. * the array. It returns the location identifier for the
  29. * register that will contain the address of the array element
  30. * at position `index'. `index' is an expression: its value can
  31. * be either a register location (i.e., the value of `index' is
  32. * stored inside a register) or an immediate value. */
  33. extern int loadArrayAddress(t_program_infos *program
  34. , char *ID, t_axe_expression index);
  35. /* This function generates instructions that store a value
  36. * specified by `data' into the element at position `index' of
  37. * the array `ID'. This function takes as input: a variable
  38. * identifier (ID) that refers to an array value; an index value
  39. * that refers to a specific element of the array; a value to be
  40. * stored (data). `data' and `index' are expressions: their
  41. * value can be either register locations (i.e. their values are
  42. * stored inside a register) or immediate values. */
  43. extern void storeArrayElement(t_program_infos *program, char *ID
  44. , t_axe_expression index, t_axe_expression data);
  45. #endif