class documentation

A helper class that parsing main arguments of CCompilerOpt, also parsing configuration statements in dispatch-able sources.

Parameters
cpu_baselineminimal set of required CPU features or special options.
cpu_dispatchdispatched set of additional CPU features or special options.
Special options can be
  • MIN: Enables the minimum CPU features that utilized via _Config.conf_min_features
  • MAX: Enables all supported CPU features by the Compiler and platform.
  • NATIVE: Enables all CPU features that supported by the current machine.
  • NONE: Enables nothing
  • Operand +/-: remove or add features, useful with options MAX, MIN and NATIVE.
    NOTE: operand + is only added for nominal reason.
NOTES
  • Case-insensitive among all CPU features and special options.
  • Comma or space can be used as a separator.
  • If the CPU feature is not supported by the user platform or compiler, it will be skipped rather than raising a fatal error.
  • Any specified CPU features to 'cpu_dispatch' will be skipped if its part of CPU baseline features
  • 'cpu_baseline' force enables implied features.
Method __init__ Undocumented
Method parse_targets Fetch and parse configuration statements that required for defining the targeted CPU features, statements should be declared in the top of source in between C comment and start with a special mark @targets...
Instance Variable parse_baseline_flags Compiler flags of baseline features
Instance Variable parse_baseline_names Final CPU baseline's feature names(sorted from low to high)
Instance Variable parse_dispatch_names Final CPU dispatch-able feature names(sorted from low to high)
Instance Variable parse_is_cached Undocumented
Instance Variable parse_target_groups Dictionary containing initialized target groups that configured through class attribute conf_target_groups.
Method _parse_arg_features Undocumented
Method _parse_multi_target validate multi targets that defined between parentheses()
Method _parse_policy_autovec skip features that has no auto-vectorized support by compiler
Method _parse_policy_keepsort leave a notice that $keep_sort is on
Method _parse_policy_maxopt append the compiler optimization flags
Method _parse_policy_not_keepbase skip all baseline features
Method _parse_policy_not_keepsort sorted depend on the highest interest
Method _parse_policy_werror force warnings to treated as errors
Method _parse_target_tokens Undocumented
Method _parse_token_group validate group token
Method _parse_token_policy validate policy token
Class Variable _parse_regex_arg Undocumented
Class Variable _parse_regex_target Undocumented
Instance Variable _parse_policies Undocumented
def __init__(self, cpu_baseline, cpu_dispatch): (source)

Undocumented

def parse_targets(self, source): (source)

Fetch and parse configuration statements that required for defining the targeted CPU features, statements should be declared in the top of source in between C comment and start with a special mark @targets.

Configuration statements are sort of keywords representing CPU features names, group of statements and policies, combined together to determine the required optimization.

Parameters
source:strthe path of C source file.
Returns
  • bool, True if group has the 'baseline' option
  • list, list of CPU features
  • list, list of extra compiler flags
parse_baseline_flags: list = (source)

Compiler flags of baseline features

parse_baseline_names: list = (source)

Final CPU baseline's feature names(sorted from low to high)

parse_dispatch_names: list = (source)

Final CPU dispatch-able feature names(sorted from low to high)

parse_is_cached: bool = (source)

Undocumented

parse_target_groups: dict = (source)

Dictionary containing initialized target groups that configured through class attribute conf_target_groups.

The key is represent the group name and value is a tuple contains three items :

  • bool, True if group has the 'baseline' option.
  • list, list of CPU features.
  • list, list of extra compiler flags.
def _parse_arg_features(self, arg_name, req_features): (source)

Undocumented

def _parse_multi_target(self, targets): (source)

validate multi targets that defined between parentheses()

def _parse_policy_autovec(self, has_baseline, final_targets, extra_flags): (source)

skip features that has no auto-vectorized support by compiler

def _parse_policy_keepsort(self, has_baseline, final_targets, extra_flags): (source)

leave a notice that $keep_sort is on

def _parse_policy_maxopt(self, has_baseline, final_targets, extra_flags): (source)

append the compiler optimization flags

def _parse_policy_not_keepbase(self, has_baseline, final_targets, extra_flags): (source)

skip all baseline features

def _parse_policy_not_keepsort(self, has_baseline, final_targets, extra_flags): (source)

sorted depend on the highest interest

def _parse_policy_werror(self, has_baseline, final_targets, extra_flags): (source)

force warnings to treated as errors

def _parse_target_tokens(self, tokens): (source)

Undocumented

def _parse_token_group(self, token, has_baseline, final_targets, extra_flags): (source)

validate group token

def _parse_token_policy(self, token): (source)

validate policy token

_parse_regex_arg = (source)

Undocumented

_parse_regex_target = (source)

Undocumented

_parse_policies = (source)

Undocumented