diff options
| author | Ajax <commial@gmail.com> | 2016-12-21 17:17:34 +0100 |
|---|---|---|
| committer | Ajax <commial@gmail.com> | 2017-01-04 17:14:55 +0100 |
| commit | 68e548b9b6c411cea13792a87291d0514fd45520 (patch) | |
| tree | cda7fa91c1d2ed6fdc6589da93c21a1399730f47 /miasm2/jitter/jitcore_llvm.py | |
| parent | d554129240394be47c9d99655e7d7feef5567795 (diff) | |
| download | miasm-68e548b9b6c411cea13792a87291d0514fd45520.tar.gz miasm-68e548b9b6c411cea13792a87291d0514fd45520.zip | |
Adapt codegen.CGen principles to LLVM
Diffstat (limited to 'miasm2/jitter/jitcore_llvm.py')
| -rw-r--r-- | miasm2/jitter/jitcore_llvm.py | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/miasm2/jitter/jitcore_llvm.py b/miasm2/jitter/jitcore_llvm.py index 88db199a..020f2d45 100644 --- a/miasm2/jitter/jitcore_llvm.py +++ b/miasm2/jitter/jitcore_llvm.py @@ -45,7 +45,7 @@ class JitCore_LLVM(jitcore.JitCore): pass # Create a context - self.context = LLVMContext_JIT(libs_to_load) + self.context = LLVMContext_JIT(libs_to_load, self.ir_arch) # Set the optimisation level self.context.optimise_level() @@ -64,17 +64,21 @@ class JitCore_LLVM(jitcore.JitCore): # Set IRs transformation to apply self.context.set_IR_transformation(self.ir_arch.expr_fix_regs_for_mode) - def jitirblocs(self, label, irblocs): + def add_bloc(self, block): + """Add a block to JiT and JiT it. + @block: the block to add + """ + # TODO: caching using hash # Build a function in the context - func = LLVMFunction(self.context, label.name) + func = LLVMFunction(self.context, block.label.name) # Set log level func.log_regs = self.log_regs func.log_mn = self.log_mn - # Import irblocs - func.from_blocs(irblocs) + # Import asm block + func.from_asmblock(block) # Verify if self.options["safe_mode"] is True: @@ -91,7 +95,7 @@ class JitCore_LLVM(jitcore.JitCore): print func.get_assembly() # Store a pointer on the function jitted code - self.lbl2jitbloc[label.offset] = func.get_function_pointer() + self.lbl2jitbloc[block.label.offset] = func.get_function_pointer() def jit_call(self, label, cpu, _vmmngr, breakpoints): """Call the function label with cpu and vmmngr states |