class documentation

class CCompilerOpt(_Config, _Distutils, _Cache, _CCompiler, _Feature, _Parse):

View In Hierarchy

A helper class for CCompiler aims to provide extra build options to effectively control of compiler optimizations that are directly related to CPU features.
Method cpu​_baseline​_flags Returns a list of final CPU baseline compiler flags
Method cpu​_baseline​_names return a list of final CPU baseline feature names
Method cpu​_dispatch​_names return a list of final CPU dispatch feature names
Method generate​_dispatch​_header Generate the dispatch header which contains the #definitions and headers for platform-specific instruction-sets for the enabled CPU baseline and dispatch-able features.
Method is​_cached Returns True if the class loaded from the cache file
Method report Undocumented
Method try​_dispatch Compile one or more dispatch-able sources and generates object files, also generates abstract C config headers and macros that used later for the final runtime dispatching process.
Method __init__ Undocumented
Method ​_generate​_config Undocumented
Method ​_wrap​_target Undocumented
Instance Variable ​_requested​_baseline Undocumented
Instance Variable ​_requested​_dispatch Undocumented
Instance Variable hit​_cache Undocumented
Instance Variable sources​_status Undocumented

Inherited from _Config:

Method conf​_features​_partial No summary
Class Variable conf​_c​_prefix Undocumented
Class Variable conf​_c​_prefix​_ Undocumented
Class Variable conf​_cc​_flags Undocumented
Class Variable conf​_check​_path Undocumented
Class Variable conf​_features Undocumented
Class Variable conf​_min​_features Undocumented
Class Variable conf​_nocache Undocumented
Class Variable conf​_noopt Undocumented
Class Variable conf​_target​_groups Undocumented
Instance Variable conf​_cache​_factors Undocumented
Instance Variable conf​_tmp​_path Undocumented

Inherited from _Distutils:

Static Method dist​_error Raise a compiler error
Static Method dist​_fatal Raise a distutils error
Static Method dist​_load​_module Load a module from file, required by the abstract class '_Cache'.
Static Method dist​_log Print a console message
Static Method ​_dist​_str Return a string to print by log and errors.
Static Method ​_dist​_test​_spawn Undocumented
Method ​_dist​_test​_spawn​_paths Fix msvc SDK ENV path same as distutils do without it we get c1: fatal error C1356: unable to find mspdbcore.dll
Method dist​_compile Wrap CCompiler.compile()
Method dist​_info No summary
Method dist​_test Return True if 'CCompiler.compile()' able to compile a source file with certain flags.
Class Variable ​_dist​_warn​_regex Undocumented
Instance Variable ​_ccompiler Undocumented
Instance Variable ​_dist​_info Undocumented

Inherited from _Cache:

Static Method me A static method that can be treated as a decorator to dynamically cache certain methods.
Method __del__ Undocumented
Method cache​_flush Force update the cache.
Method cache​_hash Undocumented
Class Variable ​_cache​_ignore Undocumented
Instance Variable ​_cache​_hash Undocumented
Instance Variable ​_cache​_path Undocumented
Instance Variable cache​_infile Undocumented
Instance Variable cache​_me Undocumented
Instance Variable cache​_private Undocumented

Inherited from _CCompiler:

Method ​_cc​_normalize​_unix Undocumented
Method ​_cc​_normalize​_win Undocumented
Method cc​_normalize​_flags Remove the conflicts that caused due gathering implied features flags.
Method cc​_test​_flags Returns True if the compiler supports 'flags'.
Class Variable ​_cc​_normalize​_arch​_ver Undocumented
Class Variable ​_cc​_normalize​_unix​_frgx Undocumented
Class Variable ​_cc​_normalize​_unix​_krgx Undocumented
Class Variable ​_cc​_normalize​_unix​_mrgx Undocumented
Class Variable ​_cc​_normalize​_win​_frgx Undocumented
Class Variable ​_cc​_normalize​_win​_mrgx Undocumented
Instance Variable cc​_flags Undocumented
Instance Variable cc​_is​_cached Undocumented
Instance Variable cc​_is​_gcc Undocumented
Instance Variable cc​_march Undocumented
Instance Variable cc​_name Undocumented
Instance Variable cc​_noopt Undocumented

Inherited from _Feature:

Method feature​_ahead Return list of features in 'names' after remove any implied features and keep the origins.
Method feature​_c​_preprocessor Generate C preprocessor definitions and include headers of a CPU feature.
Method feature​_can​_autovec check if the feature can be auto-vectorized by the compiler
Method feature​_detect Return a list of CPU features that required to be detected sorted from the lowest to highest interest.
Method feature​_extra​_checks Return a list of supported extra checks after testing them against the compiler.
Method feature​_flags Return a list of CPU features flags sorted from the lowest to highest interest.
Method feature​_get​_til No summary
Method feature​_implies Return a set of CPU features that implied by 'names'
Method feature​_implies​_c same as feature_implies() but combining 'names'
Method feature​_is​_exist Returns True if a certain feature is exist and covered within _Config.conf_features.
Method feature​_is​_supported Check if a certain CPU feature is supported by the platform and compiler.
Method feature​_names Returns a set of CPU feature names that supported by platform and the C compiler.
Method feature​_sorted Sort a list of CPU features ordered by the lowest interest.
Method feature​_test Test a certain CPU feature against the compiler through its own check file.
Method feature​_untied same as 'feature_ahead()' but if both features implied each other and keep the highest interest.
Instance Variable feature​_is​_cached Undocumented
Instance Variable feature​_min Undocumented
Instance Variable feature​_supported Undocumented

Inherited from _Parse:

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
Method parse​_targets No summary
Class Variable ​_parse​_regex​_arg Undocumented
Class Variable ​_parse​_regex​_target Undocumented
Instance Variable ​_parse​_policies Undocumented
Instance Variable parse​_baseline​_flags Undocumented
Instance Variable parse​_baseline​_names Undocumented
Instance Variable parse​_dispatch​_names Undocumented
Instance Variable parse​_is​_cached Undocumented
Instance Variable parse​_target​_groups Undocumented
def cpu_baseline_flags(self):
Returns a list of final CPU baseline compiler flags
def cpu_baseline_names(self):
return a list of final CPU baseline feature names
def cpu_dispatch_names(self):
return a list of final CPU dispatch feature names
def generate_dispatch_header(self, header_path):

Generate the dispatch header which contains the #definitions and headers for platform-specific instruction-sets for the enabled CPU baseline and dispatch-able features.

Its highly recommended to take a look at the generated header also the generated source files via try_dispatch() in order to get the full picture.

def is_cached(self):
Returns True if the class loaded from the cache file
def report(self, full=False):

Undocumented

def try_dispatch(self, sources, src_dir=None, ccompiler=None, **kwargs):

Compile one or more dispatch-able sources and generates object files, also generates abstract C config headers and macros that used later for the final runtime dispatching process.

The mechanism behind it is to takes each source file that specified in 'sources' and branching it into several files depend on special configuration statements that must be declared in the top of each source which contains targeted CPU features, then it compiles every branched source with the proper compiler flags.

Parameters

sources : list
Must be a list of dispatch-able sources file paths, and configuration statements must be declared inside each file.
src_dir : str
Path of parent directory for the generated headers and wrapped sources. If None(default) the files will generated in-place.
ccompiler: CCompiler
Distutils CCompiler instance to be used for compilation. If None (default), the provided instance during the initialization will be used instead.
**kwargs : any
Arguments to pass on to the CCompiler.compile()

Returns

list : generated object files

Raises

CompileError
Raises by CCompiler.compile() on compiling failure.
DistutilsError
Some errors during checking the sanity of configuration statements.

See Also

parse_targets :
Parsing the configuration statements of dispatch-able sources.
def __init__(self, ccompiler, cpu_baseline='min', cpu_dispatch='max', cache_path=None):
def _generate_config(self, output_dir, dispatch_src, targets, has_baseline=False):

Undocumented

def _wrap_target(self, output_dir, dispatch_src, target, nochange=False):

Undocumented

_requested_baseline =

Undocumented

_requested_dispatch =

Undocumented

hit_cache =

Undocumented

sources_status =

Undocumented