Mercurial > lcfOS
comparison python/ir/llvmtype.py @ 147:4e79484a9d47
Moved core to ir folder
author | Windel Bouwman |
---|---|
date | Fri, 22 Feb 2013 10:33:48 +0100 |
parents | python/ppci/core/llvmtype.py@9e552d34bd60 |
children | 1b4a85bdd99c |
comparison
equal
deleted
inserted
replaced
146:91af0e40f868 | 147:4e79484a9d47 |
---|---|
1 | |
2 def Enum(**enums): | |
3 return type('Enum', (), enums) | |
4 | |
5 typeID = Enum(Void=0, Double=3, Integer=10, Function=11, Struct=12, Array=13, Pointer=14, Vector=15) | |
6 | |
7 class llvmType: | |
8 def __init__(self, tid): | |
9 self.tid = tid | |
10 | |
11 class IntegerType(llvmType): | |
12 def __init__(self, bits): | |
13 super().__init__(typeID.Integer) | |
14 self.bits = bits | |
15 | |
16 class FunctionType(llvmType): | |
17 def __init__(self, resultType, parameterTypes): | |
18 super().__init__(typeID.Function) | |
19 assert type(parameterTypes) is list | |
20 self.resultType = resultType | |
21 self.returnType = resultType | |
22 self.parameterTypes = parameterTypes | |
23 | |
24 # Default types: | |
25 i8 = IntegerType(8) | |
26 i16 = IntegerType(16) | |
27 i32 = IntegerType(32) | |
28 void = llvmType(typeID.Void) | |
29 | |
30 |