about summary refs log tree commit diff stats
path: root/miasm2
diff options
context:
space:
mode:
Diffstat (limited to 'miasm2')
-rw-r--r--miasm2/analysis/binary.py2
-rw-r--r--miasm2/analysis/depgraph.py2
-rw-r--r--miasm2/analysis/disasm_cb.py4
-rw-r--r--miasm2/analysis/dse.py2
-rw-r--r--miasm2/arch/aarch64/arch.py6
-rw-r--r--miasm2/arch/arm/arch.py8
-rw-r--r--miasm2/arch/arm/disasm.py2
-rw-r--r--miasm2/arch/arm/sem.py12
-rw-r--r--miasm2/arch/mips32/arch.py8
-rw-r--r--miasm2/arch/mips32/ira.py2
-rw-r--r--miasm2/arch/mips32/jit.py2
-rw-r--r--miasm2/arch/mips32/sem.py4
-rw-r--r--miasm2/arch/msp430/arch.py6
-rw-r--r--miasm2/arch/ppc/arch.py4
-rw-r--r--miasm2/arch/ppc/sem.py8
-rw-r--r--miasm2/arch/sh4/arch.py10
-rw-r--r--miasm2/arch/x86/arch.py8
-rw-r--r--miasm2/core/asmblock.py54
-rw-r--r--miasm2/core/cpu.py12
-rw-r--r--miasm2/core/parse_asm.py6
-rw-r--r--miasm2/core/sembuilder.py4
-rw-r--r--miasm2/ir/ir.py31
-rw-r--r--miasm2/ir/symbexec.py4
-rw-r--r--miasm2/ir/symbexec_top.py2
-rw-r--r--miasm2/ir/translators/C.py2
-rw-r--r--miasm2/ir/translators/smt2.py13
-rw-r--r--miasm2/ir/translators/z3_ir.py5
-rw-r--r--miasm2/jitter/codegen.py14
-rw-r--r--miasm2/jitter/jitcore.py10
-rw-r--r--miasm2/jitter/jitcore_gcc.py2
-rw-r--r--miasm2/jitter/jitcore_llvm.py2
-rw-r--r--miasm2/jitter/jitcore_python.py2
-rw-r--r--miasm2/jitter/llvmconvert.py14
33 files changed, 133 insertions, 134 deletions
diff --git a/miasm2/analysis/binary.py b/miasm2/analysis/binary.py
index ae3b964e..16e573bb 100644
--- a/miasm2/analysis/binary.py
+++ b/miasm2/analysis/binary.py
@@ -217,7 +217,7 @@ class ContainerELF(Container):
                     log.warning("Same offset (%s) for %s and %s",
                                 (hex(offset),
                                  name,
-                                 self._loc_db.getby_offset(offset)))
+                                 self._loc_db.get_offset_location(offset)))
                     continue
 
 
diff --git a/miasm2/analysis/depgraph.py b/miasm2/analysis/depgraph.py
index 6532a3ef..f5a2b043 100644
--- a/miasm2/analysis/depgraph.py
+++ b/miasm2/analysis/depgraph.py
@@ -298,7 +298,7 @@ class DependencyResult(DependencyState):
 
         # Eval the block
         loc_db = LocationDB()
-        temp_loc = loc_db.getby_name_create("Temp")
+        temp_loc = loc_db.get_or_create_name_location("Temp")
         symb_exec = SymbolicExecutionEngine(self._ira, ctx_init)
         symb_exec.eval_updt_irblock(IRBlock(temp_loc, assignblks), step=step)
 
diff --git a/miasm2/analysis/disasm_cb.py b/miasm2/analysis/disasm_cb.py
index 54832104..bb8223e8 100644
--- a/miasm2/analysis/disasm_cb.py
+++ b/miasm2/analysis/disasm_cb.py
@@ -49,7 +49,7 @@ def arm_guess_subcall(
         l = cur_bloc.lines[-1]
         if lr_val.arg != l.offset + l.l:
             continue
-        l = loc_db.getby_offset_create(int(lr_val))
+        l = loc_db.get_or_create_offset_location(int(lr_val))
         c = AsmConstraintNext(l)
 
         to_add.add(c)
@@ -111,7 +111,7 @@ def arm_guess_jump_table(
 
         for ad in addrs:
             offsets_to_dis.add(ad)
-            l = loc_db.getby_offset_create(ad)
+            l = loc_db.get_or_create_offset_location(ad)
             c = AsmConstraintTo(l)
             cur_bloc.addto(c)
 
diff --git a/miasm2/analysis/dse.py b/miasm2/analysis/dse.py
index e2758d6c..87d11e0a 100644
--- a/miasm2/analysis/dse.py
+++ b/miasm2/analysis/dse.py
@@ -348,7 +348,7 @@ class DSEEngine(object):
                 self.symb.run_block_at(cur_addr)
 
                 if not (isinstance(next_addr_concrete, ExprLoc) and
-                        self.ir_arch.loc_db.loc_key_to_offset(
+                        self.ir_arch.loc_db.get_location_offset(
                             next_addr_concrete.loc_key
                         ) is None):
                     # Not a lbl_gen, exit
diff --git a/miasm2/arch/aarch64/arch.py b/miasm2/arch/aarch64/arch.py
index 79b76743..529621c4 100644
--- a/miasm2/arch/aarch64/arch.py
+++ b/miasm2/arch/aarch64/arch.py
@@ -276,7 +276,7 @@ class aarch64_arg(m_arg):
             if isinstance(value.name, ExprId):
                 fixed_size.add(value.name.size)
                 return value.name
-            loc_key = loc_db.getby_name_create(value.name)
+            loc_key = loc_db.get_or_create_name_location(value.name)
             return ExprLoc(loc_key, size_hint)
         if isinstance(value, AstInt):
             assert size_hint is not None
@@ -316,7 +316,7 @@ class instruction_aarch64(instruction):
             return str(expr)
         elif expr.is_loc():
             if loc_db is not None:
-                return loc_db.str_loc_key(expr.loc_key)
+                return loc_db.pretty_str(expr.loc_key)
             else:
                 return str(expr)
         elif isinstance(expr, m2_expr.ExprOp) and expr.op in shift_expr:
@@ -374,7 +374,7 @@ class instruction_aarch64(instruction):
         if not expr.is_int():
             return
         addr = expr.arg + self.offset
-        loc_key = loc_db.getby_offset_create(addr)
+        loc_key = loc_db.get_or_create_offset_location(addr)
         self.args[index] = m2_expr.ExprLoc(loc_key, expr.size)
 
     def breakflow(self):
diff --git a/miasm2/arch/arm/arch.py b/miasm2/arch/arm/arch.py
index 498de94c..1810cd6a 100644
--- a/miasm2/arch/arm/arch.py
+++ b/miasm2/arch/arm/arch.py
@@ -349,7 +349,7 @@ class instruction_arm(instruction):
             return str(expr)
         elif expr.is_loc():
             if loc_db is not None:
-                return loc_db.str_loc_key(expr.loc_key)
+                return loc_db.pretty_str(expr.loc_key)
             else:
                 return str(expr)
         if isinstance(expr, ExprOp) and expr.op in expr2shift_dct:
@@ -430,7 +430,7 @@ class instruction_arm(instruction):
             addr = expr.arg + self.offset
         else:
             addr = expr.arg + self.offset
-        loc_key = loc_db.getby_offset_create(addr)
+        loc_key = loc_db.get_or_create_offset_location(addr)
         self.args[0] = ExprLoc(loc_key, expr.size)
 
     def breakflow(self):
@@ -512,7 +512,7 @@ class instruction_armt(instruction_arm):
         else:
             addr = expr.arg + self.offset
 
-        loc_key = loc_db.getby_offset_create(addr)
+        loc_key = loc_db.get_or_create_offset_location(addr)
         dst = ExprLoc(loc_key, expr.size)
 
         if self.name in ["CBZ", "CBNZ"]:
@@ -780,7 +780,7 @@ class arm_arg(m_arg):
                 return arg.name
             if arg.name in gpregs.str:
                 return None
-            loc_key = loc_db.getby_name_create(arg.name)
+            loc_key = loc_db.get_or_create_name_location(arg.name)
             return ExprLoc(loc_key, 32)
         if isinstance(arg, AstOp):
             args = [self.asm_ast_to_expr(tmp, loc_db) for tmp in arg.args]
diff --git a/miasm2/arch/arm/disasm.py b/miasm2/arch/arm/disasm.py
index 41034211..5e21778d 100644
--- a/miasm2/arch/arm/disasm.py
+++ b/miasm2/arch/arm/disasm.py
@@ -24,7 +24,7 @@ def cb_arm_fix_call(mn, cur_bloc, loc_db, offsets_to_dis, *args, **kwargs):
         return
     if not l2.args[1] in values:
         return
-    loc_key_cst = loc_db.getby_offset_create(l1.offset + 4)
+    loc_key_cst = loc_db.get_or_create_offset_location(l1.offset + 4)
     cur_bloc.add_cst(loc_key_cst, AsmConstraint.c_next)
     offsets_to_dis.add(l1.offset + 4)
 
diff --git a/miasm2/arch/arm/sem.py b/miasm2/arch/arm/sem.py
index 6e311f8e..a3d12514 100644
--- a/miasm2/arch/arm/sem.py
+++ b/miasm2/arch/arm/sem.py
@@ -441,8 +441,8 @@ def sdiv(ir, instr, a, b, c=None):
     if c is None:
         b, c = a, b
 
-    loc_div = ExprLoc(ir.loc_db.gen_loc_key(), ir.IRDst.size)
-    loc_except = ExprId(ir.loc_db.gen_loc_key(), ir.IRDst.size)
+    loc_div = ExprLoc(ir.loc_db.add_location(), ir.IRDst.size)
+    loc_except = ExprId(ir.loc_db.add_location(), ir.IRDst.size)
     loc_next = ExprLoc(ir.get_next_loc_key(instr), ir.IRDst.size)
 
     e.append(ExprAff(ir.IRDst, ExprCond(c, loc_div, loc_except)))
@@ -474,8 +474,8 @@ def udiv(ir, instr, a, b, c=None):
 
 
 
-    loc_div = ExprLoc(ir.loc_db.gen_loc_key(), ir.IRDst.size)
-    loc_except = ExprLoc(ir.loc_db.gen_loc_key(), ir.IRDst.size)
+    loc_div = ExprLoc(ir.loc_db.add_location(), ir.IRDst.size)
+    loc_except = ExprLoc(ir.loc_db.add_location(), ir.IRDst.size)
     loc_next = ExprLoc(ir.get_next_loc_key(instr), ir.IRDst.size)
 
     e.append(ExprAff(ir.IRDst, ExprCond(c, loc_div, loc_except)))
@@ -1266,7 +1266,7 @@ def add_condition_expr(ir, instr, cond, instr_ir, extra_ir):
 
     loc_next = ir.get_next_loc_key(instr)
     loc_next_expr = ExprLoc(loc_next, 32)
-    loc_do = ir.loc_db.gen_loc_key()
+    loc_do = ir.loc_db.add_location()
     loc_do_expr = ExprLoc(loc_do, 32)
 
     dst_cond = ExprCond(cond, loc_do_expr, loc_next_expr)
@@ -1556,7 +1556,7 @@ class ir_arml(IntermediateRepresentation):
             instr = block.lines[index]
 
             # Add conditionnal jump to current irblock
-            loc_do = self.loc_db.gen_loc_key()
+            loc_do = self.loc_db.add_location()
             loc_next = self.get_next_loc_key(instr)
 
             if hint:
diff --git a/miasm2/arch/mips32/arch.py b/miasm2/arch/mips32/arch.py
index a47c606b..974644dc 100644
--- a/miasm2/arch/mips32/arch.py
+++ b/miasm2/arch/mips32/arch.py
@@ -65,7 +65,7 @@ class instruction_mips32(cpu.instruction):
             return str(expr)
         elif expr.is_loc():
             if loc_db is not None:
-                return loc_db.str_loc_key(expr.loc_key)
+                return loc_db.pretty_str(expr.loc_key)
             else:
                 return str(expr)
         assert(isinstance(expr, ExprMem))
@@ -97,7 +97,7 @@ class instruction_mips32(cpu.instruction):
         if self.name in ["J", 'JAL']:
             expr = self.args[0].arg
             addr = (self.offset & (0xFFFFFFFF ^ ((1<< 28)-1))) + expr
-            loc_key = loc_db.getby_offset_create(addr)
+            loc_key = loc_db.get_or_create_offset_location(addr)
             self.args[0] = ExprLoc(loc_key, expr.size)
             return
 
@@ -107,7 +107,7 @@ class instruction_mips32(cpu.instruction):
         if not isinstance(expr, ExprInt):
             return
         addr = expr.arg + self.offset
-        loc_key = loc_db.getby_offset_create(addr)
+        loc_key = loc_db.get_or_create_offset_location(addr)
         self.args[ndx] = ExprLoc(loc_key, expr.size)
 
     def breakflow(self):
@@ -265,7 +265,7 @@ class mips32_arg(cpu.m_arg):
                 return arg.name
             if arg.name in gpregs.str:
                 return None
-            loc_key = loc_db.getby_name_create(arg.name)
+            loc_key = loc_db.get_or_create_name_location(arg.name)
             return ExprLoc(loc_key, 32)
         if isinstance(arg, AstOp):
             args = [self.asm_ast_to_expr(tmp, loc_db) for tmp in arg.args]
diff --git a/miasm2/arch/mips32/ira.py b/miasm2/arch/mips32/ira.py
index 791e67bf..53c2c6b3 100644
--- a/miasm2/arch/mips32/ira.py
+++ b/miasm2/arch/mips32/ira.py
@@ -28,7 +28,7 @@ class ir_a_mips32l(ir_mips32l, ira):
                 new_irblocks.append(irb)
                 continue
             if lr_val.is_loc():
-                offset = self.loc_db.loc_key_to_offset(lr_val.loc_key)
+                offset = self.loc_db.get_location_offset(lr_val.loc_key)
                 if offset is not None:
                     lr_val = ExprInt(offset, 32)
             if not lr_val.is_int():
diff --git a/miasm2/arch/mips32/jit.py b/miasm2/arch/mips32/jit.py
index 0c4eb85b..a0df64d6 100644
--- a/miasm2/arch/mips32/jit.py
+++ b/miasm2/arch/mips32/jit.py
@@ -70,7 +70,7 @@ class mipsCGen(CGen):
         """
 
         loc_key = self.get_block_post_label(block)
-        offset = self.ir_arch.loc_db.loc_key_to_offset(loc_key)
+        offset = self.ir_arch.loc_db.get_location_offset(loc_key)
         out = (self.CODE_RETURN_NO_EXCEPTION % (loc_key,
                                                 self.C_PC,
                                                 m2_expr.ExprId('branch_dst_irdst', 32),
diff --git a/miasm2/arch/mips32/sem.py b/miasm2/arch/mips32/sem.py
index df13cd2c..acf7370f 100644
--- a/miasm2/arch/mips32/sem.py
+++ b/miasm2/arch/mips32/sem.py
@@ -490,10 +490,10 @@ class ir_mips32l(IntermediateRepresentation):
         return instr_ir, new_extra_ir
 
     def get_next_instr(self, instr):
-        return self.loc_db.getby_offset_create(instr.offset  + 4)
+        return self.loc_db.get_or_create_offset_location(instr.offset  + 4)
 
     def get_next_break_loc_key(self, instr):
-        return self.loc_db.getby_offset_create(instr.offset  + 8)
+        return self.loc_db.get_or_create_offset_location(instr.offset  + 8)
 
 class ir_mips32b(ir_mips32l):
     def __init__(self, loc_db=None):
diff --git a/miasm2/arch/msp430/arch.py b/miasm2/arch/msp430/arch.py
index 7c739561..ecf4cb13 100644
--- a/miasm2/arch/msp430/arch.py
+++ b/miasm2/arch/msp430/arch.py
@@ -69,7 +69,7 @@ class msp430_arg(m_arg):
                 index = gpregs.str.index(name)
                 reg = gpregs.expr[index]
                 return reg
-            loc_key = loc_db.getby_name_create(value.name)
+            loc_key = loc_db.get_or_create_name_location(value.name)
             return ExprLoc(loc_key, 16)
         if isinstance(value, AstOp):
             args = [self.asm_ast_to_expr(tmp, loc_db) for tmp in value.args]
@@ -109,7 +109,7 @@ class instruction_msp430(instruction):
             o = str(expr)
         elif expr.is_loc():
             if loc_db is not None:
-                return loc_db.str_loc_key(expr.loc_key)
+                return loc_db.pretty_str(expr.loc_key)
             else:
                 return str(expr)
         elif isinstance(expr, ExprOp) and expr.op == "autoinc":
@@ -138,7 +138,7 @@ class instruction_msp430(instruction):
         else:
             addr = expr.arg + int(self.offset)
 
-        loc_key = loc_db.getby_offset_create(addr)
+        loc_key = loc_db.get_or_create_offset_location(addr)
         self.args[0] = ExprLoc(loc_key, expr.size)
 
     def breakflow(self):
diff --git a/miasm2/arch/ppc/arch.py b/miasm2/arch/ppc/arch.py
index 94b2b903..c100cde3 100644
--- a/miasm2/arch/ppc/arch.py
+++ b/miasm2/arch/ppc/arch.py
@@ -40,7 +40,7 @@ class ppc_arg(m_arg):
                 return arg.name
             if arg.name in gpregs.str:
                 return None
-            loc_key = loc_db.getby_name_create(arg.name)
+            loc_key = loc_db.get_or_create_name_location(arg.name)
             return ExprLoc(loc_key, 32)
         if isinstance(arg, AstOp):
             args = [self.asm_ast_to_expr(tmp, loc_db) for tmp in arg.args]
@@ -131,7 +131,7 @@ class instruction_ppc(instruction):
                 ad = e.arg + self.offset
             else:
                 ad = e.arg
-            loc_key = loc_db.getby_offset_create(ad)
+            loc_key = loc_db.get_or_create_offset_location(ad)
             s = ExprLoc(loc_key, e.size)
             self.args[address_index] = s
 
diff --git a/miasm2/arch/ppc/sem.py b/miasm2/arch/ppc/sem.py
index 77e4973a..678ab041 100644
--- a/miasm2/arch/ppc/sem.py
+++ b/miasm2/arch/ppc/sem.py
@@ -606,8 +606,8 @@ def mn_do_store(ir, instr, arg1, arg2, arg3=None):
             ret.append(ExprAff(arg2, address))
 
     if is_stwcx:
-        loc_do = ExprLoc(ir.loc_db.gen_loc_key(), ir.IRDst.size)
-        loc_dont = ExprLoc(ir.loc_db.gen_loc_key(), ir.IRDst.size)
+        loc_do = ExprLoc(ir.loc_db.add_location(), ir.IRDst.size)
+        loc_dont = ExprLoc(ir.loc_db.add_location(), ir.IRDst.size)
         loc_next = ExprLoc(ir.get_next_loc_key(instr), ir.IRDst.size)
         flags = [ ExprAff(CR0_LT, ExprInt(0,1)),
                   ExprAff(CR0_GT, ExprInt(0,1)),
@@ -916,9 +916,9 @@ class ir_ppc32b(IntermediateRepresentation):
         return instr_ir, extra_ir
 
     def get_next_instr(self, instr):
-        l = self.loc_db.getby_offset_create(instr.offset  + 4)
+        l = self.loc_db.get_or_create_offset_location(instr.offset  + 4)
         return l
 
     def get_next_break_loc_key(self, instr):
-        l = self.loc_db.getby_offset_create(instr.offset  + 4)
+        l = self.loc_db.get_or_create_offset_location(instr.offset  + 4)
         return l
diff --git a/miasm2/arch/sh4/arch.py b/miasm2/arch/sh4/arch.py
index 46e316f8..d5e9820e 100644
--- a/miasm2/arch/sh4/arch.py
+++ b/miasm2/arch/sh4/arch.py
@@ -102,7 +102,7 @@ class sh4_arg(m_arg):
                 return arg.name
             if arg.name in gpregs.str:
                 return None
-            loc_key = loc_db.getby_name_create(arg.name)
+            loc_key = loc_db.get_or_create_name_location(arg.name)
             return ExprLoc(loc_key, 32)
         if isinstance(arg, AstOp):
             args = [self.asm_ast_to_expr(tmp, loc_db) for tmp in arg.args]
@@ -411,7 +411,7 @@ class instruction_sh4(instruction):
             return str(expr)
         elif expr.is_loc():
             if loc_db is not None:
-                return loc_db.str_loc_key(expr.loc_key)
+                return loc_db.pretty_str(expr.loc_key)
             else:
                 return str(expr)
         assert(isinstance(expr, ExprMem))
@@ -443,7 +443,7 @@ class instruction_sh4(instruction):
             ad = e.arg+8+self.offset
         else:
             ad = e.arg+8+self.offset
-        l = loc_db.getby_offset_create(ad)
+        l = loc_db.get_or_create_offset_location(ad)
         s = ExprId(l, e.size)
         self.args[0] = s
     """
@@ -826,7 +826,7 @@ addop("bf", [bs('10001011'), s08imm])
     def dstflow2label(self, loc_db):
         e = self.args[0].expr
         ad = e.arg*2+4+self.offset
-        l = loc_db.getby_offset_create(ad)
+        l = loc_db.get_or_create_offset_location(ad)
         s = ExprId(l, e.size)
         self.args[0].expr = s
 """
@@ -849,7 +849,7 @@ addop("bra", [bs('1010'), s12imm])
     def dstflow2label(self, loc_db):
         e = self.args[0].expr
         ad = e.arg*2+4+self.offset
-        l = loc_db.getby_offset_create(ad)
+        l = loc_db.get_or_create_offset_location(ad)
         s = ExprId(l, e.size)
         self.args[0].expr = s
 """
diff --git a/miasm2/arch/x86/arch.py b/miasm2/arch/x86/arch.py
index 3a537c01..815eaee6 100644
--- a/miasm2/arch/x86/arch.py
+++ b/miasm2/arch/x86/arch.py
@@ -272,7 +272,7 @@ class x86_arg(m_arg):
             if value.name in ["FAR"]:
                 return None
 
-            loc_key = loc_db.getby_name_create(value.name)
+            loc_key = loc_db.get_or_create_name_location(value.name)
             return ExprLoc(loc_key, size_hint)
         if isinstance(value, AstOp):
             # First pass to retreive fixed_size
@@ -476,7 +476,7 @@ class instruction_x86(instruction):
         if not expr.is_int():
             return
         addr = expr.arg + int(self.offset)
-        loc_key = loc_db.getby_offset_create(addr)
+        loc_key = loc_db.get_or_create_offset_location(addr)
         self.args[0] = ExprLoc(loc_key, expr.size)
 
     def breakflow(self):
@@ -514,7 +514,7 @@ class instruction_x86(instruction):
     def getdstflow(self, loc_db):
         if self.additional_info.g1.value & 6 and self.name in repeat_mn:
             addr = int(self.offset)
-            loc_key = loc_db.getby_offset_create(addr)
+            loc_key = loc_db.get_or_create_offset_location(addr)
             return [ExprLoc(loc_key, self.v_opmode())]
         return [self.args[0]]
 
@@ -564,7 +564,7 @@ class instruction_x86(instruction):
             o = str(expr)
         elif expr.is_loc():
             if loc_db is not None:
-                o = loc_db.str_loc_key(expr.loc_key)
+                o = loc_db.pretty_str(expr.loc_key)
             else:
                 o = str(expr)
         elif ((isinstance(expr, ExprOp) and expr.op == 'far' and
diff --git a/miasm2/core/asmblock.py b/miasm2/core/asmblock.py
index 1aa057bd..c8af4056 100644
--- a/miasm2/core/asmblock.py
+++ b/miasm2/core/asmblock.py
@@ -74,7 +74,7 @@ class AsmConstraint(object):
         else:
             return "%s:%s" % (
                 self.c_t,
-                loc_db.str_loc_key(self.loc_key)
+                loc_db.pretty_str(self.loc_key)
             )
 
     def __str__(self):
@@ -142,7 +142,7 @@ class AsmBlock(object):
         if loc_db is None:
             out.append(str(self.loc_key))
         else:
-            out.append(loc_db.str_loc_key(self.loc_key))
+            out.append(loc_db.pretty_str(self.loc_key))
 
         for instr in self.lines:
             out.append(instr.to_string(loc_db))
@@ -168,11 +168,11 @@ class AsmBlock(object):
         self.bto.add(c)
 
     def split(self, loc_db, offset):
-        loc_key = loc_db.getby_offset_create(offset)
+        loc_key = loc_db.get_or_create_offset_location(offset)
         log_asmblock.debug('split at %x', offset)
         i = -1
         offsets = [x.offset for x in self.lines]
-        offset = loc_db.loc_key_to_offset(loc_key)
+        offset = loc_db.get_location_offset(loc_key)
         if offset not in offsets:
             log_asmblock.warning(
                 'cannot split bloc at %X ' % offset +
@@ -540,7 +540,7 @@ class AsmCFG(DiGraph):
         if self.loc_db is None:
             loc_key_name = str(node)
         else:
-            loc_key_name = self.loc_db.str_loc_key(node)
+            loc_key_name = self.loc_db.pretty_str(node)
         yield self.DotCellDescription(text=loc_key_name,
                                       attr={'align': 'center',
                                             'colspan': 2,
@@ -777,7 +777,7 @@ class AsmCFG(DiGraph):
         # offset
         block_dst = []
         for loc_key in self.pendings:
-            offset = loc_db.loc_key_to_offset(loc_key)
+            offset = loc_db.get_location_offset(loc_key)
             if offset is not None:
                 block_dst.append(offset)
 
@@ -812,7 +812,7 @@ class AsmCFG(DiGraph):
                 # The new block destinations may need to be disassembled
                 if dis_block_callback:
                     offsets_to_dis = set(
-                        self.loc_db.loc_key_to_offset(constraint.loc_key)
+                        self.loc_db.get_location_offset(constraint.loc_key)
                         for constraint in new_b.bto
                     )
                     dis_block_callback(cur_bloc=new_b,
@@ -919,8 +919,8 @@ def fix_expr_val(expr, symbols):
             # Example:
             # toto:
             # .dword label
-            loc_key = symbols.getby_name(e.name)
-            offset = symbols.loc_key_to_offset(loc_key)
+            loc_key = symbols.get_name_location(e.name)
+            offset = symbols.get_location_offset(loc_key)
             e = ExprInt(offset, e.size)
         return e
     result = expr.visit(expr_calc)
@@ -936,10 +936,10 @@ def fix_loc_offset(loc_db, loc_key, offset, modified):
     to @modified
     @loc_db: current loc_db
     """
-    loc_offset = loc_db.loc_key_to_offset(loc_key)
+    loc_offset = loc_db.get_location_offset(loc_key)
     if loc_offset == offset:
         return
-    loc_db.set_offset(loc_key, offset)
+    loc_db.set_location_offset(loc_key, offset, force=True)
     modified.add(loc_key)
 
 
@@ -961,7 +961,7 @@ class BlockChain(object):
         self.pinned_block_idx = None
         for i, block in enumerate(self.blocks):
             loc_key = block.loc_key
-            if self.loc_db.loc_key_to_offset(loc_key) is not None:
+            if self.loc_db.get_location_offset(loc_key) is not None:
                 if self.pinned_block_idx is not None:
                     raise ValueError("Multiples pinned block detected")
                 self.pinned_block_idx = i
@@ -980,7 +980,7 @@ class BlockChain(object):
             return
 
         loc = self.blocks[self.pinned_block_idx].loc_key
-        offset_base = self.loc_db.loc_key_to_offset(loc)
+        offset_base = self.loc_db.get_location_offset(loc)
         assert(offset_base % self.blocks[self.pinned_block_idx].alignment == 0)
 
         self.offset_min = offset_base
@@ -1009,7 +1009,7 @@ class BlockChain(object):
 
         # Propagate offset to blocks before pinned block
         pinned_block = self.blocks[self.pinned_block_idx]
-        offset = self.loc_db.loc_key_to_offset(pinned_block.loc_key)
+        offset = self.loc_db.get_location_offset(pinned_block.loc_key)
         if offset % pinned_block.alignment != 0:
             raise RuntimeError('Bad alignment')
 
@@ -1022,7 +1022,7 @@ class BlockChain(object):
                            modified_loc_keys)
 
         # Propagate offset to blocks after pinned block
-        offset = self.loc_db.loc_key_to_offset(pinned_block.loc_key) + pinned_block.size
+        offset = self.loc_db.get_location_offset(pinned_block.loc_key) + pinned_block.size
 
         last_block = pinned_block
         for block in self.blocks[self.pinned_block_idx + 1:]:
@@ -1050,7 +1050,7 @@ class BlockChainWedge(object):
     def merge(self, chain):
         """Best effort merge two block chains
         Return the list of resulting blockchains"""
-        self.loc_db.set_offset(chain.blocks[0].loc_key, self.offset_max)
+        self.loc_db.set_location_offset(chain.blocks[0].loc_key, self.offset_max)
         chain.place()
         return [self, chain]
 
@@ -1197,7 +1197,7 @@ def assemble_block(mnemo, block, loc_db, conservative=False):
 
         # Assemble an instruction
         saved_args = list(instr.args)
-        instr.offset = loc_db.loc_key_to_offset(block.loc_key) + offset_i
+        instr.offset = loc_db.get_location_offset(block.loc_key) + offset_i
 
         # Replace instruction's arguments by resolved ones
         instr.args = instr.resolve_args_with_symbols(loc_db)
@@ -1297,7 +1297,7 @@ def asm_resolve_final(mnemo, asmcfg, loc_db, dst_interval=None):
     output_interval = interval()
 
     for block in asmcfg.blocks:
-        offset = loc_db.loc_key_to_offset(block.loc_key)
+        offset = loc_db.get_location_offset(block.loc_key)
         for instr in block.lines:
             if not instr.data:
                 # Empty line
@@ -1404,7 +1404,7 @@ class disasmEngine(object):
         delayslot_count = self.arch.delayslot
         offsets_to_dis = set()
         add_next_offset = False
-        loc_key = self.loc_db.getby_offset_create(offset)
+        loc_key = self.loc_db.get_or_create_offset_location(offset)
         cur_block = AsmBlock(loc_key)
         log_asmblock.debug("dis at %X", int(offset))
         while not in_delayslot or delayslot_count > 0:
@@ -1419,12 +1419,12 @@ class disasmEngine(object):
                 else:
                     # Block is not empty, stop the desassembly pass and add a
                     # constraint to the next block
-                    loc_key_cst = self.loc_db.getby_offset_create(offset)
+                    loc_key_cst = self.loc_db.get_or_create_offset_location(offset)
                     cur_block.add_cst(loc_key_cst, AsmConstraint.c_next)
                 break
 
             if lines_cpt > 0 and offset in self.split_dis:
-                loc_key_cst = self.loc_db.getby_offset_create(offset)
+                loc_key_cst = self.loc_db.get_or_create_offset_location(offset)
                 cur_block.add_cst(loc_key_cst, AsmConstraint.c_next)
                 offsets_to_dis.add(offset)
                 break
@@ -1435,7 +1435,7 @@ class disasmEngine(object):
                 break
 
             if offset in job_done:
-                loc_key_cst = self.loc_db.getby_offset_create(offset)
+                loc_key_cst = self.loc_db.get_or_create_offset_location(offset)
                 cur_block.add_cst(loc_key_cst, AsmConstraint.c_next)
                 break
 
@@ -1462,7 +1462,7 @@ class disasmEngine(object):
                 else:
                     # Block is not empty, stop the desassembly pass and add a
                     # constraint to the next block
-                    loc_key_cst = self.loc_db.getby_offset_create(off_i)
+                    loc_key_cst = self.loc_db.get_or_create_offset_location(off_i)
                     cur_block.add_cst(loc_key_cst, AsmConstraint.c_next)
                 break
 
@@ -1475,7 +1475,7 @@ class disasmEngine(object):
                 else:
                     # Block is not empty, stop the desassembly pass and add a
                     # constraint to the next block
-                    loc_key_cst = self.loc_db.getby_offset_create(off_i)
+                    loc_key_cst = self.loc_db.get_or_create_offset_location(off_i)
                     cur_block.add_cst(loc_key_cst, AsmConstraint.c_next)
                 break
 
@@ -1505,7 +1505,7 @@ class disasmEngine(object):
                     if not dst.is_loc():
                         continue
                     loc_key = dst.loc_key
-                    loc_key_offset = self.loc_db.loc_key_to_offset(loc_key)
+                    loc_key_offset = self.loc_db.get_location_offset(loc_key)
                     known_dsts.append(loc_key)
                     if loc_key_offset in self.dont_dis_retcall_funcs:
                         add_next_offset = False
@@ -1517,11 +1517,11 @@ class disasmEngine(object):
             delayslot_count = instr.delayslot
 
         for c in cur_block.bto:
-            loc_key_offset = self.loc_db.loc_key_to_offset(c.loc_key)
+            loc_key_offset = self.loc_db.get_location_offset(c.loc_key)
             offsets_to_dis.add(loc_key_offset)
 
         if add_next_offset:
-            loc_key_cst = self.loc_db.getby_offset_create(offset)
+            loc_key_cst = self.loc_db.get_or_create_offset_location(offset)
             cur_block.add_cst(loc_key_cst, AsmConstraint.c_next)
             offsets_to_dis.add(offset)
 
diff --git a/miasm2/core/cpu.py b/miasm2/core/cpu.py
index 3b36c8d4..dc6fc392 100644
--- a/miasm2/core/cpu.py
+++ b/miasm2/core/cpu.py
@@ -1022,18 +1022,18 @@ class instruction(object):
             fixed_expr = {}
             for exprloc in loc_keys:
                 loc_key = exprloc.loc_key
-                name = symbols.loc_key_to_name(loc_key)
+                names = symbols.get_location_names(loc_key)
                 # special symbols
-                if name == '$':
+                if '$' in names:
                     fixed_expr[exprloc] = self.get_asm_offset(exprloc)
                     continue
-                if name == '_':
+                if '_' in names:
                     fixed_expr[exprloc] = self.get_asm_next_offset(exprloc)
                     continue
-                if symbols.getby_name(name) is None:
+                if not names:
                     raise ValueError('Unresolved symbol: %r' % exprloc)
 
-                offset = symbols.loc_key_to_offset(loc_key)
+                offset = symbols.get_location_offset(loc_key)
                 if offset is None:
                     raise ValueError(
                         'The offset of loc_key "%s" cannot be determined' % name
@@ -1534,7 +1534,7 @@ class cls_mn(object):
         args = []
         for d in dst:
             if isinstance(d, m2_expr.ExprInt):
-                l = loc_db.getby_offset_create(int(d))
+                l = loc_db.get_or_create_offset_location(int(d))
 
                 a = m2_expr.ExprId(l.name, d.size)
             else:
diff --git a/miasm2/core/parse_asm.py b/miasm2/core/parse_asm.py
index e40351cd..7efa17d0 100644
--- a/miasm2/core/parse_asm.py
+++ b/miasm2/core/parse_asm.py
@@ -67,7 +67,7 @@ def guess_next_new_label(loc_db):
     gen_name = "loc_%.8X"
     while True:
         name = gen_name % i
-        label = loc_db.getby_name(name)
+        label = loc_db.get_name_location(name)
         if label is None:
             return loc_db.add_location(name)
         i += 1
@@ -121,7 +121,7 @@ def parse_txt(mnemo, attrib, txt, loc_db=None):
         match_re = LABEL_RE.match(line)
         if match_re:
             label_name = match_re.group(1)
-            label = loc_db.getby_name_create(label_name)
+            label = loc_db.get_or_create_name_location(label_name)
             lines.append(label)
             continue
         # directive
@@ -190,7 +190,7 @@ def parse_txt(mnemo, attrib, txt, loc_db=None):
         match_re = LABEL_RE.match(line)
         if match_re:
             label_name = match_re.group(1)
-            label = loc_db.getby_name_create(label_name)
+            label = loc_db.get_or_create_name_location(label_name)
             lines.append(label)
             continue
 
diff --git a/miasm2/core/sembuilder.py b/miasm2/core/sembuilder.py
index a6ec40f0..ab1af953 100644
--- a/miasm2/core/sembuilder.py
+++ b/miasm2/core/sembuilder.py
@@ -146,12 +146,12 @@ class SemBuilder(object):
         loc_end_expr = "loc_end_expr = ExprLoc(loc_end, ir.IRDst.size)"
         out = ast.parse(loc_end).body
         out += ast.parse(loc_end_expr).body
-        loc_if = "loc_if = ir.loc_db.gen_loc_key()"
+        loc_if = "loc_if = ir.loc_db.add_location()"
         loc_if_expr = "loc_if_expr = ExprLoc(loc_if, ir.IRDst.size)"
         out += ast.parse(loc_if).body
         out += ast.parse(loc_if_expr).body
         if loc_else:
-            loc_else = "loc_else = ir.loc_db.gen_loc_key()"
+            loc_else = "loc_else = ir.loc_db.add_location()"
             loc_else_expr = "loc_else_expr = ExprLoc(loc_else, ir.IRDst.size)"
             out += ast.parse(loc_else).body
             out += ast.parse(loc_else_expr).body
diff --git a/miasm2/ir/ir.py b/miasm2/ir/ir.py
index 234be181..8ee35ed5 100644
--- a/miasm2/ir/ir.py
+++ b/miasm2/ir/ir.py
@@ -357,7 +357,7 @@ class IRBlock(object):
 
     def __str__(self):
         out = []
-        out.append('loc_key_%s' % self.loc_key.key)
+        out.append(str(self.loc_key))
         for assignblk in self:
             for dst, src in assignblk.iteritems():
                 out.append('\t%s = %s' % (dst, src))
@@ -416,14 +416,23 @@ class DiGraphIR(DiGraph):
         if self.loc_db is None:
             name = str(expr)
         else:
-            name = self.loc_db.loc_key_to_name(expr.loc_key)
+            names = self.loc_db.get_location_names(expr.loc_key)
+            if not names:
+                name = self.loc_db.pretty_str(expr.loc_key)
+            else:
+                # Use only one name for readability
+                name = sorted(names)[0]
         return m2_expr.ExprId(name, expr.size)
 
     def node2lines(self, node):
         if self.loc_db is None:
             node_name = str(node)
         else:
-            node_name = self.loc_db.loc_key_to_name(node)
+            names = self.loc_db.get_location_names(node)
+            if not names:
+                node_name = self.loc_db.pretty_str(node)
+            else:
+                node_name = "".join("%s:\n" % name for name in names)
         yield self.DotCellDescription(
             text="%s" % node_name,
             attr={
@@ -530,7 +539,7 @@ class IntermediateRepresentation(object):
         except (ValueError, TypeError):
             return None
 
-        return self.loc_db.getby_offset_create(addr)
+        return self.loc_db.get_or_create_offset_location(addr)
 
     def get_block(self, addr):
         """Returns the irbloc associated to an ExprId/ExprInt/loc_key/int
@@ -551,7 +560,7 @@ class IntermediateRepresentation(object):
 
     def add_instr(self, line, loc_key=None, gen_pc_updt=False):
         if loc_key is None:
-            loc_key = self.loc_db.gen_loc_key()
+            loc_key = self.loc_db.add_location()
         block = AsmBlock(loc_key)
         block.lines = [line]
         self.add_block(block, gen_pc_updt)
@@ -687,9 +696,9 @@ class IntermediateRepresentation(object):
                 if block.lines:
                     line = block.lines[-1]
                     if line.offset is not None:
-                        loc_key = self.loc_db.getby_offset_create(line.offset + line.l)
+                        loc_key = self.loc_db.get_or_create_offset_location(line.offset + line.l)
                 if loc_key is None:
-                    loc_key = self.loc_db.gen_loc_key()
+                    loc_key = self.loc_db.add_location()
                 block.add_cst(loc_key, AsmConstraint.c_next)
             else:
                 loc_key = next_loc_key
@@ -724,18 +733,18 @@ class IntermediateRepresentation(object):
     def get_loc_key_for_instr(self, instr):
         """Returns the loc_key associated to an instruction
         @instr: current instruction"""
-        return self.loc_db.getby_offset_create(instr.offset)
+        return self.loc_db.get_or_create_offset_location(instr.offset)
 
     def gen_loc_key_and_expr(self, size):
         """
         Return a loc_key and it's corresponding ExprLoc
         @size: size of expression
         """
-        loc_key = self.loc_db.gen_loc_key()
+        loc_key = self.loc_db.add_location()
         return loc_key, m2_expr.ExprLoc(loc_key, size)
 
     def get_next_loc_key(self, instr):
-        loc_key = self.loc_db.getby_offset_create(instr.offset + instr.l)
+        loc_key = self.loc_db.get_or_create_offset_location(instr.offset + instr.l)
         return loc_key
 
     def simplify(self, simplifier):
@@ -825,7 +834,7 @@ class IntermediateRepresentation(object):
             self._graph.add_node(lbl)
             for dst in self.dst_trackback(block):
                 if dst.is_int():
-                    dst_lbl = self.loc_db.getby_offset_create(int(dst))
+                    dst_lbl = self.loc_db.get_or_create_offset_location(int(dst))
                     dst = m2_expr.ExprLoc(dst_lbl.loc_key, self.pc.size)
                 if dst.is_loc():
                     self._graph.add_edge(lbl, dst.loc_key)
diff --git a/miasm2/ir/symbexec.py b/miasm2/ir/symbexec.py
index 09113311..288a46e4 100644
--- a/miasm2/ir/symbexec.py
+++ b/miasm2/ir/symbexec.py
@@ -19,7 +19,7 @@ def get_block(ir_arch, mdis, addr):
     """Get IRBlock at address @addr"""
     lbl = ir_arch.get_loc_key(addr)
     if not lbl in ir_arch.blocks:
-        offset = mdis.loc_db.loc_key_to_offset(lbl)
+        offset = mdis.loc_db.get_location_offset(lbl)
         block = mdis.dis_block(offset)
         ir_arch.add_block(block)
     irblock = ir_arch.get_block(lbl)
@@ -892,7 +892,7 @@ class SymbolicExecutionEngine(object):
 
     def eval_exprloc(self, expr, **kwargs):
         """[DEV]: Evaluate an ExprLoc using the current state"""
-        offset = self.ir_arch.loc_db.loc_key_to_offset(expr.loc_key)
+        offset = self.ir_arch.loc_db.get_location_offset(expr.loc_key)
         if offset is not None:
             ret = ExprInt(offset, expr.size)
         else:
diff --git a/miasm2/ir/symbexec_top.py b/miasm2/ir/symbexec_top.py
index e0976c9b..5fe12996 100644
--- a/miasm2/ir/symbexec_top.py
+++ b/miasm2/ir/symbexec_top.py
@@ -128,7 +128,7 @@ class SymbExecTopNoMem(SymbolicExecutionEngine):
         return ret
 
     def eval_exprloc(self, expr, **kwargs):
-        offset = self.ir_arch.loc_db.loc_key_to_offset(expr.loc_key)
+        offset = self.ir_arch.loc_db.get_location_offset(expr.loc_key)
         if offset is not None:
             ret = ExprInt(offset, expr.size)
         else:
diff --git a/miasm2/ir/translators/C.py b/miasm2/ir/translators/C.py
index 28222803..cafec7c8 100644
--- a/miasm2/ir/translators/C.py
+++ b/miasm2/ir/translators/C.py
@@ -55,7 +55,7 @@ class TranslatorC(Translator):
         if self.loc_db is None:
             return str(loc_key)
 
-        offset = self.loc_db.loc_key_to_offset(loc_key)
+        offset = self.loc_db.get_location_offset(loc_key)
         if offset is None:
             return str(loc_key)
 
diff --git a/miasm2/ir/translators/smt2.py b/miasm2/ir/translators/smt2.py
index f5e69163..1a513bfb 100644
--- a/miasm2/ir/translators/smt2.py
+++ b/miasm2/ir/translators/smt2.py
@@ -141,20 +141,13 @@ class TranslatorSMT2(Translator):
 
     def from_ExprLoc(self, expr):
         loc_key = expr.loc_key
-        if self.loc_db is None:
+        if self.loc_db is None or self.loc_db.get_location_offset(loc_key) is None:
             if str(loc_key) not in self._bitvectors:
                 self._bitvectors[str(loc_key)] = expr.size
             return str(loc_key)
 
-        offset = self.loc_db.loc_key_to_offset(loc_key)
-        name = self.loc_db.loc_key_to_name(loc_key)
-
-        if offset is None:
-            return bit_vec_val(str(offset), expr.size)
-        name = "|{}|".format(str(name))
-        if name not in self._bitvectors:
-            self._bitvectors[name] = expr.size
-        return name
+        offset = self.loc_db.get_location_offset(loc_key)
+        return bit_vec_val(str(offset), expr.size)
 
     def from_ExprMem(self, expr):
         addr = self.from_expr(expr.arg)
diff --git a/miasm2/ir/translators/z3_ir.py b/miasm2/ir/translators/z3_ir.py
index bfb29d06..887c68d0 100644
--- a/miasm2/ir/translators/z3_ir.py
+++ b/miasm2/ir/translators/z3_ir.py
@@ -138,12 +138,9 @@ class TranslatorZ3(Translator):
             # No loc_db, fallback to default name
             return z3.BitVec(str(expr), expr.size)
         loc_key = expr.loc_key
-        offset = self.loc_db.loc_key_to_offset(loc_key)
-        name = self.loc_db.loc_key_to_name(loc_key)
+        offset = self.loc_db.get_location_offset(loc_key)
         if offset is not None:
             return z3.BitVecVal(offset, expr.size)
-        if name is not None:
-            return z3.BitVec(name, expr.size)
         # fallback to default name
         return z3.BitVec(str(loc_key), expr.size)
 
diff --git a/miasm2/jitter/codegen.py b/miasm2/jitter/codegen.py
index cf8f1711..10140fd2 100644
--- a/miasm2/jitter/codegen.py
+++ b/miasm2/jitter/codegen.py
@@ -143,7 +143,7 @@ class CGen(object):
         new_assignblk = dict(assignblk)
         if self.ir_arch.IRDst not in assignblk:
             offset = instr.offset + instr.l
-            loc_key = self.ir_arch.loc_db.getby_offset_create(offset)
+            loc_key = self.ir_arch.loc_db.get_or_create_offset_location(offset)
             dst = ExprLoc(loc_key, self.ir_arch.IRDst.size)
             new_assignblk[self.ir_arch.IRDst] = dst
         irs = [AssignBlock(new_assignblk, instr)]
@@ -290,12 +290,12 @@ class CGen(object):
                     "((%s)?(%s):(%s))" % (cond, src1b, src2b))
         if isinstance(expr, ExprInt):
             offset = int(expr)
-            loc_key = self.ir_arch.loc_db.getby_offset_create(offset)
+            loc_key = self.ir_arch.loc_db.get_or_create_offset_location(offset)
             self.add_label_index(dst2index, loc_key)
             return ("%s" % dst2index[loc_key], hex(offset))
         if expr.is_loc():
             loc_key = expr.loc_key
-            offset = self.ir_arch.loc_db.loc_key_to_offset(expr.loc_key)
+            offset = self.ir_arch.loc_db.get_location_offset(expr.loc_key)
             if offset is not None:
                 self.add_label_index(dst2index, loc_key)
                 return ("%s" % dst2index[loc_key], hex(offset))
@@ -367,7 +367,7 @@ class CGen(object):
             return out
 
         assert isinstance(dst, LocKey)
-        offset = self.ir_arch.loc_db.loc_key_to_offset(dst)
+        offset = self.ir_arch.loc_db.get_location_offset(dst)
         if offset is None:
             # Generate goto for local labels
             return ['goto %s;' % dst]
@@ -518,7 +518,7 @@ class CGen(object):
 
         last_instr = block.lines[-1]
         offset = last_instr.offset + last_instr.l
-        return self.ir_arch.loc_db.getby_offset_create(offset)
+        return self.ir_arch.loc_db.get_or_create_offset_location(offset)
 
     def gen_init(self, block):
         """
@@ -528,7 +528,7 @@ class CGen(object):
 
         instr_offsets = [line.offset for line in block.lines]
         post_label = self.get_block_post_label(block)
-        post_offset = self.ir_arch.loc_db.loc_key_to_offset(post_label)
+        post_offset = self.ir_arch.loc_db.get_location_offset(post_label)
         instr_offsets.append(post_offset)
         lbl_start = block.loc_key
         return (self.CODE_INIT % lbl_start).split("\n"), instr_offsets
@@ -564,7 +564,7 @@ class CGen(object):
         """
 
         loc_key = self.get_block_post_label(block)
-        offset = self.ir_arch.loc_db.loc_key_to_offset(loc_key)
+        offset = self.ir_arch.loc_db.get_location_offset(loc_key)
         dst = self.dst_to_c(offset)
         code = self.CODE_RETURN_NO_EXCEPTION % (loc_key, self.C_PC, dst, dst)
         return code.split('\n')
diff --git a/miasm2/jitter/jitcore.py b/miasm2/jitter/jitcore.py
index 8084fe56..a26d4c9f 100644
--- a/miasm2/jitter/jitcore.py
+++ b/miasm2/jitter/jitcore.py
@@ -101,7 +101,7 @@ class JitCore(object):
             cur_block.ad_max = cur_block.lines[-1].offset + cur_block.lines[-1].l
         else:
             # 1 byte block for unknown mnemonic
-            offset = ir_arch.loc_db.loc_key_to_offset(cur_block.loc_key)
+            offset = ir_arch.loc_db.get_location_offset(cur_block.loc_key)
             cur_block.ad_min = offset
             cur_block.ad_max = offset+1
 
@@ -138,7 +138,7 @@ class JitCore(object):
 
         # Get the block
         if isinstance(addr, LocKey):
-            addr = self.ir_arch.loc_db.loc_key_to_offset(addr)
+            addr = self.ir_arch.loc_db.get_location_offset(addr)
             if addr is None:
                 raise RuntimeError("Unknown offset for LocKey")
 
@@ -253,13 +253,13 @@ class JitCore(object):
             try:
                 for irblock in block.blocks:
                     # Remove offset -> jitted block link
-                    offset = self.ir_arch.loc_db.loc_key_to_offset(irblock.loc_key)
+                    offset = self.ir_arch.loc_db.get_location_offset(irblock.loc_key)
                     if offset in self.offset_to_jitted_func:
                         del(self.offset_to_jitted_func[offset])
 
             except AttributeError:
                 # The block has never been translated in IR
-                offset = self.ir_arch.loc_db.loc_key_to_offset(block.loc_key)
+                offset = self.ir_arch.loc_db.get_location_offset(block.loc_key)
                 if offset in self.offset_to_jitted_func:
                     del(self.offset_to_jitted_func[offset])
 
@@ -293,7 +293,7 @@ class JitCore(object):
         @block: asmblock
         """
         block_raw = "".join(line.b for line in block.lines)
-        offset = self.ir_arch.loc_db.loc_key_to_offset(block.loc_key)
+        offset = self.ir_arch.loc_db.get_location_offset(block.loc_key)
         block_hash = md5("%X_%s_%s_%s_%s" % (offset,
                                              self.arch_name,
                                              self.log_mn,
diff --git a/miasm2/jitter/jitcore_gcc.py b/miasm2/jitter/jitcore_gcc.py
index c7ffdd01..dbaa2a08 100644
--- a/miasm2/jitter/jitcore_gcc.py
+++ b/miasm2/jitter/jitcore_gcc.py
@@ -28,7 +28,7 @@ class JitCore_Gcc(JitCore_Cc_Base):
         lib = ctypes.cdll.LoadLibrary(fname_so)
         func = getattr(lib, self.FUNCNAME)
         addr = ctypes.cast(func, ctypes.c_void_p).value
-        offset = self.ir_arch.loc_db.loc_key_to_offset(label)
+        offset = self.ir_arch.loc_db.get_location_offset(label)
         self.offset_to_jitted_func[offset] = addr
         self.states[offset] = lib
 
diff --git a/miasm2/jitter/jitcore_llvm.py b/miasm2/jitter/jitcore_llvm.py
index 397c73f9..ea4f20ec 100644
--- a/miasm2/jitter/jitcore_llvm.py
+++ b/miasm2/jitter/jitcore_llvm.py
@@ -118,5 +118,5 @@ class JitCore_LLVM(jitcore.JitCore):
 
         # Store a pointer on the function jitted code
         loc_key = block.loc_key
-        offset = self.ir_arch.loc_db.loc_key_to_offset(loc_key)
+        offset = self.ir_arch.loc_db.get_location_offset(loc_key)
         self.offset_to_jitted_func[offset] = ptr
diff --git a/miasm2/jitter/jitcore_python.py b/miasm2/jitter/jitcore_python.py
index 5ca07c38..fa751a68 100644
--- a/miasm2/jitter/jitcore_python.py
+++ b/miasm2/jitter/jitcore_python.py
@@ -127,7 +127,7 @@ class JitCore_Python(jitcore.JitCore):
                     raise NotImplementedError("Type not handled: %s" % ad)
 
         # Associate myfunc with current loc_key
-        offset = self.ir_arch.loc_db.loc_key_to_offset(loc_key)
+        offset = self.ir_arch.loc_db.get_location_offset(loc_key)
         assert offset is not None
         self.offset_to_jitted_func[offset] = myfunc
 
diff --git a/miasm2/jitter/llvmconvert.py b/miasm2/jitter/llvmconvert.py
index 09aafa71..d63351cc 100644
--- a/miasm2/jitter/llvmconvert.py
+++ b/miasm2/jitter/llvmconvert.py
@@ -625,7 +625,7 @@ class LLVMFunction():
             return ret
 
         if expr.is_loc():
-            offset = self.llvm_context.ir_arch.loc_db.loc_key_to_offset(expr.loc_key)
+            offset = self.llvm_context.ir_arch.loc_db.get_location_offset(expr.loc_key)
             ret = llvm_ir.Constant(LLVMType.IntType(expr.size), offset)
             self.update_cache(expr, ret)
             return ret
@@ -1099,13 +1099,13 @@ class LLVMFunction():
         self.main_stream = False
 
         if isinstance(dst, ExprInt):
-            loc_key = self.llvm_context.ir_arch.loc_db.getby_offset_create(int(dst))
+            loc_key = self.llvm_context.ir_arch.loc_db.get_or_create_offset_location(int(dst))
             dst = ExprLoc(loc_key, dst.size)
 
         if isinstance(dst, ExprLoc):
             loc_key = dst.loc_key
             bbl = self.get_basic_block_by_loc_key(loc_key)
-            offset = self.llvm_context.ir_arch.loc_db.loc_key_to_offset(loc_key)
+            offset = self.llvm_context.ir_arch.loc_db.get_location_offset(loc_key)
             if bbl is not None:
                 # "local" jump, inside this function
                 if offset is None:
@@ -1234,7 +1234,7 @@ class LLVMFunction():
                     ExprId("status", 32))
         self.affect(t_size(m2_csts.EXCEPT_UNK_MNEMO),
                     m2_exception_flag)
-        offset = self.llvm_context.ir_arch.loc_db.loc_key_to_offset(asmblock.loc_key)
+        offset = self.llvm_context.ir_arch.loc_db.get_location_offset(asmblock.loc_key)
         self.set_ret(LLVMType.IntType(64)(offset))
 
     def gen_finalize(self, asmblock, codegen):
@@ -1280,7 +1280,7 @@ class LLVMFunction():
             # Else Block
             builder.position_at_end(else_block)
             PC = self.llvm_context.PC
-            next_label_offset = self.llvm_context.ir_arch.loc_db.loc_key_to_offset(next_label)
+            next_label_offset = self.llvm_context.ir_arch.loc_db.get_location_offset(next_label)
             to_ret = LLVMType.IntType(PC.size)(next_label_offset)
             self.affect(to_ret, PC)
             self.set_ret(to_ret)
@@ -1317,7 +1317,7 @@ class LLVMFunction():
         # Create basic blocks (for label branchs)
         entry_bbl, builder = self.entry_bbl, self.builder
         for instr in asmblock.lines:
-            lbl = self.llvm_context.ir_arch.loc_db.getby_offset_create(instr.offset)
+            lbl = self.llvm_context.ir_arch.loc_db.get_or_create_offset_location(instr.offset)
             self.append_basic_block(lbl)
 
         # TODO: merge duplicate code with CGen
@@ -1333,7 +1333,7 @@ class LLVMFunction():
                                                   default_value=eltype(0))
                 self.local_vars_pointers[element.name] = ptr
             loc_key = codegen.get_block_post_label(asmblock)
-            offset = self.llvm_context.ir_arch.loc_db.loc_key_to_offset(loc_key)
+            offset = self.llvm_context.ir_arch.loc_db.get_location_offset(loc_key)
             instr_offsets.append(offset)
             self.append_basic_block(loc_key)