From c9d92e71ffc96475abe19bd7dc7512df89b4f44d Mon Sep 17 00:00:00 2001 From: unknown <> Date: Mon, 17 Nov 2014 20:15:18 +0000 Subject: [PATCH] autocommit for files dated 2014-11-17 20:15:18 --- conv.h | 65 +++++++++++++++++++++++++++++++++++++++++ gen.h | 73 ++++++++++++++++++++++++++++++++++++++++++++++ include/index.html | 11 +++++++ 3 files changed, 149 insertions(+) create mode 100644 conv.h create mode 100644 gen.h create mode 100644 include/index.html diff --git a/conv.h b/conv.h new file mode 100644 index 0000000..2934293 --- /dev/null +++ b/conv.h @@ -0,0 +1,65 @@ +#ifndef LICE_CONV_HDR +#define LICE_CONV_HDR + +/* + * File: conv.h + * Implements the interface to LICE's type conversion. + */ +#include "ast.h" + +/* + * Function: conv_capable + * Determines if type conversion is capable for a given type. + * + * Parameters: + * type - The type to test for conversion capability + * + * Returns: + * `true` if conversion is capable, `false` otherwise. + */ +bool conv_capable(data_type_t *type); + +/* + * Function: conv_senority + * Determines the senority of two types in question, returning the + * one which out ranks the other. This is usually used in binary + * operations, thus the naming of lhs and rhs are used. + * + * Parameters: + * lhs - Left hand side type + * rhs - Right hand side type + * + * Returns: + * `lhs` if outranks `rhs`, otherwise `rhs` + */ +data_type_t *conv_senority(data_type_t *lhs, data_type_t *rhs); + +/* + * Function: conv_rank + * Determines the conversion ranking of a given data type. + * + * Parameters: + * type - The type to get the conversion ranking of. + * + * Returns: + * An integer value of the conversion ranking of the given data type, + * which can be used in the process of typicla relational, or comparitive + * checks. + */ +int conv_rank(data_type_t *type); + +/* + * Function: conv_usual + * Given a binary operation and the two operands, this will perform + * usualy type conversion and return an ast node that signifies that + * operation (including the conversion). + * + * Parameters: + * operation - An ast type, or character literal for typical binary + * operations, like '+'. + * left - The left hand side of the expression. + * right - The right hand side of the expression. + */ +ast_t *conv_usual(int operation, ast_t *left, ast_t *right); + +#endif diff --git a/gen.h b/gen.h new file mode 100644 index 0000000..dee2f6a --- /dev/null +++ b/gen.h @@ -0,0 +1,73 @@ +#ifndef LICE_GEN_HDR +#define LICE_GEN_HDR +#include "ast.h" + +extern char *gen_label_break; +extern char *gen_label_continue; +extern char *gen_label_switch; +extern char *gen_label_break_backup; +extern char *gen_label_continue_backup; +extern char *gen_label_switch_backup; + +/* emitters */ +void gen_emit(const char *fmt, ...); +void gen_emit_inline(const char *fmt, ...); + +/* jump */ +void gen_jump(const char *label); +void gen_jump_backup(void); +void gen_jump_save(char *lbreak, char *lcontinue); +void gen_jump_restore(void); +void gen_jump_break(void); +void gen_jump_continue(void); + +/* label */ +void gen_label(const char *label); +void gen_label_default(void); + +/* expression */ +void gen_expression(ast_t *ast); + +/* semantics */ +void gen_ensure_lva(ast_t *ast); + +/* need to implement */ +void gen_return(void); +void gen_literal(ast_t *ast); +void gen_literal_string(ast_t *ast); +void gen_literal_save(ast_t *ast, data_type_t *, int); +void gen_save_local(data_type_t *type, int offset); +void gen_variable_local(ast_t *ast); +void gen_variable_global(ast_t *ast); +void gen_dereference(ast_t *ast); +void gen_address(ast_t *ast); +void gen_binary(ast_t *ast); +void gen_zero(int start, int end); +void gen_je(const char *label); +void gen_data(ast_t *, int, int); +void gen_function_call(ast_t *ast); +void gen_case(ast_t *ast); +void gen_va_start(ast_t *ast); +void gen_va_arg(ast_t *ast); +void gen_not(ast_t *ast); +void gen_and(ast_t *ast); +void gen_or(ast_t *ast); +void gen_postfix(ast_t *, const char *); +void gen_prefix(ast_t *, const char *); +void gen_cast(ast_t *ast); +void gen_struct(ast_t *); +void gen_bitandor(ast_t *ast); +void gen_bitnot(ast_t *ast); +void gen_assign(ast_t *ast); +void gen_function(ast_t *ast); +void gen_function_prologue(ast_t *ast); +void gen_function_epilogue(void); +void gen_boolean_maybe(data_type_t *); +void gen_negate(ast_t *ast); +void gen_conversion(ast_t *ast); +void gen_address_label(ast_t *ast); +void gen_goto_computed(ast_t *ast); + +/* entry */ +void gen_toplevel(ast_t *); +#endif diff --git a/include/index.html b/include/index.html new file mode 100644 index 0000000..61d5ebc --- /dev/null +++ b/include/index.html @@ -0,0 +1,11 @@ +/include/ + +

/include/

+ + -- 2.40.0