annotate python/ppci/core/value.py @ 113:1f40be088ee8

Added first start stlink
author Windel Bouwman
date Sat, 05 Jan 2013 00:06:27 +0100
parents 9e552d34bd60
children
rev   line source
70
35286e8abd03 Added some llvm classes
windel
parents:
diff changeset
1
35286e8abd03 Added some llvm classes
windel
parents:
diff changeset
2 class Value:
110
9e552d34bd60 Work on compiler
Windel Bouwman
parents: 104
diff changeset
3 def __init__(self, vty=None):
9e552d34bd60 Work on compiler
Windel Bouwman
parents: 104
diff changeset
4 self.valueType = vty
70
35286e8abd03 Added some llvm classes
windel
parents:
diff changeset
5 self.name = None
35286e8abd03 Added some llvm classes
windel
parents:
diff changeset
6 def getContext(self):
35286e8abd03 Added some llvm classes
windel
parents:
diff changeset
7 return self.valueType.context
104
ed230e947dc6 Added hexviewer
windel
parents: 95
diff changeset
8 def dump(self):
ed230e947dc6 Added hexviewer
windel
parents: 95
diff changeset
9 print(self)
70
35286e8abd03 Added some llvm classes
windel
parents:
diff changeset
10
110
9e552d34bd60 Work on compiler
Windel Bouwman
parents: 104
diff changeset
11 def getName(self):
9e552d34bd60 Work on compiler
Windel Bouwman
parents: 104
diff changeset
12 return self.name
70
35286e8abd03 Added some llvm classes
windel
parents:
diff changeset
13 def setName(self, name):
35286e8abd03 Added some llvm classes
windel
parents:
diff changeset
14 if not self.name and not name:
35286e8abd03 Added some llvm classes
windel
parents:
diff changeset
15 return
35286e8abd03 Added some llvm classes
windel
parents:
diff changeset
16 self.name = name
35286e8abd03 Added some llvm classes
windel
parents:
diff changeset
17
35286e8abd03 Added some llvm classes
windel
parents:
diff changeset
18 if self.st:
35286e8abd03 Added some llvm classes
windel
parents:
diff changeset
19 pass
35286e8abd03 Added some llvm classes
windel
parents:
diff changeset
20 else:
35286e8abd03 Added some llvm classes
windel
parents:
diff changeset
21 pass
110
9e552d34bd60 Work on compiler
Windel Bouwman
parents: 104
diff changeset
22 Name = property(getName, setName)
70
35286e8abd03 Added some llvm classes
windel
parents:
diff changeset
23
110
9e552d34bd60 Work on compiler
Windel Bouwman
parents: 104
diff changeset
24 class Constant(Value):
9e552d34bd60 Work on compiler
Windel Bouwman
parents: 104
diff changeset
25 def __init__(self, value, vty):
9e552d34bd60 Work on compiler
Windel Bouwman
parents: 104
diff changeset
26 super().__init__(vty)
9e552d34bd60 Work on compiler
Windel Bouwman
parents: 104
diff changeset
27 self.value = value
9e552d34bd60 Work on compiler
Windel Bouwman
parents: 104
diff changeset
28 print('new constant value: ', value)
9e552d34bd60 Work on compiler
Windel Bouwman
parents: 104
diff changeset
29