public static void Init(LLVM.Module module, LLVM.Builder builder) { if (_module == null) { _module = module; _builder = builder; _types = new Dictionary <TypeReference, CodeGenType>(); _methods = new Dictionary <MethodReference, MethodData>(); } }
//private Dictionary<MethodReference, MethodData> _methods; public Module(ModuleDefinition cilModule, string target) { this._cilModule = cilModule; this._target = target; this._llModule = new LLVM.Module(cilModule.Name); this._llModule.TargetTriple = target; CLR.Initialize(this._llModule); _types = new Dictionary<TypeReference, Type>(); //_methods = new Dictionary<MethodReference, MethodData>(); }
//private Dictionary<MethodReference, MethodData> _methods; public Module(ModuleDefinition cilModule, string target) { this._cilModule = cilModule; this._target = target; this._llModule = new LLVM.Module(cilModule.Name); this._llModule.TargetTriple = target; CLR.Initialize(this._llModule); _types = new Dictionary <TypeReference, Type>(); //_methods = new Dictionary<MethodReference, MethodData>(); }
public void Run() { Lexer lexer = new Lexer(Console.In); m_parser = new Parser(lexer); using(LLVM.Module module = new LLVM.Module("my cool jit")) using(m_builder = new LLVM.IRBuilder()) { CodeGenManager.Module = module; m_engine = new LLVM.ExecutionEngine(module); m_passMgr = new LLVM.PassManager(module); m_passMgr.AddTargetData(m_engine.GetTargetData()); m_passMgr.AddBasicAliasAnalysisPass(); m_passMgr.AddPromoteMemoryToRegisterPass(); m_passMgr.AddInstructionCombiningPass(); m_passMgr.AddReassociatePass(); m_passMgr.AddGVNPass(); m_passMgr.AddCFGSimplificationPass(); m_passMgr.Initialize(); while(true) { Console.Write("ready>"); switch(m_parser.GetNextToken()) { case TokenCode.Eof: // Continnue and consume new commands // module.Dump(); break; case TokenCode.Def: HandleDefinition(); break; case TokenCode.Symbol: if(m_parser.Token.IdentiferText == ";") m_parser.GetNextToken(); else HandleTopLevelExpression(); break; default: HandleTopLevelExpression(); break; } } } }
public void Run() { Lexer lexer = new Lexer(Console.In); m_parser = new Parser(lexer); using(LLVM.Module module = new LLVM.Module("my cool jit")) using(m_builder = new LLVM.IRBuilder()) { CodeGenManager.Module = module; while(true) { Console.Write("ready>"); switch(m_parser.GetNextToken()) { case TokenCode.Eof: module.Dump(); return; case TokenCode.Def: HandleDefinition(); break; case TokenCode.Unknown: if(m_parser.Token.IdentiferText == ";") m_parser.GetNextToken(); else HandleTopLevelExpression(); break; default: HandleTopLevelExpression(); break; } } module.Dump(); } }
public MethodData(MethodReference method, LLVM.Module module) { _method = method; _module = module; }
public static void Init(LLVM.Module module, LLVM.Builder builder) { if (_module == null) { _module = module; _builder = builder; _types = new Dictionary<TypeReference, CodeGenType>(); _methods = new Dictionary<MethodReference, MethodData>(); } }