annotate python/target/armtarget.py @ 340:c7cc54c0dfdf devel

Test featurebranch
author Windel Bouwman
date Sun, 23 Feb 2014 16:24:01 +0100
parents 6f4753202b9a
children 4d204f6f7d4e
rev   line source
261
444b9df2ed99 try to split up code generation
Windel Bouwman
parents: 258
diff changeset
1 import struct
290
7b38782ed496 File moves
Windel Bouwman
parents: 287
diff changeset
2 from .basetarget import Register, Instruction, Target, Label, LabelRef
7b38782ed496 File moves
Windel Bouwman
parents: 287
diff changeset
3 from .basetarget import Imm32, Imm8, Imm7, Imm3
292
534b94b40aa8 Fixup reorganize
Windel Bouwman
parents: 290
diff changeset
4 from .arminstructions import allins, Reg8Op, ArmRegister
340
c7cc54c0dfdf Test featurebranch
Windel Bouwman
parents: 334
diff changeset
5 from .arminstructions import thumb_assembly_rules
202
f22b431f4113 Added arm add instruction
Windel Bouwman
parents:
diff changeset
6
322
44f336460c2a Half of use of burg spec for arm
Windel Bouwman
parents: 292
diff changeset
7 from .armframe import ArmFrame
44f336460c2a Half of use of burg spec for arm
Windel Bouwman
parents: 292
diff changeset
8 from .arminstructionselector import ArmInstructionSelector
290
7b38782ed496 File moves
Windel Bouwman
parents: 287
diff changeset
9
7b38782ed496 File moves
Windel Bouwman
parents: 287
diff changeset
10 """ ARM target description. """
287
1c7c1e619be8 File movage
Windel Bouwman
parents: 280
diff changeset
11
218
494828a7adf1 added some sort of cache to assembler
Windel Bouwman
parents: 216
diff changeset
12 # TODO: encode this in DSL (domain specific language)
275
6f2423df0675 Fixed serve arm-as
Windel Bouwman
parents: 268
diff changeset
13 # TBD: is this required?
292
534b94b40aa8 Fixup reorganize
Windel Bouwman
parents: 290
diff changeset
14 # TODO: make a difference between armv7 and armv5?
219
1fa3e0050b49 Expanded ad hoc code generator
Windel Bouwman
parents: 218
diff changeset
15
277
046017431c6a Started register allocator
Windel Bouwman
parents: 276
diff changeset
16
340
c7cc54c0dfdf Test featurebranch
Windel Bouwman
parents: 334
diff changeset
17 class ArmThumbTarget(Target):
292
534b94b40aa8 Fixup reorganize
Windel Bouwman
parents: 290
diff changeset
18 def __init__(self):
340
c7cc54c0dfdf Test featurebranch
Windel Bouwman
parents: 334
diff changeset
19 super().__init__('arm_thumb')
292
534b94b40aa8 Fixup reorganize
Windel Bouwman
parents: 290
diff changeset
20 for i in allins:
534b94b40aa8 Fixup reorganize
Windel Bouwman
parents: 290
diff changeset
21 self.addInstruction(i)
534b94b40aa8 Fixup reorganize
Windel Bouwman
parents: 290
diff changeset
22 # TODO: fix this nicer?
534b94b40aa8 Fixup reorganize
Windel Bouwman
parents: 290
diff changeset
23 #setattr(self, i.__name__, i)
534b94b40aa8 Fixup reorganize
Windel Bouwman
parents: 290
diff changeset
24 self.check()
322
44f336460c2a Half of use of burg spec for arm
Windel Bouwman
parents: 292
diff changeset
25 self.ins_sel = ArmInstructionSelector()
44f336460c2a Half of use of burg spec for arm
Windel Bouwman
parents: 292
diff changeset
26 self.FrameClass = ArmFrame
340
c7cc54c0dfdf Test featurebranch
Windel Bouwman
parents: 334
diff changeset
27 self.assembler_rules = thumb_assembly_rules
c7cc54c0dfdf Test featurebranch
Windel Bouwman
parents: 334
diff changeset
28
c7cc54c0dfdf Test featurebranch
Windel Bouwman
parents: 334
diff changeset
29
c7cc54c0dfdf Test featurebranch
Windel Bouwman
parents: 334
diff changeset
30 class ArmArmTarget(Target):
c7cc54c0dfdf Test featurebranch
Windel Bouwman
parents: 334
diff changeset
31 def __init__(self):
c7cc54c0dfdf Test featurebranch
Windel Bouwman
parents: 334
diff changeset
32 super().__init__('arm_arm')
c7cc54c0dfdf Test featurebranch
Windel Bouwman
parents: 334
diff changeset
33