mirror of
https://github.com/ton-blockchain/ton
synced 2025-03-09 15:40:10 +00:00
Add pragmas to funC for precise control of computation order (#589)
* FunC pragmas: allow-post-modification and compute-asm-ltr * Warn if #pragma is enabled only in included files * Add tests for new pragmas * Add special ops for "allow-post-modification" only when needed * Update FunC version to 0.4.1 * Allow empty inlines (#10) Co-authored-by: SpyCheese <mikle98@yandex.ru>
This commit is contained in:
parent
6b49d6a382
commit
653c88aa9d
8 changed files with 344 additions and 61 deletions
|
@ -36,6 +36,8 @@ namespace funC {
|
|||
int verbosity, indent, opt_level = 2;
|
||||
bool stack_layout_comments, op_rewrite_comments, program_envelope, asm_preamble;
|
||||
bool interactive = false;
|
||||
GlobalPragma pragma_allow_post_modification{"allow-post-modification"};
|
||||
GlobalPragma pragma_compute_asm_ltr{"compute-asm-ltr"};
|
||||
std::string generated_from, boc_output_filename;
|
||||
|
||||
/*
|
||||
|
@ -194,7 +196,7 @@ int func_proceed(const std::vector<std::string> &sources, std::ostream &outs, st
|
|||
int ok = 0, proc = 0;
|
||||
try {
|
||||
for (auto src : sources) {
|
||||
ok += funC::parse_source_file(src.c_str());
|
||||
ok += funC::parse_source_file(src.c_str(), {}, true);
|
||||
proc++;
|
||||
}
|
||||
if (funC::interactive) {
|
||||
|
@ -208,6 +210,8 @@ int func_proceed(const std::vector<std::string> &sources, std::ostream &outs, st
|
|||
if (!proc) {
|
||||
throw src::Fatal{"no source files, no output"};
|
||||
}
|
||||
pragma_allow_post_modification.check_enable_in_libs();
|
||||
pragma_compute_asm_ltr.check_enable_in_libs();
|
||||
return funC::generate_output(outs, errs);
|
||||
} catch (src::Fatal& fatal) {
|
||||
errs << "fatal: " << fatal << std::endl;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue