Mercurial > lcfOS
view python/ir/llvmtype.py @ 149:74241ca312cc
Fixes on parser and semantics
author | Windel Bouwman |
---|---|
date | Fri, 01 Mar 2013 11:43:52 +0100 |
parents | 4e79484a9d47 |
children | 1b4a85bdd99c |
line wrap: on
line source
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)