diff options
Diffstat (limited to 'libyul/Dialect.cpp')
-rw-r--r-- | libyul/Dialect.cpp | 53 |
1 files changed, 3 insertions, 50 deletions
diff --git a/libyul/Dialect.cpp b/libyul/Dialect.cpp index 99718787..f6985c17 100644 --- a/libyul/Dialect.cpp +++ b/libyul/Dialect.cpp @@ -20,57 +20,10 @@ #include <libyul/Dialect.h> +#include <libyul/Object.h> +#include <libyul/backends/evm/AbstractAssembly.h> + #include <map> using namespace yul; using namespace std; - -namespace -{ - -void addFunction( - map<YulString, BuiltinFunction>& _repository, - string const& _name, - size_t _params, - size_t _returns, - bool _movable -) -{ - _repository[YulString{_name}] = BuiltinFunction{ - YulString{_name}, - vector<Type>(_params), - vector<Type>(_returns), - _movable - }; -} - -class GenericBuiltins: public Builtins -{ -public: - GenericBuiltins(map<YulString, BuiltinFunction> const& _functions): m_functions(_functions) {} - BuiltinFunction const* query(YulString _name) const - { - auto it = m_functions.find(_name); - if (it != end(m_functions)) - return &it->second; - else - return nullptr; - } -private: - map<YulString, BuiltinFunction> const& m_functions; -}; - -} - -Dialect Dialect::strictAssemblyForEVMObjects() -{ - static map<YulString, BuiltinFunction> functions; - if (functions.empty()) - { - addFunction(functions, "datasize", 1, 1, true); - addFunction(functions, "dataoffset", 1, 1, true); - addFunction(functions, "datacopy", 3, 0, false); - } - // The EVM instructions will be moved to builtins at some point. - return Dialect{AsmFlavour::Strict, std::make_shared<GenericBuiltins>(functions)}; -} |