261
|
1 import struct
|
290
|
2 from .basetarget import Register, Instruction, Target, Label, LabelRef
|
|
3 from .basetarget import Imm32, Imm8, Imm7, Imm3
|
292
|
4 from .arminstructions import allins, Reg8Op, ArmRegister
|
340
|
5 from .arminstructions import thumb_assembly_rules
|
202
|
6
|
322
|
7 from .armframe import ArmFrame
|
|
8 from .arminstructionselector import ArmInstructionSelector
|
290
|
9
|
|
10 """ ARM target description. """
|
287
|
11
|
218
|
12 # TODO: encode this in DSL (domain specific language)
|
275
|
13 # TBD: is this required?
|
292
|
14 # TODO: make a difference between armv7 and armv5?
|
219
|
15
|
277
|
16
|
340
|
17 class ArmThumbTarget(Target):
|
292
|
18 def __init__(self):
|
340
|
19 super().__init__('arm_thumb')
|
292
|
20 for i in allins:
|
|
21 self.addInstruction(i)
|
|
22 # TODO: fix this nicer?
|
|
23 #setattr(self, i.__name__, i)
|
|
24 self.check()
|
322
|
25 self.ins_sel = ArmInstructionSelector()
|
|
26 self.FrameClass = ArmFrame
|
340
|
27 self.assembler_rules = thumb_assembly_rules
|
|
28
|
|
29
|
|
30 class ArmArmTarget(Target):
|
|
31 def __init__(self):
|
|
32 super().__init__('arm_arm')
|
|
33
|