github/workflows/pycopy-test: Upgrade Pycopy to 3.6.1.
[ScratchABlock.git] / arch_ppc32.py
blobc658c9970b5fca2e6ce9f39e1874cd3cd7bac3a9
1 from core import ADDR, REG
2 from archutils import *
5 BITNESS = 32
6 ENDIANNESS = "big"
8 ALL_REGS = {REG("r0"), REG("sp"), REG("rtoc")} | reg_range("r", 3, 31)
11 def call_params(addr):
12 return reg_range("r", 3, 10)
15 def param_filter(regs):
16 # Assume for now that all parameters will be passed in registers.
17 # This must be good enough to cover the most usage cases.
18 # The following cases will break it:
19 # - functions accepting more then 8 params
20 # - functions accepting floating-point params
21 # - variadic functions
22 return reg_continuous_subrange(regs, reg_range("r", 3, 10))
25 def call_ret(addr):
26 return {REG("r3")}
29 def ret_filter(regs):
30 # Assuming there is no floating-point stuff
31 return {REG("r3")}
34 def call_save(addr):
35 return reg_range("r", 13, 31) | {REG("sp")}
38 def call_defs(addr):
39 return call_ret(addr) | (ALL_REGS - call_save(addr))
42 def ret_uses(cfg):
43 return set()