summaryrefslogtreecommitdiff
path: root/util/cpt_upgraders/arm-ccregs.py
blob: 2e3cf1ac2f426d12bfaa5905e765220de8bd78e4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# Use condition code registers for the ARM architecture.
# Previously the integer register file was used for these registers.
def upgrader(cpt):
    if cpt.get('root','isa') == 'arm':
        for sec in cpt.sections():
            import re

            re_cpu_match = re.match('^(.*sys.*\.cpu[^.]*)\.xc\.(.+)$', sec)
            # Search for all the execution contexts
            if not re_cpu_match:
                continue

            items = []
            for (item,value) in cpt.items(sec):
                items.append(item)
            if 'ccRegs' not in items:
                intRegs = cpt.get(sec, 'intRegs').split()

                # Move those 5 integer registers to the ccRegs register file
                ccRegs = intRegs[38:43]
                del      intRegs[38:43]

                ccRegs.append('0') # CCREG_ZERO

                cpt.set(sec, 'intRegs', ' '.join(intRegs))
                cpt.set(sec, 'ccRegs',  ' '.join(ccRegs))

legacy_version = 13