Miasm2
 All Classes Namespaces Files Functions Variables Typedefs Properties Macros
Public Member Functions | Public Attributes | Static Public Attributes | List of all members
miasm2.jitter.llvmconvert.LLVMContext Class Reference
+ Inheritance diagram for miasm2.jitter.llvmconvert.LLVMContext:
+ Collaboration diagram for miasm2.jitter.llvmconvert.LLVMContext:

Public Member Functions

def __init__
 
def optimise_level
 
def get_execengine
 
def get_passmanager
 
def get_module
 
def add_shared_library
 
def add_fc
 

Public Attributes

 mod
 
 pass_manager
 
 exec_engine
 

Static Public Attributes

dictionary known_fc = {}
 

Detailed Description

Definition at line 53 of file llvmconvert.py.

Constructor & Destructor Documentation

def miasm2.jitter.llvmconvert.LLVMContext.__init__ (   self,
  name = "mod" 
)

Definition at line 59 of file llvmconvert.py.

59 
60  def __init__(self, name="mod"):
61  "Initialize a context with a module named 'name'"
62  self.mod = llvm_c.Module.new(name)
63  self.pass_manager = llvm_p.FunctionPassManager.new(self.mod)
64  self.exec_engine = llvm_e.ExecutionEngine.new(self.mod)
65  self.add_fc(self.known_fc)

Member Function Documentation

def miasm2.jitter.llvmconvert.LLVMContext.add_fc (   self,
  fc 
)

Definition at line 111 of file llvmconvert.py.

112  def add_fc(self, fc):
113  "Add function into known_fc"
114 
115  for name, detail in fc.items():
116  self.mod.add_function(LLVMType.function(detail["ret"],
117  detail["args"]),
118  name)
119 

+ Here is the caller graph for this function:

def miasm2.jitter.llvmconvert.LLVMContext.add_shared_library (   self,
  filename 
)

Definition at line 107 of file llvmconvert.py.

108  def add_shared_library(self, filename):
109  "Load the shared library 'filename'"
110  return llvm_c.load_library_permanently(filename)

+ Here is the caller graph for this function:

def miasm2.jitter.llvmconvert.LLVMContext.get_execengine (   self)

Definition at line 95 of file llvmconvert.py.

95 
96  def get_execengine(self):
97  "Return the Execution Engine associated with this context"
98  return self.exec_engine
def miasm2.jitter.llvmconvert.LLVMContext.get_module (   self)

Definition at line 103 of file llvmconvert.py.

104  def get_module(self):
105  "Return the module associated with this context"
106  return self.mod
def miasm2.jitter.llvmconvert.LLVMContext.get_passmanager (   self)

Definition at line 99 of file llvmconvert.py.

99 
100  def get_passmanager(self):
101  "Return the Pass Manager associated with this context"
102  return self.exec_engine
def miasm2.jitter.llvmconvert.LLVMContext.optimise_level (   self,
  classic_passes = True,
  dead_passes = True 
)
Set the optimisation level :
classic_passes :
 - combine instruction
 - reassociate
 - global value numbering
 - simplify cfg

dead_passes :
 - dead code
 - dead store
 - dead instructions

Definition at line 66 of file llvmconvert.py.

66 
67  def optimise_level(self, classic_passes=True, dead_passes=True):
68  """Set the optimisation level :
69  classic_passes :
70  - combine instruction
71  - reassociate
72  - global value numbering
73  - simplify cfg
74 
75  dead_passes :
76  - dead code
77  - dead store
78  - dead instructions
79  """
80 
81  # Set up the optimiser pipeline
82 
83  if classic_passes is True:
84  # self.pass_manager.add(llvm_p.PASS_INSTCOMBINE)
85  self.pass_manager.add(llvm_p.PASS_REASSOCIATE)
86  self.pass_manager.add(llvm_p.PASS_GVN)
87  self.pass_manager.add(llvm_p.PASS_SIMPLIFYCFG)
88 
89  if dead_passes is True:
90  self.pass_manager.add(llvm_p.PASS_DCE)
91  self.pass_manager.add(llvm_p.PASS_DSE)
92  self.pass_manager.add(llvm_p.PASS_DIE)
93 
94  self.pass_manager.initialize()

Member Data Documentation

miasm2.jitter.llvmconvert.LLVMContext.exec_engine

Definition at line 63 of file llvmconvert.py.

dictionary miasm2.jitter.llvmconvert.LLVMContext.known_fc = {}
static

Definition at line 57 of file llvmconvert.py.

miasm2.jitter.llvmconvert.LLVMContext.mod

Definition at line 61 of file llvmconvert.py.

miasm2.jitter.llvmconvert.LLVMContext.pass_manager

Definition at line 62 of file llvmconvert.py.


The documentation for this class was generated from the following file: