liboilfunction.h File Reference

OIL_CHECK_PROTOTYPE

OIL_CHECK_PROTOTYPE: :

Macro used internally to implement the --enable-prototype-checking configure option.

Enum OilImplFlag

OilImplFlag:

Implementation flags.

: is the reference implementation for the class.

: was compiled with alternate CFLAGS as specified by --enable-alternate-optimization.

: is written in assembly code.

: is disabled. This can be set either in the source code or during library initialization.

: uses the i386 instruction cmov or its variants.

: uses MMX instructions.

: uses SSE instructions.

: uses AMD's extended MMX instructions. These are a subset of what Intel calls SSE2. If an implementation uses only AMD's extended MMX instructions, it should set this flag, and not .

: uses SSE2 instructions. This flag implies and .

: uses 3DNow! instructions.

: uses extended 3DNow! instructions.

: uses SSE3 instructions. This flag implies .

: uses SSSE3 instructions. This flag implies .

: uses Altivec instructions.

OIL_OPT_MANGLE

OIL_OPT_MANGLE:

Used internally to implement the --enable-alternate-optimizations configure option. OIL_OPT_FLAG_MANGLE:

Used internally to implement the --enable-alternate-optimizations configure option. OIL_NO_CLASSES:

Used internally to implement the --enable-alternate-optimizations configure option. OIL_OPT_SUFFIX:

Used internally to implement the --enable-alternate-optimizations configure option.

OIL_OPT_FLAG_MANGLE

OIL_OPT_SUFFIX

OIL_GET

OIL_GET: : : :

Offsets by number of bytes, and dereferences it as type . Note that the offset is in bytes, and not in the size of the pointer type.

OIL_OFFSET

OIL_OFFSET: : :

Add bytes to the pointer .

OIL_INCREMENT

OIL_INCREMENT: : :

Increments the pointer by number of bytes.

OIL_CPU_FLAG_MASK

OIL_CPU_FLAG_MASK:

Mask describing which bits in OilImplFlag depend on the current CPU.

OIL_DECLARE_CLASS

OIL_DECLARE_CLASS: : the name of a function class (without the oil_ prefix)

Declares the Liboil function class .

OIL_DEFINE_CLASS_FULL

SECTION:liboilmacros : Macros : Macros OIL_DEFINE_CLASS_FULL: : name of class to declare (without oil_ prefix) : prototype of class Test: test function

Defines a OilFunctionClass structure for . Classes defined this way will be automatically at Liboil initialization time.

OIL_DEFINE_CLASS

OIL_DEFINE_CLASS: : name of class to declare (without oil_ prefix) : prototype of class

Defines a OilFunctionClass structure for . Classes defined this way will be automatically at Liboil initialization time.

OIL_DEFINE_IMPL_FULL

OIL_DEFINE_IMPL_FULL: : name of function : name of class to declare (without oil_ prefix) : implementation flags and CPU requirements

Defines a OilFunctionImpl structure for the function and class . CPU-dependent flags in will indicate that this implementation requires the given CPU flags.

OIL_DEFINE_IMPL

OIL_DEFINE_IMPL: : name of function : name of class to declare (without oil_ prefix)

Shorthand for defining a C implementation. See OIL_DEFINE_IMPL_FULL().

OIL_DEFINE_IMPL_REF

OIL_DEFINE_IMPL_REF: : name of function : name of class to declare (without oil_ prefix)

Shorthand for defining a reference implementation. See OIL_DEFINE_IMPL_FULL().

OIL_DEFINE_IMPL_ASM

OIL_DEFINE_IMPL_ASM: : name of function : name of class to declare (without oil_ prefix)

Shorthand for defining an implementation written in inline assembly code. See OIL_DEFINE_IMPL_FULL().

OIL_DEFINE_IMPL_DEPENDS

OIL_DEFINE_IMPL_DEPENDS : name of function : name of class to declare (without oil_ prefix) @...: other classes this implementation uses

Shorthand for defining an implementation that uses another Liboil function class. This is not currently used. See OIL_DEFINE_IMPL_FULL().

oil_optimize_all ( void )

IMPORT_C voidoil_optimize_all(void)

oil_optimize_all:

Optimize all function classes.

oil_optimize ( const char * )

IMPORT_C voidoil_optimize(const char *class_name)

oil_optimize: : a string

Optimize the function class that has the name specified by .

oil_class_get_by_index ( int )

IMPORT_C OilFunctionClass *oil_class_get_by_index(inti)

oil_class_get_by_index: : index

Returns a pointer to the function class with index .

Returns: an

oil_class_get ( const char * )

IMPORT_C OilFunctionClass *oil_class_get(const char *class_name)

oil_class_get: : the name of the function class

Returns a pointer to the function class that has the given class name. If no such class is found, NULL is returned.

Returns: a pointer to a function class

oil_class_optimize ( OilFunctionClass * )

IMPORT_C voidoil_class_optimize(OilFunctionClass *klass)

oil_class_optimize: : a function class

Tests and profiles each implementation for the given function class. Testing compares the output of running each implementation on random input against the reference implementation for the same input.

oil_class_get_n_classes ( void )

IMPORT_C intoil_class_get_n_classes(void)

oil_class_get_n_classes:

Returns the number of function classes.

Returns: the number of function classes

oil_impl_get_by_index ( int )

IMPORT_C OilFunctionImpl *oil_impl_get_by_index(inti)

oil_impl_get_by_index: : index

Returns a pointer to the function implementation with index .

Returns: a pointer to a function implementation structure

oil_impl_is_runnable ( OilFunctionImpl * )

IMPORT_C intoil_impl_is_runnable(OilFunctionImpl *impl)

oil_impl_is_runnable: : an

Determines whether the function implementation given by can be executed by the current CPU.

Returns: 1 if the implementation can be executed, otherwise 0

oil_impl_is_usable ( OilFunctionImpl * )

IMPORT_C intoil_impl_is_usable(OilFunctionImpl *impl)

oil_impl_is_usable: : an

Determines whether the function implementation given by is useful, that is, it can be executed on the current CPU and passes tests.

Returns: 1 if the implementation can be used, otherwise 0

oil_class_choose_by_name ( OilFunctionClass *, const char * )

IMPORT_C voidoil_class_choose_by_name(OilFunctionClass *klass,
const char *name
)

oil_class_register_impl_full ( OilFunctionClass *, void(*)(void), const char *, unsigned int )

IMPORT_C voidoil_class_register_impl_full(OilFunctionClass *klass,
void(*)(void)func,
const char *name,
unsigned intflags
)

oil_class_register_impl ( OilFunctionClass *, OilFunctionImpl * )

IMPORT_C voidoil_class_register_impl(OilFunctionClass *klass,
OilFunctionImpl *impl
)

oil_class_register_impl: : the class : an implementation

Adds to the list of implementations associated with the function class given by .

oil_class_register_impl_by_name ( const char *, OilFunctionImpl * )

IMPORT_C voidoil_class_register_impl_by_name(const char *klass_name,
OilFunctionImpl *impl
)

oil_class_register_impl_by_name: : the name of the class : an implementation

Adds to the list of implementations associated with the function class given by .

oil_init_no_optimize ( void )

IMPORT_C voidoil_init_no_optimize(void)

oil_init_no_optimize:

Initialize liboil similar to oil_init(), but do not run the profiling stage. This function is mainly useful for internal programs.