[prev] 1 [next]

Data Structures and MIPS

C data structures and their MIPS representations:
  • char ... as byte in memory, or low-order byte in register
  • int ... as one word in memory, or whole register
  • double ... as two words in memory, or $f? register
  • arrays ... sequence of memory bytes/words, accessed by index
  • structs ... chunk of memory, accessed by fields (in C) or offsets (in MIPS)
  • linked structures ... struct containing address of another struct
A char, int or double
  • could be implemented in register if used in small scope
  • could be implemented on stack if local to function
  • could be implemented in .data if need longer persistence/lifetime