parameters: (exprs, dst_reg, sym_to_reg, triple_or_target=None)
docstring: Compile and assemble an expression for a given architecture.
  
      Arguments:
        * *exprs*: list of expressions to convert. This can represent a graph of
          expressions.
        * *dst_reg*: final register on which to store the result of the last
          expression. This is represented by a tuple ("reg_name", reg_size_bits).
          Example: ("rax", 64)
        * *sym_to_reg*: a dictionnary that maps Arybo variable name to registers
          (described as tuple, see *dst_reg*). Example: {"x": ("rdi",64), "y": ("rsi", 64)}
        * *triple_or_target*: LLVM architecture triple to use. Use by default the
          host architecture. Example: "x86_64-unknown-unknown"
  
      Output:
        * binary stream of the assembled expression for the given target
  
      Here is an example that will compile and assemble "x+y" for x86_64::
  
          from arybo.lib import MBA 
          from arybo.lib import mba_exprs
          from arybo.lib.exprs_asm import asm_binary
          mba = MBA(64)
          x = mba.var("x")
          y = mba.var("y")
          e = mba_exprs.ExprBV(x) + mba_exprs.ExprBV(y)
          code = asm_binary([e], ("rax", 64), {"x": ("rdi", 64), "y": ("rsi", 64)}, "x86_64-unknown-unknown")
          print(code.hex())
  
      which outputs ``488d0437`` (which is equivalent to ``lea rax,[rdi+rsi*1]``).
docstring_summary: Compile and assemble an expression for a given architecture.
docstring_tokens: Compile and assemble an expression for a given architecture .
function: def asm_binary(exprs, dst_reg, sym_to_reg, triple_or_target=None):
      '''
      Compile and assemble an expression for a given architecture.
  
      Arguments:
        * *exprs*: list of expressions to convert. This can represent a graph of
          expressions.
        * *dst_reg*: final register on which to store the result of the last
          expression. This is represented by a tuple ("reg_name", reg_size_bits).
          Example: ("rax", 64)
        * *sym_to_reg*: a dictionnary that maps Arybo variable name to registers
          (described as tuple, see *dst_reg*). Example: {"x": ("rdi",64), "y": ("rsi", 64)}
        * *triple_or_target*: LLVM architecture triple to use. Use by default the
          host architecture. Example: "x86_64-unknown-unknown"
  
      Output:
        * binary stream of the assembled expression for the given target
  
      Here is an example that will compile and assemble "x+y" for x86_64::
  
          from arybo.lib import MBA 
          from arybo.lib import mba_exprs
          from arybo.lib.exprs_asm import asm_binary
          mba = MBA(64)
          x = mba.var("x")
          y = mba.var("y")
          e = mba_exprs.ExprBV(x) + mba_exprs.ExprBV(y)
          code = asm_binary([e], ("rax", 64), {"x": ("rdi", 64), "y": ("rsi", 64)}, "x86_64-unknown-unknown")
          print(code.hex())
  
      which outputs ``488d0437`` (which is equivalent to ``lea rax,[rdi+rsi*1]``).
      '''
      if not llvmlite_available:
          raise RuntimeError("llvmlite module unavailable! can't assemble...")
  
      target = llvm_get_target(triple_or_target)
      M = asm_module(exprs, dst_reg, sym_to_reg, target)
  
      # Use LLVM to compile the '__arybo' function. As the function is naked and
      # is the only, we just got to dump the .text section to get the binary
      # assembly.
      # No need for keystone or whatever hype stuff. llvmlite does the job.
  
      M = llvm.parse_assembly(str(M))
      M.verify()
      target_machine = target.create_target_machine()
      obj_bin = target_machine.emit_object(M)
      obj = llvm.ObjectFileRef.from_data(obj_bin)
      for s in obj.sections():
          if s.is_text():
              return s.data()
      raise RuntimeError("unable to get the assembled binary!")
function_tokens: def asm_binary ( exprs , dst_reg , sym_to_reg , triple_or_target = None ) : if not llvmlite_available : raise RuntimeError ( "llvmlite module unavailable! can't assemble..." ) target = llvm_get_target ( triple_or_target ) M = asm_module ( exprs , dst_reg , sym_to_reg , target ) # Use LLVM to compile the '__arybo' function. As the function is naked and # is the only, we just got to dump the .text section to get the binary # assembly. # No need for keystone or whatever hype stuff. llvmlite does the job. M = llvm . parse_assembly ( str ( M ) ) M . verify ( ) target_machine = target . create_target_machine ( ) obj_bin = target_machine . emit_object ( M ) obj = llvm . ObjectFileRef . from_data ( obj_bin ) for s in obj . sections ( ) : if s . is_text ( ) : return s . data ( ) raise RuntimeError ( "unable to get the assembled binary!" )