AC_DEFINE(ORC_EXPORTS, 1, [Defined for compiling internal code])
-ORC_CFLAGS="$ORC_CFLAGS -I\$(top_srcdir) -DORC_ENABLE_UNSTABLE_API"
+ORC_CFLAGS="$ORC_CFLAGS -I\$(top_srcdir)"
AC_SUBST(ORC_CFLAGS)
ORC_LIBS="\$(top_builddir)/orc/liborc-$ORC_MAJORMINOR.la $LIBM $LIBRT"
</bookinfo>
<chapter>
- <title>[Insert title here]</title>
+ <title>Application API</title>
+ <xi:include href="xml/orc.xml"/>
<xi:include href="xml/orcprogram.xml"/>
- <xi:include href="xml/x86.xml"/>
+ <xi:include href="xml/orccompiler.xml"/>
+ <xi:include href="xml/orcexecutor.xml"/>
+ </chapter>
+ <chapter>
+ <title>Extension API</title>
+ <xi:include href="xml/orcdebug.xml"/>
+ <xi:include href="xml/orcopcode.xml"/>
+ <xi:include href="xml/orcutils.xml"/>
+ <xi:include href="xml/orcrule.xml"/>
+ </chapter>
+ <chapter>
+ <title>Code Generation</title>
+ <xi:include href="xml/orcarm.xml"/>
+ <xi:include href="xml/orcmmx.xml"/>
+ <xi:include href="xml/orcsse.xml"/>
+ <xi:include href="xml/orcx86.xml"/>
+ </chapter>
+ <chapter>
+ <title>Herein lie dragons</title>
+ <xi:include href="xml/misc.xml"/>
</chapter>
</book>
ORC_PROGRAM_ERROR
orc_program_new
orc_program_new_dss
-orc_program_append
-orc_program_append_str
-orc_program_compile
-orc_program_x86_init
-orc_program_powerpc_init
-orc_program_assemble_x86
-orc_program_assemble_powerpc
-orc_program_assemble_c
+orc_program_new_as
+orc_program_new_ass
+orc_program_new_ds
orc_program_free
-orc_program_find_var_by_name
+orc_program_get_name
+orc_program_set_name
+
orc_program_add_temporary
-orc_program_dup_temporary
orc_program_add_source
orc_program_add_destination
orc_program_add_constant
-orc_program_x86_reset_alloc
-orc_program_powerpc_reset_alloc
-orc_program_allocate_register
-orc_program_x86_allocate_register
-orc_program_powerpc_allocate_register
-orc_program_x86_register_rules
-orc_program_allocate_codemem
-orc_program_dump_code
orc_program_add_accumulator
orc_program_add_parameter
+
+orc_program_append
+orc_program_append_str
orc_program_append_ds
orc_program_append_ds_str
+
+orc_program_compile
orc_program_compile_for_target
orc_program_compile_full
-orc_program_dump_asm
+
orc_program_get_asm_code
+
+<SUBSECTION>
+orc_program_find_var_by_name
+orc_program_allocate_register
orc_program_get_max_var_size
-orc_program_get_name
-orc_program_new_as
-orc_program_new_ass
-orc_program_new_ds
-orc_program_set_name
+orc_program_dup_temporary
</SECTION>
<SECTION>
<SECTION>
<FILE>misc</FILE>
-OrcType
OrcVariable
-OrcArgument
OrcInstruction
-OrcRegister
OrcRule
OrcFixup
OrcRuleEmitFunc
ORC_N_FIXUPS
ORC_N_LABELS
ORC_GP_REG_BASE
-ORC_VEC1_REG_BASE
-ORC_VEC2_REG_BASE
-ORC_REGCLASS_GP
+ORC_VEC_REG_BASE
ORC_STRUCT_OFFSET
OrcVarType
-orc_type_get
-orc_type_register
-orc_variable_get_size
-orc_x86_init
orc_powerpc_init
orc_arm_init
orc_c_init
orc_parse
+ARRAY_SIZE
+MAX
+MIN
+get_cpuinfo_line
+get_file
+get_file_int
+get_tag_value
+strsplit
</SECTION>
<SECTION>
ORC_INFO
ORC_DEBUG
ORC_LOG
+ORC_FUNCTION
orc_debug_get_level
orc_debug_print
orc_debug_set_level
<FILE>orccompiler</FILE>
OrcCompileResult
OrcCompiler
+OrcConstant
ORC_COMPILER_ERROR
ORC_COMPILE_RESULT_IS_FATAL
ORC_COMPILE_RESULT_IS_SUCCESSFUL
<SECTION>
<FILE>orcopcode</FILE>
-OrcOpcode
OrcOpcodeEmulateFunc
OrcOpcodeExecutor
OrcOpcodeSet
OrcStaticOpcode
OrcTarget
ORC_OPCODE_N_ARGS
-ORC_OPCODE_N_RULES
ORC_STATIC_OPCODE_ACCUMULATOR
ORC_STATIC_OPCODE_N_DEST
ORC_STATIC_OPCODE_N_SRC
orc_x86_get_regname_ptr
orc_x86_get_regname_sse
orc_x86_get_regnum
+orc_x86_do_fixups
</SECTION>
<SECTION>
<SECTION>
<FILE>orcarm</FILE>
-ORC_ARM_A1
-ORC_ARM_A2
-ORC_ARM_A3
-ORC_ARM_A4
-ORC_ARM_IP
-ORC_ARM_LR
-ORC_ARM_PC
-ORC_ARM_R0
-ORC_ARM_SB
-ORC_ARM_SP
-ORC_ARM_V1
-ORC_ARM_V2
-ORC_ARM_V3
-ORC_ARM_V4
-ORC_ARM_V5
-ORC_ARM_V6
-ORC_ARM_V7
-ORC_ARM_V8
+OrcArmCond
+OrcArmDP
+OrcArmRegister
orc_arm_do_fixups
orc_arm_emit
orc_arm_emit_add
orc_pixel_sse_register_rules ();
}
+#ifndef ORC_CLAMP
+#define ORC_CLAMP(x,a,b) ((x)<(a) ? (a) : ((x)>(b) ? (b) : (x)))
+#endif
#define COMPOSITE_OVER(d,s,m) ((d) + (s) - ORC_MULDIV_255((d),(m)))
#define COMPOSITE_ADD(d,s) ORC_CLAMP((d) + (s), 0, 255)
liborc_@ORC_MAJORMINOR@_la_LIBS = $(ORC_LIBS)
liborc_@ORC_MAJORMINOR@_la_LDFLAGS = \
-no-undefined -export-symbols-regex 'orc_'
-liborc_@ORC_MAJORMINOR@_la_CFLAGS = $(ORC_CFLAGS)
+liborc_@ORC_MAJORMINOR@_la_CFLAGS = $(ORC_CFLAGS) \
+ -DORC_ENABLE_UNSTABLE_API
liborc_@ORC_MAJORMINOR@_la_SOURCES = \
orc.c \
orcrules-sse.c \
orcrules-arm.c \
orcdebug.c \
- orccpu.c \
orcutils.c \
orcsse.c \
orcmmx.c \
if HAVE_I386
liborc_@ORC_MAJORMINOR@_la_SOURCES += orccpu-x86.c
-else
+endif
if HAVE_AMD64
liborc_@ORC_MAJORMINOR@_la_SOURCES += orccpu-x86.c
-else
+endif
if HAVE_POWERPC
liborc_@ORC_MAJORMINOR@_la_SOURCES += orccpu-powerpc.c
-else
+endif
if HAVE_ARM
liborc_@ORC_MAJORMINOR@_la_SOURCES += orccpu-arm.c
-else
-liborc_@ORC_MAJORMINOR@_la_SOURCES += orccpu-misc.c
-endif
-endif
-endif
endif
pkginclude_HEADERS = \
orcprogram.h \
orcutils.h \
orcparse.h \
- orccpu.h \
opcodes.h \
orcsse.h \
orcmmx.h \
#include <orc/orcarm.h>
#include <orc/orcutils.h>
+/**
+ * SECTION:orcarm
+ * @title: ARM
+ * @short_description: code generation for ARM
+ */
+
const char *
orc_arm_reg_name (int reg)
#include <orc/orcprogram.h>
-#define ORC_ARM_R0 (ORC_GP_REG_BASE+0)
-
-#define ORC_ARM_A1 (ORC_GP_REG_BASE+0)
-#define ORC_ARM_A2 (ORC_GP_REG_BASE+1)
-#define ORC_ARM_A3 (ORC_GP_REG_BASE+2)
-#define ORC_ARM_A4 (ORC_GP_REG_BASE+3)
-#define ORC_ARM_V1 (ORC_GP_REG_BASE+4)
-#define ORC_ARM_V2 (ORC_GP_REG_BASE+5)
-#define ORC_ARM_V3 (ORC_GP_REG_BASE+6)
-#define ORC_ARM_V4 (ORC_GP_REG_BASE+7)
-#define ORC_ARM_V5 (ORC_GP_REG_BASE+8)
-#define ORC_ARM_V6 (ORC_GP_REG_BASE+9)
-#define ORC_ARM_V7 (ORC_GP_REG_BASE+10)
-#define ORC_ARM_V8 (ORC_GP_REG_BASE+11)
-#define ORC_ARM_IP (ORC_GP_REG_BASE+12)
-#define ORC_ARM_SP (ORC_GP_REG_BASE+13)
-#define ORC_ARM_LR (ORC_GP_REG_BASE+14)
-#define ORC_ARM_PC (ORC_GP_REG_BASE+15)
-
-#define ORC_ARM_SB (ORC_GP_REG_BASE+9)
-
-enum {
+
+typedef enum {
+ ORC_ARM_A1 = ORC_GP_REG_BASE+0,
+ ORC_ARM_A2,
+ ORC_ARM_A3,
+ ORC_ARM_A4,
+ ORC_ARM_V1,
+ ORC_ARM_V2,
+ ORC_ARM_V3,
+ ORC_ARM_V4,
+ ORC_ARM_V5,
+ ORC_ARM_V6,
+ ORC_ARM_V7,
+ ORC_ARM_V8,
+ ORC_ARM_IP,
+ ORC_ARM_SP,
+ ORC_ARM_LR,
+ ORC_ARM_PC
+} OrcArmRegister;
+
+typedef enum {
ORC_ARM_DP_AND = 0,
ORC_ARM_DP_EOR,
ORC_ARM_DP_SUB,
ORC_ARM_DP_MOV,
ORC_ARM_DP_BIC,
ORC_ARM_DP_MVN
-};
+} OrcArmDP;
-enum {
+typedef enum {
ORC_ARM_COND_EQ = 0,
ORC_ARM_COND_NE,
ORC_ARM_COND_CS,
ORC_ARM_COND_GT,
ORC_ARM_COND_LE,
ORC_ARM_COND_AL,
-};
+} OrcArmCond;
void orc_arm_emit (OrcCompiler *compiler, uint32_t insn);
void orc_arm_emit_bx_lr (OrcCompiler *compiler);
#include <orc/orcprogram.h>
#include <orc/orcdebug.h>
+/**
+ * SECTION:orccompiler
+ * @title: OrcCompiler
+ * @short_description: Compile Orc programs
+ */
+
void orc_compiler_assign_rules (OrcCompiler *compiler);
void orc_compiler_global_reg_alloc (OrcCompiler *compiler);
void orc_compiler_rewrite_vars (OrcCompiler *compiler);
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
-#include <orc/orccpu.h>
+#include <orc/orcarm.h>
#include <orc/orcutils.h>
#include <orc/orcdebug.h>
+++ /dev/null
-/*
- * 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.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-#include <liboil/liboilfunction.h>
-#include <liboil/liboildebug.h>
-#include <liboil/liboilcpu.h>
-#include <liboil/liboilfault.h>
-#include <liboil/liboilutils.h>
-
-#include <unistd.h>
-#include <fcntl.h>
-#include <stdlib.h>
-#include <string.h>
-#include <stdio.h>
-#include <setjmp.h>
-#include <signal.h>
-#include <sys/time.h>
-#include <time.h>
-
-/***** alpha *****/
-
-#if defined(__alpha__)
-static unsigned long
-oil_profile_stamp_alpha(void)
-{
- unsigned int ts;
- __asm__ __volatile__ ("rpcc %0\n" : "=r"(ts));
- return ts;
-}
-
-static void
-oil_cpu_detect_alpha(void)
-{
- _oil_profile_stamp = oil_profile_stamp_alpha;
-}
-#endif
-
-/***** ia64 *****/
-
-#if defined(__ia64__)
-static unsigned long
-oil_profile_stamp_ia64(void)
-{
- unsigned int ts;
- __asm__ __volatile__("mov %0=ar.itc\n" : "=r"(ts) :: "memory");
- return ts;
-}
-
-static void
-oil_cpu_detect_ia64(void)
-{
- _oil_profile_stamp = oil_profile_stamp_ia64;
-}
-#endif
-
-/***** s390 *****/
-
-#if defined(__s390__)
-static unsigned long
-oil_profile_stamp_s390(void)
-{
- uint64_t ts;
- __asm__ __volatile__ ("STCK %0(%0)\n" : : "r" (&ts));
- return ts;
-}
-
-static void
-oil_cpu_detect_s390(void)
-{
- _oil_profile_stamp = oil_profile_stamp_s390;
-}
-#endif
-
-/***** mips *****/
-
-#if defined(__mips__)
-#if 0
-/* broken */
-static unsigned long
-oil_profile_stamp_mips(void)
-{
- unsigned int ts;
- __asm__ __volatile__ (
- " .set push \n"
- " .set reorder \n"
- " mfc0 %0,$9 \n"
- " .set pop \n"
- : "=m" (ts));
- return ts;
-}
-#endif
-
-static void
-oil_cpu_detect_mips(void)
-{
- //_oil_profile_stamp = oil_profile_stamp_mips;
-}
-#endif
-
-void
-oil_cpu_detect_arch(void)
-{
-#ifdef __alpha__
- oil_cpu_detect_alpha();
-#endif
-#ifdef __ia64__
- oil_cpu_detect_ia64();
-#endif
-#ifdef __s390__
- oil_cpu_detect_s390();
-#endif
-#ifdef __mips__
- oil_cpu_detect_mips();
-#endif
-}
-
#include "config.h"
#endif
#include <orc/orcdebug.h>
-#include <orc/orccpu.h>
+#include <orc/orcsse.h>
+#include <orc/orcmmx.h>
#include <orc/orcprogram.h>
#include <orc/orcutils.h>
+++ /dev/null
-/*
- * ORC - 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.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-#include <orc/orcdebug.h>
-#include <orc/orccpu.h>
-#include <orc/orcutils.h>
-
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-#include <fcntl.h>
-#include <stdlib.h>
-#include <string.h>
-#include <stdio.h>
-#include <setjmp.h>
-#include <signal.h>
-#ifdef HAVE_SYS_TIME_H
-#include <sys/time.h>
-#endif
-#include <time.h>
-
-#if defined(__FreeBSD__)
-#include <sys/types.h>
-#include <sys/sysctl.h>
-#endif
-
-#ifdef __sun
-#include <sys/auxv.h>
-#endif
-
-
-
-/**
- * SECTION:liborccpu
- * @title: CPU
- * @short_description: Check the capabilities of the current CPU
- *
- */
-
-void orc_cpu_detect_arch(void);
-
-unsigned long orc_cpu_flags;
-
-#if 0
-extern unsigned long (*_orc_profile_stamp)(void);
-#endif
-
-#if 0
-#ifdef HAVE_GETTIMEOFDAY
-static unsigned long
-orc_profile_stamp_gtod (void)
-{
- struct timeval tv;
- gettimeofday(&tv,NULL);
- return 1000000*(unsigned long)tv.tv_sec + (unsigned long)tv.tv_usec;
-}
-#endif
-
-#if defined(HAVE_CLOCK_GETTIME) && defined(HAVE_MONOTONIC_CLOCK)
-static unsigned long
-orc_profile_stamp_clock_gettime (void)
-{
- struct timespec ts;
- clock_gettime (CLOCK_MONOTONIC, &ts);
- return 1000000000*ts.tv_sec + ts.tv_nsec;
-}
-#endif
-
-static unsigned long
-orc_profile_stamp_zero (void)
-{
- return 0;
-}
-#endif
-
-void
-_orc_cpu_init (void)
-{
- const char *envvar;
-
- //orc_cpu_detect_arch();
-
- envvar = getenv ("ORC_CPU_FLAGS");
- if (envvar != NULL) {
- char *end = NULL;
- unsigned long flags;
-
- flags = strtoul (envvar, &end, 0);
- if (end > envvar) {
- orc_cpu_flags = flags;
- }
- ORC_INFO ("cpu flags from environment %08lx", orc_cpu_flags);
- }
-
- ORC_INFO ("cpu flags %08lx", orc_cpu_flags);
-
-#if 0
-#if defined(HAVE_CLOCK_GETTIME) && defined(HAVE_MONOTONIC_CLOCK)
- if (_orc_profile_stamp == NULL) {
- _orc_profile_stamp = orc_profile_stamp_clock_gettime;
- ORC_INFO("Using clock_gettime() as a timestamp function.");
- }
-#endif
-
-#ifdef HAVE_GETTIMEOFDAY
- if (_orc_profile_stamp == NULL) {
- _orc_profile_stamp = orc_profile_stamp_gtod;
- ORC_WARNING("Using gettimeofday() as a timestamp function.");
- }
-#endif
- if (_orc_profile_stamp == NULL) {
- _orc_profile_stamp = orc_profile_stamp_zero;
- ORC_ERROR("No timestamping function. This is kinda bad.");
- }
-#endif
-}
-
-/**
- * orc_cpu_get_flags:
- *
- * Returns a bitmask containing the available CPU features.
- *
- * Returns: the CPU features.
- */
-unsigned int
-orc_cpu_get_flags (void)
-{
- return orc_cpu_flags;
-}
-
-
+++ /dev/null
-/*
- * ORC - 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 _ORC_CPU_H_
-#define _ORC_CPU_H_
-
-#include <orc/orcutils.h>
-
-ORC_BEGIN_DECLS
-
-#ifdef ORC_ENABLE_UNSTABLE_API
-
-typedef enum {
- ORC_CPU_FLAG_CMOV = (1<<0),
- ORC_CPU_FLAG_MMX = (1<<1),
- ORC_CPU_FLAG_SSE = (1<<2),
- ORC_CPU_FLAG_MMXEXT = (1<<3),
- ORC_CPU_FLAG_SSE2 = (1<<4),
- ORC_CPU_FLAG_3DNOW = (1<<5),
- ORC_CPU_FLAG_3DNOWEXT = (1<<6),
- ORC_CPU_FLAG_SSE3 = (1<<7),
- ORC_CPU_FLAG_ALTIVEC = (1<<8),
- ORC_CPU_FLAG_EDSP = (1<<9),
- ORC_CPU_FLAG_ARM6 = (1<<10),
- ORC_CPU_FLAG_VFP = (1<<11),
- ORC_CPU_FLAG_SSSE3 = (1<<12)
-} OrcCpuFlag;
-
-unsigned int orc_sse_get_cpu_flags (void);
-unsigned int orc_mmx_get_cpu_flags (void);
-
-void _orc_cpu_init (void);
-
-ORC_EXPORT unsigned long orc_cpu_flags;
-
-#endif
-
-ORC_END_DECLS
-
-#endif
-
/**
* SECTION:orcdebug
- * @title: Debug
+ * @title: OrcDebug
* @short_description: Printing and formatting debug information
*/
ORC_BEGIN_DECLS
-#ifdef ORC_ENABLE_UNSTABLE_API
-
/**
* OrcDebugPrintFunc:
* @level: the debug level
/**
* OrcDebugLevel:
*
- * Enumeration describing debug levels in Liborc.
+ * Enumeration describing debug levels in Orc.
*/
typedef enum {
ORC_DEBUG_NONE = 0,
void orc_debug_print (int level, const char *file, const char *func,
int line, const char *format, ...);
-#endif
-
ORC_END_DECLS
#endif
#include <orc/orcprogram.h>
#include <orc/orcdebug.h>
+/**
+ * SECTION:orcexecutor
+ * @title: OrcExecutor
+ * @short_description: Running Orc programs
+ */
+
OrcExecutor *
orc_executor_new (OrcProgram *program)
#include <orc/orcdebug.h>
#include <orc/orcmmx.h>
+/**
+ * SECTION:orcmmx
+ * @title: MMX
+ * @short_description: code generation for MMX
+ */
+
const char *
orc_x86_get_regname_mmx(int i)
void orc_mmx_emit_pshufw (OrcCompiler *p, int shuf, int src, int dest);
void orc_mmx_emit_shiftimm (OrcCompiler *p, const char *insn_name,
int code, int modrm_code, int shift, int reg);
+unsigned int orc_mmx_get_cpu_flags (void);
#endif
#include <orc/orcprogram.h>
#include <orc/orcdebug.h>
+/**
+ * SECTION:orcopcode
+ * @title: OrcOpcode
+ * @short_description: Operations
+ */
+
static OrcOpcodeSet *opcode_sets;
static int n_opcode_sets;
#include <stdlib.h>
#include <stdio.h>
+/**
+ * SECTION:orcparse
+ * @title: Parser
+ * @short_description: Parse Orc source code
+ */
+
typedef struct _OrcParser OrcParser;
struct _OrcParser {
#define SIZE 65536
-int orc_arm_exec_ptr = ORC_ARM_R0;
+int orc_arm_exec_ptr = ORC_ARM_A1;
void orc_arm_emit_loop (OrcCompiler *compiler);
for(i=ORC_GP_REG_BASE;i<ORC_GP_REG_BASE+9;i++){
compiler->valid_regs[i] = 1;
}
- compiler->valid_regs[ORC_ARM_R0] = 0;
+ compiler->valid_regs[ORC_ARM_A1] = 0;
//compiler->valid_regs[ORC_ARM_SB] = 0;
compiler->valid_regs[ORC_ARM_IP] = 0;
compiler->valid_regs[ORC_ARM_SP] = 0;
#include <orc/orcmmx.h>
#include <orc/orcutils.h>
#include <orc/orcdebug.h>
-#include <orc/orccpu.h>
#define SIZE 65536
orc_x86_emit_epilogue (compiler);
- x86_do_fixups (compiler);
+ orc_x86_do_fixups (compiler);
}
void
#include <orc/orcsse.h>
#include <orc/orcutils.h>
#include <orc/orcdebug.h>
-#include <orc/orccpu.h>
#define SIZE 65536
orc_x86_emit_epilogue (compiler);
- x86_do_fixups (compiler);
+ orc_x86_do_fixups (compiler);
}
void
#include <orc/orcprogram.h>
#include <orc/orcdebug.h>
+/**
+ * SECTION:orcprogram
+ * @title: OrcProgram
+ * @short_description: Creating and manipulating Orc programs
+ */
+
OrcProgram *
orc_program_new (void)
#define ORC_GP_REG_BASE 32
#define ORC_VEC_REG_BASE 64
-#define ORC_REGCLASS_GP 1
-#define ORC_REGCLASS_VEC 2
-
#define ORC_STATIC_OPCODE_N_SRC 4
#define ORC_STATIC_OPCODE_N_DEST 2
int orc_program_add_parameter (OrcProgram *program, int size, const char *name);
int orc_program_add_accumulator (OrcProgram *program, int size, const char *name);
-void orc_program_x86_reset_alloc (OrcProgram *program);
-void orc_program_powerpc_reset_alloc (OrcProgram *program);
-
-
OrcExecutor * orc_executor_new (OrcProgram *program);
void orc_executor_free (OrcExecutor *ex);
void orc_executor_set_program (OrcExecutor *ex, OrcProgram *program);
const char * orc_target_get_name (OrcTarget *target);
int orc_program_allocate_register (OrcProgram *program, int is_data);
-int orc_program_x86_allocate_register (OrcProgram *program, int is_data);
-int orc_program_powerpc_allocate_register (OrcProgram *program, int is_data);
-void orc_program_x86_register_rules (void);
void orc_compiler_allocate_codemem (OrcCompiler *compiler);
-void orc_program_dump_code (OrcProgram *program);
int orc_compiler_label_new (OrcCompiler *compiler);
const char *orc_program_get_asm_code (OrcProgram *program);
-void orc_program_dump_asm (OrcProgram *program);
const char *orc_target_get_asm_preamble (const char *target);
void orc_compiler_append_code (OrcCompiler *p, const char *fmt, ...)
#include <orc/orcprogram.h>
#include <orc/orcdebug.h>
+/**
+ * SECTION:orcrule
+ * @title: OrcRule
+ * @short_description: Creating rules for code generation
+ */
+
void
orc_rule_register (OrcRuleSet *rule_set,
#include <orc/orcdebug.h>
#include <orc/orcsse.h>
+/**
+ * SECTION:orcsse
+ * @title: SSE
+ * @short_description: code generation for SSE
+ */
+
const char *
orc_x86_get_regname_sse(int i)
void orc_sse_emit_shiftimm (OrcCompiler *p, const char *insn_name,
int code, int modrm_code, int shift, int reg);
+unsigned int orc_sse_get_cpu_flags (void);
#endif
#include <stdlib.h>
#include <string.h>
+/**
+ * SECTION:orcutils
+ * @title: Utility functions
+ * @short_description: Orc utility functions
+ */
+
int
get_file_int (const char *file, int *value)
{
#ifdef ORC_ENABLE_UNSTABLE_API
#define ARRAY_SIZE(x) (sizeof(x)/sizeof(x[0]))
-#define DIVIDE_ROUND_UP(a,b) (((a) + (b) - 1)/(b))
#ifndef MIN
#define MIN(a,b) ((a)<(b) ? (a) : (b))
#endif
#define ORC_CLAMP(x,a,b) ((x)<(a) ? (a) : ((x)>(b) ? (b) : (x)))
#endif
#define ORC_PTR_TO_INT(x) ((int)(long)(x))
-#define ROUND_UP_SHIFT(x,y) (((x) + (1<<(y)) - 1)>>(y))
-#define ROUND_UP_POW2(x,y) (((x) + (1<<(y)) - 1)&((~0)<<(y)))
-#define ROUND_UP_2(x) ROUND_UP_POW2(x,1)
-#define ROUND_UP_4(x) ROUND_UP_POW2(x,2)
-#define ROUND_UP_8(x) ROUND_UP_POW2(x,3)
-#define ROUND_SHIFT(x,y) (((x) + (1<<((y)-1)))>>(y))
#define ORC_READ_UINT32_LE(ptr) \
((uint32_t)( \
#include <orc/orcutils.h>
+/**
+ * SECTION:orcx86
+ * @title: x86
+ * @short_description: code generation for x86
+ */
+
const char *
orc_x86_get_regname(int i)
{
}
void
-x86_do_fixups (OrcCompiler *compiler)
+orc_x86_do_fixups (OrcCompiler *compiler)
{
int i;
for(i=0;i<compiler->n_fixups;i++){
}
}
-void
-x86_test (OrcCompiler *compiler)
-{
- int size;
- int i;
- int j;
- int reg;
-
- for(size=2;size<=4;size+=2) {
- for(i=0;i<8;i++){
- reg = ORC_GP_REG_BASE + i;
- orc_x86_emit_push (compiler, size, reg);
- orc_x86_emit_pop (compiler, size, reg);
- orc_x86_emit_mov_imm_reg (compiler, size, 0, reg);
- orc_x86_emit_mov_imm_reg (compiler, size, 1, reg);
- orc_x86_emit_mov_imm_reg (compiler, size, 256, reg);
- orc_x86_emit_dec_memoffset (compiler, size, 0, reg);
- orc_x86_emit_dec_memoffset (compiler, size, 1, reg);
- orc_x86_emit_dec_memoffset (compiler, size, 256, reg);
- orc_x86_emit_add_imm_memoffset (compiler, size, 1, 0, reg);
- orc_x86_emit_add_imm_memoffset (compiler, size, 1, 1, reg);
- orc_x86_emit_add_imm_memoffset (compiler, size, 1, 256, reg);
- orc_x86_emit_add_imm_memoffset (compiler, size, 256, 0, reg);
- orc_x86_emit_add_imm_memoffset (compiler, size, 256, 1, reg);
- orc_x86_emit_add_imm_memoffset (compiler, size, 256, 256, reg);
- for(j=0;j<8;j++){
- int reg2 = ORC_GP_REG_BASE + j;
- orc_x86_emit_mov_reg_reg (compiler, size, reg, reg2);
- orc_x86_emit_mov_memoffset_reg (compiler, size, 0, reg, reg2);
- orc_x86_emit_mov_memoffset_reg (compiler, size, 1, reg, reg2);
- orc_x86_emit_mov_memoffset_reg (compiler, size, 256, reg, reg2);
- orc_x86_emit_mov_reg_memoffset (compiler, size, reg, 0, reg2);
- orc_x86_emit_mov_reg_memoffset (compiler, size, reg, 1, reg2);
- orc_x86_emit_mov_reg_memoffset (compiler, size, reg, 256, reg2);
- }
- }
- }
-
-}
-
void orc_x86_emit_jmp (OrcCompiler *compiler, int label);
void orc_x86_emit_label (OrcCompiler *compiler, int label);
void orc_x86_emit_align (OrcCompiler *compiler);
-void x86_do_fixups (OrcCompiler *compiler);
void orc_x86_emit_prologue (OrcCompiler *compiler);
void orc_x86_emit_epilogue (OrcCompiler *compiler);
void orc_x86_emit_rex (OrcCompiler *compiler, int size, int reg1, int reg2, int reg3);
void orc_x86_emit_modrm_memoffset (OrcCompiler *compiler, int reg1, int offset, int reg2);
void orc_x86_emit_modrm_reg (OrcCompiler *compiler, int reg1, int reg2);
-void x86_test (OrcCompiler *compiler);
+
+void orc_x86_do_fixups (OrcCompiler *compiler);
#endif