annotate python/ir/value.py @ 147:4e79484a9d47

Moved core to ir folder
author Windel Bouwman
date Fri, 22 Feb 2013 10:33:48 +0100
parents python/ppci/core/value.py@9e552d34bd60
children b28a11c01dbe
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