70
|
1
|
|
2 def Enum(**enums):
|
|
3 return type('Enum', (), enums)
|
|
4
|
104
|
5 typeID = Enum(Void=0, Double=3, Integer=10, Function=11, Struct=12, Array=13, Pointer=14, Vector=15)
|
|
6
|
70
|
7 class llvmType:
|
110
|
8 def __init__(self, tid):
|
107
|
9 self.tid = tid
|
70
|
10
|
104
|
11 class IntegerType(llvmType):
|
110
|
12 def __init__(self, bits):
|
|
13 super().__init__(typeID.Integer)
|
104
|
14 self.bits = bits
|
70
|
15
|
104
|
16 class FunctionType(llvmType):
|
|
17 def __init__(self, resultType, parameterTypes):
|
110
|
18 super().__init__(typeID.Function)
|
|
19 assert type(parameterTypes) is list
|
104
|
20 self.resultType = resultType
|
106
|
21 self.returnType = resultType
|
104
|
22 self.parameterTypes = parameterTypes
|
|
23
|
110
|
24 # Default types:
|
|
25 i8 = IntegerType(8)
|
|
26 i16 = IntegerType(16)
|
|
27 i32 = IntegerType(32)
|
|
28 void = llvmType(typeID.Void)
|
|
29
|
|
30
|