forked from M-Labs/artiq
devices/runtime: register eh_raise service
This commit is contained in:
parent
a8df1703fb
commit
5244a63b55
@ -52,6 +52,8 @@ def _str_to_functype(s):
|
||||
class LinkInterface:
|
||||
def init_module(self, module):
|
||||
self.llvm_module = module.llvm_module
|
||||
|
||||
# syscalls
|
||||
self.var_arg_fixcount = dict()
|
||||
for func_name, func_type_str in _syscalls.items():
|
||||
var_arg_fixcount, func_type = _str_to_functype(func_type_str)
|
||||
@ -59,6 +61,10 @@ class LinkInterface:
|
||||
self.var_arg_fixcount[func_name] = var_arg_fixcount
|
||||
self.llvm_module.add_function(func_type, "__syscall_"+func_name)
|
||||
|
||||
# eh
|
||||
func_type = lc.Type.function(lc.Type.void(), [lc.Type.int()])
|
||||
self.llvm_module.add_function(func_type, "__eh_raise")
|
||||
|
||||
def syscall(self, syscall_name, args, builder):
|
||||
r = _chr_to_value[_syscalls[syscall_name][-1]]()
|
||||
if builder is not None:
|
||||
@ -73,6 +79,12 @@ class LinkInterface:
|
||||
r.auto_store(builder, builder.call(llvm_function, args))
|
||||
return r
|
||||
|
||||
def build_raise(self, eid, builder):
|
||||
if builder is not None:
|
||||
llvm_function = self.llvm_module.get_function_named(
|
||||
"__eh_raise")
|
||||
builder.call(llvm_function, [lc.Constant.int(lc.Type.int(), eid)])
|
||||
|
||||
|
||||
def _debug_dump_obj(obj):
|
||||
try:
|
||||
|
Loading…
Reference in New Issue
Block a user