Top |
Functions
#define | ORC_PROGRAM_ERROR() |
OrcProgram * | orc_program_new () |
OrcProgram * | orc_program_new_dss () |
OrcProgram * | orc_program_new_as () |
OrcProgram * | orc_program_new_ass () |
OrcProgram * | orc_program_new_ds () |
void | orc_program_free () |
const char * | orc_program_get_name () |
void | orc_program_set_name () |
int | orc_program_add_temporary () |
int | orc_program_add_source () |
int | orc_program_add_destination () |
int | orc_program_add_constant () |
int | orc_program_add_accumulator () |
int | orc_program_add_parameter () |
void | orc_program_append () |
void | orc_program_append_str () |
void | orc_program_append_ds () |
void | orc_program_append_ds_str () |
OrcCompileResult | orc_program_compile () |
OrcCompileResult | orc_program_compile_for_target () |
OrcCompileResult | orc_program_compile_full () |
const char * | orc_program_get_asm_code () |
int | orc_program_find_var_by_name () |
int | orc_program_allocate_register () |
int | orc_program_dup_temporary () |
Functions
orc_program_new ()
OrcProgram *
orc_program_new (void
);
Create a new OrcProgram. The program should be freed using
.orc_program_free()
orc_program_new_dss ()
OrcProgram * orc_program_new_dss (int size1
,int size2
,int size3
);
Create a new OrcProgram, with a destination named "d1" and two sources named "s1" and "s2".
orc_program_new_as ()
OrcProgram * orc_program_new_as (int size1
,int size2
);
Create a new OrcProgram, with an accumulator named "a1" and one source named "s1".
orc_program_new_ass ()
OrcProgram * orc_program_new_ass (int size1
,int size2
,int size3
);
Create a new OrcProgram, with an accumulator named "a1" and two source named "s1" and "s2".
orc_program_new_ds ()
OrcProgram * orc_program_new_ds (int size1
,int size2
);
Create a new OrcProgram, with a destination named "d1" and one source named "s1".
orc_program_get_name ()
const char *
orc_program_get_name (OrcProgram *program
);
Gets the name of the program. The string is valid until the name is changed or the program is freed.
orc_program_set_name ()
void orc_program_set_name (OrcProgram *program
,const char *name
);
Sets the name of the program. The string is copied.
orc_program_add_temporary ()
int orc_program_add_temporary (OrcProgram *program
,int size
,const char *name
);
Creates a new variable holding temporary values.
orc_program_add_source ()
int orc_program_add_source (OrcProgram *program
,int size
,const char *name
);
Creates a new variable representing a source array.
orc_program_add_destination ()
int orc_program_add_destination (OrcProgram *program
,int size
,const char *name
);
Creates a new variable representing a destination array.
orc_program_add_constant ()
int orc_program_add_constant (OrcProgram *program
,int size
,int value
,const char *name
);
Creates a new variable representing a constant value.
orc_program_add_accumulator ()
int orc_program_add_accumulator (OrcProgram *program
,int size
,const char *name
);
Creates a new variable representing an accumulator.
orc_program_add_parameter ()
int orc_program_add_parameter (OrcProgram *program
,int size
,const char *name
);
Creates a new variable representing a scalar parameter.
orc_program_append ()
void orc_program_append (OrcProgram *p
,const char *opcode
,int arg0
,int arg1
,int arg2
);
orc_program_append_str ()
void orc_program_append_str (OrcProgram *p
,const char *opcode
,const char *arg0
,const char *arg1
,const char *arg2
);
Appends an instruction to the program, with arguments arg0
,
arg1
, and arg2
. The instruction must take 3 operands.
orc_program_append_ds ()
void orc_program_append_ds (OrcProgram *program
,const char *opcode
,int arg0
,int arg1
);
Appends an instruction to the program, with arguments arg0
,
arg1
, and arg2
. The instruction must take 3 operands.
orc_program_append_ds_str ()
void orc_program_append_ds_str (OrcProgram *p
,const char *opcode
,const char *arg0
,const char *arg1
);
Appends an instruction to the program, with arguments arg0
and
arg2
. The instruction must take 2 operands.
orc_program_compile ()
OrcCompileResult
orc_program_compile (OrcProgram *p
);
Compiles an Orc program for the current CPU. If successful, executable code for the program was generated and can be executed.
The return value indicates various levels of success or failure.
Success can be determined by checking for a true value of the
macro ORC_COMPILE_RESULT_IS_SUCCESSFUL()
on the return value. This
indicates that executable code was generated. If the macro
ORC_COMPILE_RESULT_IS_FATAL()
on the return value evaluates to
true, then there was a syntactical error in the program. If the
result is neither successful nor fatal, the program can still be
emulated.
orc_program_compile_for_target ()
OrcCompileResult orc_program_compile_for_target (OrcProgram *p
,OrcTarget *target
);
Compiles an Orc program for the given target, using the default target flags for that target.
orc_program_compile_full ()
OrcCompileResult orc_program_compile_full (OrcProgram *p
,OrcTarget *target
,unsigned int flags
);
Compiles an Orc program for the given target, using the given target flags.
orc_program_get_asm_code ()
const char *
orc_program_get_asm_code (OrcProgram *program
);
Returns a character string containing the assembly code created by compiling the program. This string is valid until the program is compiled again or the program is freed.
orc_program_find_var_by_name ()
int orc_program_find_var_by_name (OrcProgram *program
,const char *name
);
Finds the variable with the name name
. If no variable with the
given name exists in the program, -1 is returned.
orc_program_allocate_register ()
int orc_program_allocate_register (OrcProgram *program
,int is_data
);
orc_program_dup_temporary ()
int orc_program_dup_temporary (OrcProgram *program
,int i
,int j
);
Internal function.