mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
[yul-phaser] Change default metric weights so that everything has a cost
- The CodeSize::DefaultWeights gives zeros to instructions that it assumes will be optimised out. Obviously, we cannot make this assumption here since phaser is meant to find the best way for the optimiser to work.
This commit is contained in:
parent
b776021870
commit
bff012c76d
@ -680,9 +680,11 @@ Phaser::CommandLineDescription Phaser::buildCommandLineDescription()
|
||||
|
||||
po::options_description metricWeightDescription("METRIC WEIGHTS", lineLength, minDescriptionLength);
|
||||
metricWeightDescription.add_options()
|
||||
("expression-statement-cost", po::value<size_t>()->value_name("<COST>")->default_value(0))
|
||||
("assignment-cost", po::value<size_t>()->value_name("<COST>")->default_value(0))
|
||||
("variable-declaration-cost", po::value<size_t>()->value_name("<COST>")->default_value(0))
|
||||
// TODO: We need to figure out the best set of weights for the phaser.
|
||||
// This one is just a stopgap to make sure no statement or expression has zero cost.
|
||||
("expression-statement-cost", po::value<size_t>()->value_name("<COST>")->default_value(1))
|
||||
("assignment-cost", po::value<size_t>()->value_name("<COST>")->default_value(1))
|
||||
("variable-declaration-cost", po::value<size_t>()->value_name("<COST>")->default_value(1))
|
||||
("function-definition-cost", po::value<size_t>()->value_name("<COST>")->default_value(1))
|
||||
("if-cost", po::value<size_t>()->value_name("<COST>")->default_value(2))
|
||||
("switch-cost", po::value<size_t>()->value_name("<COST>")->default_value(1))
|
||||
@ -691,9 +693,9 @@ Phaser::CommandLineDescription Phaser::buildCommandLineDescription()
|
||||
("break-cost", po::value<size_t>()->value_name("<COST>")->default_value(2))
|
||||
("continue-cost", po::value<size_t>()->value_name("<COST>")->default_value(2))
|
||||
("leave-cost", po::value<size_t>()->value_name("<COST>")->default_value(2))
|
||||
("block-cost", po::value<size_t>()->value_name("<COST>")->default_value(0))
|
||||
("block-cost", po::value<size_t>()->value_name("<COST>")->default_value(1))
|
||||
("function-call-cost", po::value<size_t>()->value_name("<COST>")->default_value(1))
|
||||
("identifier-cost", po::value<size_t>()->value_name("<COST>")->default_value(0))
|
||||
("identifier-cost", po::value<size_t>()->value_name("<COST>")->default_value(1))
|
||||
("literal-cost", po::value<size_t>()->value_name("<COST>")->default_value(1))
|
||||
;
|
||||
keywordDescription.add(metricWeightDescription);
|
||||
|
Loading…
Reference in New Issue
Block a user