Add a "colocated" flag to symbol references. (#298)

This adds a "colocated" flag to function and symbolic global variables which
indicates that they are defined along with the current function, so they can
use PC-relative addressing.

This also changes the function decl syntax; the name now always precedes the
signature, and the "function" keyword is no longer included.
This commit is contained in:
Dan Gohman
2018-04-13 15:00:09 -07:00
committed by GitHub
parent 645fa3e858
commit 0e57f3d0ea
46 changed files with 312 additions and 164 deletions

View File

@@ -370,9 +370,9 @@ class TypePredicate(object):
"""
Return Rust code for evaluating this predicate.
It is assumed that the context has `dfg` and `args` variables.
It is assumed that the context has `func` and `args` variables.
"""
return 'dfg.value_type(args[{}]) == {}'.format(
return 'func.dfg.value_type(args[{}]) == {}'.format(
self.value_arg, self.value_type.rust_name())
@@ -409,7 +409,7 @@ class CtrlTypePredicate(object):
"""
Return Rust code for evaluating this predicate.
It is assumed that the context has `dfg` and `inst` variables.
It is assumed that the context has `func` and `inst` variables.
"""
return 'dfg.ctrl_typevar(inst) == {}'.format(
return 'func.dfg.ctrl_typevar(inst) == {}'.format(
self.value_type.rust_name())