OilFunctionImpl

OilFunctionImpl — Functions for manipulating function implementations.

Synopsis

                    OilFunctionImpl;
OilFunctionImpl *   oil_impl_get_by_index               (int i);
int                 oil_impl_is_runnable                (OilFunctionImpl *impl);
enum                OilImplFlag;
#define             OIL_CPU_FLAG_MASK
#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,...)

Description

Details

OilFunctionImpl

typedef struct {
} OilFunctionImpl;

An opaque structure representing a function implementation.


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 :

an OilFunctionImpl

Returns :

1 if the implementation can be executed, otherwise 0

enum OilImplFlag

typedef enum {
  OIL_IMPL_FLAG_REF = (1<<0),
  OIL_IMPL_FLAG_OPT = (1<<1),
  OIL_IMPL_FLAG_ASM = (1<<2),
  OIL_IMPL_FLAG_DISABLED = (1<<3),
  OIL_IMPL_FLAG_CMOV = (1<<16),
  OIL_IMPL_FLAG_MMX = (1<<17),
  OIL_IMPL_FLAG_SSE = (1<<18),
  OIL_IMPL_FLAG_MMXEXT = (1<<19),
  OIL_IMPL_FLAG_SSE2 = (1<<20),
  OIL_IMPL_FLAG_3DNOW = (1<<21),
  OIL_IMPL_FLAG_3DNOWEXT = (1<<22),
  OIL_IMPL_FLAG_SSE3 = (1<<23),
  OIL_IMPL_FLAG_ALTIVEC = (1<<24),
  OIL_IMPL_FLAG_EDSP = (1<<25),
  OIL_IMPL_FLAG_ARM6 = (1<<26),
  OIL_IMPL_FLAG_VFP = (1<<27),
  OIL_IMPL_FLAG_SSSE3 = (1<<28)
} OilImplFlag;

Implementation flags.

OIL_IMPL_FLAG_REF: is the reference implementation for the class.

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

OIL_IMPL_FLAG_ASM: is written in assembly code.

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

OIL_IMPL_FLAG_CMOV: uses the i386 instruction cmov or its variants.

OIL_IMPL_FLAG_MMX: uses MMX instructions.

OIL_IMPL_FLAG_SSE: uses SSE instructions.

OIL_IMPL_FLAG_MMXEXT: 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 OIL_IMPL_FLAG_SSE2.

OIL_IMPL_FLAG_SSE2: uses SSE2 instructions. This flag implies OIL_IMPL_FLAG_SSE and OIL_IMPL_FLAG_MMXEXT.

OIL_IMPL_FLAG_3DNOW: uses 3DNow! instructions.

OIL_IMPL_FLAG_3DNOWEXT: uses extended 3DNow! instructions.

OIL_IMPL_FLAG_SSE3: uses SSE3 instructions. This flag implies OIL_IMPL_FLAG_SSE2.

OIL_IMPL_FLAG_SSSE3: uses SSSE3 instructions. This flag implies OIL_IMPL_FLAG_SSE3.

OIL_IMPL_FLAG_ALTIVEC: uses Altivec instructions.


OIL_CPU_FLAG_MASK

#define OIL_CPU_FLAG_MASK 0xffff0000

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


OIL_DEFINE_IMPL_FULL()

#define             OIL_DEFINE_IMPL_FULL(function,klass,flags)

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

function :

name of function

klass :

name of class to declare (without oil_ prefix)

flags :

implementation flags and CPU requirements

OIL_DEFINE_IMPL()

#define             OIL_DEFINE_IMPL(function,klass)

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

function :

name of function

klass :

name of class to declare (without oil_ prefix)

OIL_DEFINE_IMPL_REF()

#define             OIL_DEFINE_IMPL_REF(function,klass)

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

function :

name of function

klass :

name of class to declare (without oil_ prefix)

OIL_DEFINE_IMPL_ASM()

#define             OIL_DEFINE_IMPL_ASM(function,klass)

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

function :

name of function

klass :

name of class to declare (without oil_ prefix)

OIL_DEFINE_IMPL_DEPENDS()

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

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

function :

name of function

klass :

name of class to declare (without oil_ prefix)

... :

other classes this implementation uses