diff options
author | chriseth <chris@ethereum.org> | 2018-12-07 07:56:16 +0800 |
---|---|---|
committer | chriseth <chris@ethereum.org> | 2018-12-12 02:24:44 +0800 |
commit | fb3a0ac1c7d2c4624df6ae62d290a2de7768d036 (patch) | |
tree | 72a8593bf822032ecf50dbc8e1c78e899a5befd4 /libyul/Dialect.h | |
parent | 8d49e539951791a25a63f470e8a9935679c7404f (diff) | |
download | dexon-solidity-fb3a0ac1c7d2c4624df6ae62d290a2de7768d036.tar.gz dexon-solidity-fb3a0ac1c7d2c4624df6ae62d290a2de7768d036.tar.zst dexon-solidity-fb3a0ac1c7d2c4624df6ae62d290a2de7768d036.zip |
Codegen for object access.
Diffstat (limited to 'libyul/Dialect.h')
-rw-r--r-- | libyul/Dialect.h | 37 |
1 files changed, 10 insertions, 27 deletions
diff --git a/libyul/Dialect.h b/libyul/Dialect.h index b78f1aaf..2def566c 100644 --- a/libyul/Dialect.h +++ b/libyul/Dialect.h @@ -22,7 +22,9 @@ #include <libyul/YulString.h> -#include <memory> +#include <boost/noncopyable.hpp> + +#include <vector> namespace yul { @@ -45,38 +47,19 @@ struct BuiltinFunction bool movable; }; -/** - * Class to query for builtin functions and their semantics. - */ -struct Builtins +struct Dialect: boost::noncopyable { - virtual ~Builtins() = default; + AsmFlavour const flavour = AsmFlavour::Loose; /// @returns the builtin function of the given name or a nullptr if it is not a builtin function. - virtual BuiltinFunction const* query(YulString /*_name*/) const { return nullptr; } -}; + virtual BuiltinFunction const* builtin(YulString /*_name*/) const { return nullptr; } -struct Dialect -{ - AsmFlavour flavour = AsmFlavour::Loose; - std::shared_ptr<Builtins> builtins; + Dialect(AsmFlavour _flavour): flavour(_flavour) {} + virtual ~Dialect() {} - Dialect(AsmFlavour _flavour, std::shared_ptr<Builtins> _builtins): - flavour(_flavour), builtins(std::move(_builtins)) - {} - static Dialect looseAssemblyForEVM() - { - return Dialect{AsmFlavour::Loose, std::make_shared<Builtins>()}; - } - static Dialect strictAssemblyForEVM() - { - // The EVM instructions will be moved to builtins at some point. - return Dialect{AsmFlavour::Strict, std::make_shared<Builtins>()}; - } - static Dialect strictAssemblyForEVMObjects(); - static Dialect yul() + static std::shared_ptr<Dialect> yul() { // Will have to add builtins later. - return Dialect{AsmFlavour::Yul, std::make_shared<Builtins>()}; + return std::make_shared<Dialect>(AsmFlavour::Yul); } }; |