Mercurial > lcfOS
comparison python/ppci/target/basetarget.py @ 362:c05ab629976a
Added CPUID for arm
author | Windel Bouwman |
---|---|
date | Sat, 15 Mar 2014 10:56:34 +0100 |
parents | 5477e499b039 |
children | 396e5cefba13 |
comparison
equal
deleted
inserted
replaced
361:614a7f6d4d4d | 362:c05ab629976a |
---|---|
1 import types | |
1 from ppci import CompilerError | 2 from ppci import CompilerError |
2 | 3 |
3 """ | 4 """ |
4 Base classes for defining a target | 5 Base classes for defining a target |
5 """ | 6 """ |
122 | 123 |
123 def add_instruction(self, rhs, f): | 124 def add_instruction(self, rhs, f): |
124 self.add_rule('instruction', rhs, f) | 125 self.add_rule('instruction', rhs, f) |
125 | 126 |
126 def add_rule(self, lhs, rhs, f): | 127 def add_rule(self, lhs, rhs, f): |
127 self.assembler_rules.append((lhs, rhs, f)) | 128 if type(f) is int: |
129 f2 = lambda x: f | |
130 else: | |
131 f2 = f | |
132 assert type(f2) is types.FunctionType | |
133 self.assembler_rules.append((lhs, rhs, f2)) | |
128 | 134 |
129 def lower_frame_to_stream(self, frame, outs): | 135 def lower_frame_to_stream(self, frame, outs): |
130 """ Lower instructions from frame to output stream """ | 136 """ Lower instructions from frame to output stream """ |
131 for im in frame.instructions: | 137 for im in frame.instructions: |
132 if isinstance(im.assem, Instruction): | 138 if isinstance(im.assem, Instruction): |