Mercurial > lcfOS
diff 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 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/python/ir/llvmtype.py Fri Feb 22 10:33:48 2013 +0100 @@ -0,0 +1,30 @@ + +def Enum(**enums): + return type('Enum', (), enums) + +typeID = Enum(Void=0, Double=3, Integer=10, Function=11, Struct=12, Array=13, Pointer=14, Vector=15) + +class llvmType: + def __init__(self, tid): + self.tid = tid + +class IntegerType(llvmType): + def __init__(self, bits): + super().__init__(typeID.Integer) + self.bits = bits + +class FunctionType(llvmType): + def __init__(self, resultType, parameterTypes): + super().__init__(typeID.Function) + assert type(parameterTypes) is list + self.resultType = resultType + self.returnType = resultType + self.parameterTypes = parameterTypes + +# Default types: +i8 = IntegerType(8) +i16 = IntegerType(16) +i32 = IntegerType(32) +void = llvmType(typeID.Void) + +