Try to depend only on the ir module being in scope.

Generated code should used qualified names assuming that `ir` is in
scope, not everything else.
This commit is contained in:
Jakob Stoklund Olesen
2017-07-28 16:13:51 -07:00
parent 1968ebad58
commit 6609d7baf4
9 changed files with 11 additions and 11 deletions

View File

@@ -39,7 +39,7 @@ class ValueType(object):
def rust_name(self):
# type: () -> str
return 'types::' + self.name.upper()
return 'ir::types::' + self.name.upper()
@staticmethod
def by_name(name):

View File

@@ -653,7 +653,7 @@ def emit_level2_hashtables(level2_hashtables, offt, level2_doc, fmt):
if entry:
fmt.line(
'Level2Entry ' +
'{{ opcode: Some(Opcode::{}), offset: {:#08x} }},'
'{{ opcode: Some(ir::Opcode::{}), offset: {:#08x} }},'
.format(entry.inst.camel_name, entry.offset))
else:
fmt.line(
@@ -678,7 +678,7 @@ def emit_level1_hashtable(cpumode, level1, offt, fmt):
# Empty hash table entry. Include the default legalization action.
if not level2:
fmt.format(
'Level1Entry {{ ty: types::VOID, log2len: !0, '
'Level1Entry {{ ty: ir::types::VOID, log2len: !0, '
'offset: 0, legalize: {} }},',
level1.legalize_code)
continue
@@ -686,7 +686,7 @@ def emit_level1_hashtable(cpumode, level1, offt, fmt):
if level2.ty is not None:
tyname = level2.ty.rust_name()
else:
tyname = 'types::VOID'
tyname = 'ir::types::VOID'
lcode = cpumode.isa.legalize_code(level2.legalize)

View File

@@ -350,10 +350,10 @@ def gen_typesets_table(fmt, type_sets):
fmt.comment('Table of value type sets.')
assert len(type_sets.table) <= typeset_limit, "Too many type sets"
with fmt.indented(
'const TYPE_SETS : [ValueTypeSet; {}] = ['
'const TYPE_SETS : [ir::instructions::ValueTypeSet; {}] = ['
.format(len(type_sets.table)), '];'):
for ts in type_sets.table:
with fmt.indented('ValueTypeSet {', '},'):
with fmt.indented('ir::instructions::ValueTypeSet {', '},'):
ts.emit_fields(fmt)