/usr/include/liboil-0.3/liboil/liboilfunction.h is in liboil0.3-dev 0.3.17-2ubuntu4.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 | /*
* LIBOIL - Library of Optimized Inner Loops
* Copyright (c) 2003,2004 David A. Schleef <ds@schleef.org>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _LIBOIL_FUNCTION_H_
#define _LIBOIL_FUNCTION_H_
#include <liboil/liboilutils.h>
#include <liboil/liboiltypes.h>
/**
* OIL_CHECK_PROTOTYPE:
* @a:
*
* Macro used internally to implement the --enable-prototype-checking
* configure option.
*/
#ifdef LIBOIL_STRICT_PROTOTYPES
#include <liboil/liboilfuncs.h>
#define OIL_CHECK_PROTOTYPE(a) a
#else
#define OIL_CHECK_PROTOTYPE(a)
#endif
OIL_BEGIN_DECLS
/**
* 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.
*
*/
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;
#ifdef OIL_ENABLE_UNSTABLE_API
/**
* 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.
*/
#ifndef OIL_OPT_MANGLE
#define OIL_OPT_MANGLE(a) a
#define OIL_OPT_FLAG_MANGLE(a) a
#else
#define OIL_NO_CLASSES
#define OIL_OPT_FLAG_MANGLE(a) (((a)&(~OIL_IMPL_FLAG_REF)) | OIL_IMPL_FLAG_OPT)
#endif
#ifndef OIL_OPT_SUFFIX
#define OIL_OPT_SUFFIX
#endif
/**
* OilFunctionClass:
*
* An opaque structure representing a function class.
*
*/
struct _OilFunctionClass {
/*< private >*/
void (*func)(void);
const char *name;
const char *desc;
OilTestFunction test_func;
OilFunctionImpl *first_impl;
OilFunctionImpl *reference_impl;
OilFunctionImpl *chosen_impl;
const char *prototype;
};
/**
* OilFunctionImpl:
*
* An opaque structure representing a function implementation.
*
*/
struct _OilFunctionImpl {
/*< private >*/
void *next;
OilFunctionClass *klass;
void (*func)(void);
unsigned int flags;
const char *name;
double profile_ave;
double profile_std;
};
/**
* OIL_GET:
* @ptr:
* @offset:
* @type:
*
* Offsets @ptr by @offset number of bytes, and dereferences it
* as type @type. Note that the offset is in bytes, and not in
* the size of the pointer type.
*/
#define OIL_GET(ptr, offset, type) (*(type *)((uint8_t *)(ptr) + (offset)) )
/**
* OIL_OFFSET:
* @ptr:
* @offset:
*
* Add @offset bytes to the pointer @ptr.
*/
#define OIL_OFFSET(ptr, offset) ((void *)((uint8_t *)(ptr) + (offset)) )
/**
* OIL_INCREMENT:
* @ptr:
* @offset:
*
* Increments the pointer @ptr by @offset number of bytes.
*/
#define OIL_INCREMENT(ptr, offset) (ptr = (void *)((uint8_t *)ptr + (offset)) )
/**
* OIL_CPU_FLAG_MASK:
*
* Mask describing which bits in #OilImplFlag depend on the current
* CPU.
*/
#define OIL_CPU_FLAG_MASK 0xffff0000
/**
* OIL_DECLARE_CLASS:
* @klass: the name of a function class (without the oil_ prefix)
*
* Declares the Liboil function class @klass.
*/
#define OIL_DECLARE_CLASS(klass) \
extern OilFunctionClass _oil_function_class_ ## klass
/**
* SECTION:liboilmacros
* @title: Macros
* @short_description: Macros
*/
#ifndef OIL_NO_CLASSES
/**
* OIL_DEFINE_CLASS_FULL:
* @klass: name of class to declare (without oil_ prefix)
* @string: prototype of class
* @test: test function
*
* Defines a #OilFunctionClass structure for @klass. Classes
* defined this way will be automatically at Liboil initialization
* time.
*/
#define OIL_DEFINE_CLASS_FULL(klass, string, test) \
OilFunctionClass _oil_function_class_ ## klass = { \
NULL, \
#klass , \
NULL, \
test, \
NULL, \
NULL, \
NULL, \
string \
}; \
OilFunctionClass *oil_function_class_ptr_ ## klass = \
&_oil_function_class_ ## klass
#else
#define OIL_DEFINE_CLASS_FULL(klass, string, test) \
OIL_DECLARE_CLASS(klass)
#endif
/**
* OIL_DEFINE_CLASS:
* @klass: name of class to declare (without oil_ prefix)
* @string: prototype of class
*
* Defines a #OilFunctionClass structure for @klass. Classes
* defined this way will be automatically at Liboil initialization
* time.
*/
#define OIL_DEFINE_CLASS(klass, string) \
OIL_DEFINE_CLASS_FULL (klass, string, NULL)
/**
* OIL_DEFINE_IMPL_FULL:
* @function: name of function
* @klass: name of class to declare (without oil_ prefix)
* @flags: implementation flags and CPU requirements
*
* 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.
*/
#define OIL_DEFINE_IMPL_FULL(function,klass,flags) \
OilFunctionImpl OIL_OPT_MANGLE(_oil_function_impl_ ## function) = { \
NULL, \
&_oil_function_class_ ## klass , \
(void (*)(void)) function, \
OIL_OPT_FLAG_MANGLE(flags), \
#function OIL_OPT_SUFFIX \
} \
OIL_CHECK_PROTOTYPE(;_oil_type_ ## klass _ignore_me_ ## function = function)
/**
* OIL_DEFINE_IMPL:
* @function: name of function
* @klass: name of class to declare (without oil_ prefix)
*
* Shorthand for defining a C implementation. See OIL_DEFINE_IMPL_FULL().
*/
#define OIL_DEFINE_IMPL(function,klass) \
OIL_DEFINE_IMPL_FULL(function,klass,0)
/**
* OIL_DEFINE_IMPL_REF:
* @function: name of function
* @klass: name of class to declare (without oil_ prefix)
*
* Shorthand for defining a reference implementation. See OIL_DEFINE_IMPL_FULL().
*/
#define OIL_DEFINE_IMPL_REF(function,klass) \
OIL_DEFINE_IMPL_FULL(function,klass,OIL_IMPL_FLAG_REF)
/**
* OIL_DEFINE_IMPL_ASM:
* @function: name of function
* @klass: name of class to declare (without oil_ prefix)
*
* Shorthand for defining an implementation written in inline
* assembly code. See OIL_DEFINE_IMPL_FULL().
*/
#define OIL_DEFINE_IMPL_ASM(function,klass) \
OIL_DEFINE_IMPL_FULL(function,klass,OIL_IMPL_FLAG_ASM)
/**
* OIL_DEFINE_IMPL_DEPENDS
* @function: name of function
* @klass: 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().
*/
#define OIL_DEFINE_IMPL_DEPENDS(function,klass,...) \
OIL_DEFINE_IMPL_FULL(function,klass,0)
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);
int oil_impl_is_usable (OilFunctionImpl *impl);
void oil_class_choose_by_name (OilFunctionClass * klass, const char *name);
void oil_class_register_impl_full (OilFunctionClass * klass,
void (*func)(void), const char *name, unsigned int flags);
void oil_class_register_impl (OilFunctionClass * klass, OilFunctionImpl *impl);
void oil_class_register_impl_by_name (const char *klass_name,
OilFunctionImpl *impl);
void oil_init_no_optimize(void);
#endif
OIL_END_DECLS
#endif
|