mirror of https://github.com/m-labs/artiq.git
Bring back target print function.
This commit is contained in:
parent
ac5061c205
commit
f4ab507ab2
|
@ -47,4 +47,5 @@ def globals():
|
||||||
|
|
||||||
# ARTIQ utility functions
|
# ARTIQ utility functions
|
||||||
"rtio_log": builtins.fn_rtio_log(),
|
"rtio_log": builtins.fn_rtio_log(),
|
||||||
|
"core_log": builtins.fn_print(),
|
||||||
}
|
}
|
||||||
|
|
|
@ -73,6 +73,7 @@ class Target:
|
||||||
triple = "unknown"
|
triple = "unknown"
|
||||||
data_layout = ""
|
data_layout = ""
|
||||||
features = []
|
features = []
|
||||||
|
print_function = "printf"
|
||||||
|
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
|
@ -195,3 +196,4 @@ class OR1KTarget(Target):
|
||||||
triple = "or1k-linux"
|
triple = "or1k-linux"
|
||||||
data_layout = "E-m:e-p:32:32-i64:32-f64:32-v64:32-v128:32-a:0:32-n32"
|
data_layout = "E-m:e-p:32:32-i64:32-f64:32-v64:32-v128:32-a:0:32-n32"
|
||||||
features = ["mul", "div", "ffl1", "cmov", "addc"]
|
features = ["mul", "div", "ffl1", "cmov", "addc"]
|
||||||
|
print_function = "core_log"
|
||||||
|
|
|
@ -358,7 +358,7 @@ class LLVMIRGenerator:
|
||||||
llty = ll.FunctionType(llptr, [])
|
llty = ll.FunctionType(llptr, [])
|
||||||
elif name == "llvm.stackrestore":
|
elif name == "llvm.stackrestore":
|
||||||
llty = ll.FunctionType(llvoid, [llptr])
|
llty = ll.FunctionType(llvoid, [llptr])
|
||||||
elif name == "printf":
|
elif name == self.target.print_function:
|
||||||
llty = ll.FunctionType(llvoid, [llptr], var_arg=True)
|
llty = ll.FunctionType(llvoid, [llptr], var_arg=True)
|
||||||
elif name == "rtio_log":
|
elif name == "rtio_log":
|
||||||
llty = ll.FunctionType(llvoid, [lli64, llptr], var_arg=True)
|
llty = ll.FunctionType(llvoid, [lli64, llptr], var_arg=True)
|
||||||
|
@ -904,7 +904,8 @@ class LLVMIRGenerator:
|
||||||
elif insn.op in ("printf", "rtio_log"):
|
elif insn.op in ("printf", "rtio_log"):
|
||||||
# We only get integers, floats, pointers and strings here.
|
# We only get integers, floats, pointers and strings here.
|
||||||
llargs = map(self.map, insn.operands)
|
llargs = map(self.map, insn.operands)
|
||||||
return self.llbuilder.call(self.llbuiltin(insn.op), llargs,
|
func_name = self.target.print_function if insn.op == "printf" else insn.op
|
||||||
|
return self.llbuilder.call(self.llbuiltin(func_name), llargs,
|
||||||
name=insn.name)
|
name=insn.name)
|
||||||
elif insn.op == "exncast":
|
elif insn.op == "exncast":
|
||||||
# This is an identity cast at LLVM IR level.
|
# This is an identity cast at LLVM IR level.
|
||||||
|
|
|
@ -97,6 +97,8 @@ static const struct symbol runtime_exports[] = {
|
||||||
{"abort", &ksupport_abort},
|
{"abort", &ksupport_abort},
|
||||||
|
|
||||||
/* proxified syscalls */
|
/* proxified syscalls */
|
||||||
|
{"core_log", &core_log},
|
||||||
|
|
||||||
{"now", &now},
|
{"now", &now},
|
||||||
|
|
||||||
{"watchdog_set", &watchdog_set},
|
{"watchdog_set", &watchdog_set},
|
||||||
|
|
Loading…
Reference in New Issue