Tape Machine (#30)

Adds a tape machine way of executing the code.
The tape machine is a series of FunctionCall objects, which can either be called one by one, or be used to generate expressions to make up a function.

Reviewed-on: Rubydragon/MetagraphOptimization.jl#30
Co-authored-by: Anton Reinhard <anton.reinhard@proton.me>
Co-committed-by: Anton Reinhard <anton.reinhard@proton.me>
This commit is contained in:
2024-01-03 16:38:32 +01:00
committed by Anton Reinhard
parent 92e0eeaaef
commit 82ed774b7e
21 changed files with 398 additions and 502 deletions

View File

@ -1,3 +1,18 @@
"""
noop()
Function with no arguments, returns nothing, does nothing. Useful for noop [`FunctionCall`](@ref)s.
"""
@inline noop() = nothing
"""
unpack_identity(x::SVector)
Function taking an `SVector`, returning it unpacked.
"""
@inline unpack_identity(x::SVector{1, <:Any}) = x[1]
@inline unpack_identity(x) = x
"""
bytes_to_human_readable(bytes)
@ -104,6 +119,10 @@ function unroll_symbol_vector(vec::Vector)
return result
end
function unroll_symbol_vector(vec::SVector)
return unroll_symbol_vector(Vector(vec))
end
####################