Commit Graph

7 Commits

Author SHA1 Message Date
Alessandro Di Federico 810e477e2d Improve linking for libtinycode's helpers support
* Expand the function to replace with no-op or abort
* Factor out the code to replace function bodies (replaceFunction and
  replaceFunctionWithRet)
* Replace functions before linking, directly in the helper module
2016-01-04 21:33:45 +01:00
Alessandro Di Federico d684ea7ab1 Sync with the updated libtinycode interface 2016-01-04 21:20:38 +01:00
Alessandro Di Federico c9221fe8a0 Handle termination of a basic block after a call 2016-01-04 21:20:18 +01:00
Alessandro Di Federico 6338f3b0b8 Link with helpers and adjust their CPU state usage
* Move initialization and management of the structure describing the CPU
  state (CPUStateType) into variablemanager.cpp.
* Support parts of CPU state outside "env" (e.g. the MIPSCPU
  structure). Now "env" has an offset into the possibly larger CPU state
  which we have to take into account where appropriate (see
  VariableManager::envOffset).
* Link the helpers module into the generated module, including only what
  is needed.
* Create some "no-op" or "abort" function corresponding to QEMU functions
  not included in the helper module (e.g. logging and abort functions).
* Implement the CorrectCPUStateUsagePass pass, which starts from the
  "env" global variable and looks for all its usages recursively, keeping
  track of where pointers are pointing into the CPU state data structure,
  and replaces all the load/stores with the global variable corresponding
  to that specific field of the CPU state.
* After the linking phase, run SROA, the pass to adjust the CPU usage and
  DCE.
* Let global variables have common linkage.
2015-12-04 23:44:46 +01:00
Alessandro Di Federico a8075fcf4f Remove code to ignore first few PTC instructions
libtinycode no more emits initialization and finalization code that we
don't need.
2015-12-03 18:01:02 +01:00
Alessandro Di Federico 4e326f5799 Factorize LLVM-related helper functions 2015-12-03 17:59:32 +01:00
Alessandro Di Federico 5d130b7072 Split ptctollvmir.cpp into multiple files 2015-11-24 15:21:17 +01:00