OilFunction

OilFunction —

Synopsis




#define     LIBOIL_CHECK_PROTOTYPE          (a)
#define     OIL_OPT_MANGLE                  (a)
#define     OIL_OPT_FLAG_MANGLE             (a)
#define     OIL_NO_CLASSES
#define     OIL_OPT_SUFFIX
            OilFunctionImpl;
#define     OIL_GET                         (ptr, offset, type)
#define     OIL_OFFSET                      (ptr, offset)
#define     OIL_INCREMENT                   (ptr, offset)
#define     OIL_IMPL_FLAG_REF
#define     OIL_IMPL_FLAG_OPT
#define     OIL_IMPL_FLAG_ASM
#define     OIL_IMPL_FLAG_DISABLED
#define     OIL_CPU_FLAG_MASK
#define     OIL_IMPL_FLAG_CMOV
#define     OIL_IMPL_FLAG_MMX
#define     OIL_IMPL_FLAG_SSE
#define     OIL_IMPL_FLAG_MMXEXT
#define     OIL_IMPL_FLAG_SSE2
#define     OIL_IMPL_FLAG_3DNOW
#define     OIL_IMPL_FLAG_3DNOWEXT
#define     OIL_IMPL_FLAG_ALTIVEC
#define     OIL_DECLARE_CLASS               (klass)
#define     OIL_DEFINE_CLASS_FULL           (klass, string, test)
#define     OIL_DEFINE_CLASS                (klass, string)
#define     OIL_DEFINE_IMPL_FULL            (function,klass,flags)
#define     OIL_DEFINE_IMPL                 (function,klass)
#define     OIL_DEFINE_IMPL_REF             (function,klass)
#define     OIL_DEFINE_IMPL_ASM             (function,klass)
#define     OIL_DEFINE_IMPL_DEPENDS         (function,klass,...)
void        oil_optimize_all                (void);
void        oil_optimize                    (const char *class_name);
OilFunctionClass* oil_class_get_by_index    (int i);
OilFunctionClass* oil_class_get             (const char *class_name);
void        oil_class_optimize              (OilFunctionClass *klass);
int         oil_class_get_n_classes         (void);
OilFunctionImpl* oil_impl_get_by_index      (int i);
int         oil_impl_is_runnable            (OilFunctionImpl *impl);
void        oil_class_choose_by_name        (OilFunctionClass *klass,
                                             const char *name);
void        oil_class_register_impl_by_name (const char *klass_name,
                                             OilFunctionImpl *impl);

Description

Details

LIBOIL_CHECK_PROTOTYPE()

#define     LIBOIL_CHECK_PROTOTYPE(a)

a :

OIL_OPT_MANGLE()

#define OIL_OPT_MANGLE(a) a

a :

OIL_OPT_FLAG_MANGLE()

#define     OIL_OPT_FLAG_MANGLE(a)

a :

OIL_NO_CLASSES

#define OIL_NO_CLASSES


OIL_OPT_SUFFIX

#define OIL_OPT_SUFFIX


OilFunctionImpl

typedef struct {
	void *next;
	OilFunctionClass *klass;
	void *func;
	unsigned int flags;
	const char *name;
        double profile_ave;
        double profile_std;
} OilFunctionImpl;


OIL_GET()

#define OIL_GET(ptr, offset, type) (*(type *)((uint8_t *)ptr + offset) )

ptr :
offset :
type :

OIL_OFFSET()

#define OIL_OFFSET(ptr, offset) ((void *)((uint8_t *)ptr + offset) )

ptr :
offset :

OIL_INCREMENT()

#define OIL_INCREMENT(ptr, offset) (ptr = (void *)((uint8_t *)ptr + offset) )

ptr :
offset :

OIL_IMPL_FLAG_REF

#define OIL_IMPL_FLAG_REF	(1<<0)


OIL_IMPL_FLAG_OPT

#define OIL_IMPL_FLAG_OPT	(1<<1)


OIL_IMPL_FLAG_ASM

#define OIL_IMPL_FLAG_ASM	(1<<2)


OIL_IMPL_FLAG_DISABLED

#define OIL_IMPL_FLAG_DISABLED	(1<<3)


OIL_CPU_FLAG_MASK

#define OIL_CPU_FLAG_MASK 0xffff0000


OIL_IMPL_FLAG_CMOV

#define OIL_IMPL_FLAG_CMOV              (1<<16)


OIL_IMPL_FLAG_MMX

#define OIL_IMPL_FLAG_MMX               (1<<17)


OIL_IMPL_FLAG_SSE

#define OIL_IMPL_FLAG_SSE               (1<<18)


OIL_IMPL_FLAG_MMXEXT

#define OIL_IMPL_FLAG_MMXEXT            (1<<19)


OIL_IMPL_FLAG_SSE2

#define OIL_IMPL_FLAG_SSE2              (1<<20)


OIL_IMPL_FLAG_3DNOW

#define OIL_IMPL_FLAG_3DNOW             (1<<21)


OIL_IMPL_FLAG_3DNOWEXT

#define OIL_IMPL_FLAG_3DNOWEXT          (1<<22)


OIL_IMPL_FLAG_ALTIVEC

#define OIL_IMPL_FLAG_ALTIVEC       (1<<16)


OIL_DECLARE_CLASS()

#define     OIL_DECLARE_CLASS(klass)

klass :

OIL_DEFINE_CLASS_FULL()

#define     OIL_DEFINE_CLASS_FULL(klass, string, test)

klass :
string :
test :

OIL_DEFINE_CLASS()

#define     OIL_DEFINE_CLASS(klass, string)

klass :
string :

OIL_DEFINE_IMPL_FULL()

#define     OIL_DEFINE_IMPL_FULL(function,klass,flags)

function :
klass :
flags :

OIL_DEFINE_IMPL()

#define     OIL_DEFINE_IMPL(function,klass)

function :
klass :

OIL_DEFINE_IMPL_REF()

#define     OIL_DEFINE_IMPL_REF(function,klass)

function :
klass :

OIL_DEFINE_IMPL_ASM()

#define     OIL_DEFINE_IMPL_ASM(function,klass)

function :
klass :

OIL_DEFINE_IMPL_DEPENDS()

#define     OIL_DEFINE_IMPL_DEPENDS(function,klass,...)

function :
klass :
... :

oil_optimize_all ()

void        oil_optimize_all                (void);

Optimizes all function classes.


oil_optimize ()

void        oil_optimize                    (const char *class_name);

Optimizes function class given by class_name.

class_name : name of function class to optimize

oil_class_get_by_index ()

OilFunctionClass* oil_class_get_by_index    (int i);

Returns a pointer to the function class with index i.

i : index of function class
Returns : a pointer to a function class structure

oil_class_get ()

OilFunctionClass* oil_class_get             (const char *class_name);

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

class_name : the name of the function class
Returns : a pointer to a function class

oil_class_optimize ()

void        oil_class_optimize              (OilFunctionClass *klass);

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.

klass : a function class

oil_class_get_n_classes ()

int         oil_class_get_n_classes         (void);

Returns : the number of function classes

oil_impl_get_by_index ()

OilFunctionImpl* oil_impl_get_by_index      (int i);

Returns a pointer to the function implementation with index i.

i : index
Returns : a pointer to a function implementation structure

oil_impl_is_runnable ()

int         oil_impl_is_runnable            (OilFunctionImpl *impl);

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

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

oil_class_choose_by_name ()

void        oil_class_choose_by_name        (OilFunctionClass *klass,
                                             const char *name);

Sets the chosen implementation for the given function class to the implementation with the given name. If no implementation having the given name is found, the chosen implementation is not changed.

klass : a function class
name : the name of an implementation

oil_class_register_impl_by_name ()

void        oil_class_register_impl_by_name (const char *klass_name,
                                             OilFunctionImpl *impl);

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

klass_name : the name of the class
impl : an implementation