diff python/ppci/target/arm/__init__.py @ 356:52492b304adf

Added newline to print
author Windel Bouwman
date Fri, 14 Mar 2014 13:02:16 +0100
parents 5477e499b039
children 818be710e13d
line wrap: on
line diff
--- a/python/ppci/target/arm/__init__.py	Fri Mar 14 10:30:13 2014 +0100
+++ b/python/ppci/target/arm/__init__.py	Fri Mar 14 13:02:16 2014 +0100
@@ -5,6 +5,7 @@
 from ..arm.registers import register_range
 
 from .instructions import Dcd, Mov, Add, Sub, Orr1, Mul, Mov2, Add1, Mul1
+from .instructions import Lsr1, Lsl1, And1, Sub1
 from .instructions import B, Bl, Ble, Bgt, Beq, Blt, Cmp, Cmp2
 from .instructions import Push, Pop, Str, Ldr, Ldr3, Str1, Ldr1, Adr
 from .selector import ArmInstructionSelector
@@ -24,7 +25,10 @@
         self.add_lowering(Mov2, lambda im: Mov2(im.dst[0], im.src[0]))
         self.add_lowering(Cmp2, lambda im: Cmp2(im.src[0], im.src[1]))
         self.add_lowering(Add1, lambda im: Add1(im.dst[0], im.src[0], im.src[1]))
+        self.add_lowering(Sub1, lambda im: Sub1(im.dst[0], im.src[0], im.src[1]))
         self.add_lowering(Mul1, lambda im: Mul1(im.dst[0], im.src[0], im.src[1]))
+        self.add_lowering(Lsr1, lambda im: Lsr1(im.dst[0], im.src[0], im.src[1]))
+        self.add_lowering(And1, lambda im: And1(im.dst[0], im.src[0], im.src[1]))
 
     def make_parser(self):
         # Assembly grammar:
@@ -99,6 +103,18 @@
         self.add_instruction(['orr', 'reg', ',', 'reg', ',', 'reg'],
                 lambda rhs: Orr1(rhs[1], rhs[3], rhs[5]))
 
+        self.add_keyword('and')
+        self.add_instruction(['and', 'reg', ',', 'reg', ',', 'reg'],
+                lambda rhs: And1(rhs[1], rhs[3], rhs[5]))
+
+        self.add_keyword('lsr')
+        self.add_instruction(['lsr', 'reg', ',', 'reg', ',', 'reg'],
+                lambda rhs: Lsr1(rhs[1], rhs[3], rhs[5]))
+
+        self.add_keyword('lsl')
+        self.add_instruction(['lsl', 'reg', ',', 'reg', ',', 'reg'],
+                lambda rhs: Lsl1(rhs[1], rhs[3], rhs[5]))
+
 
         # Jumping:
         self.add_keyword('b')