WONKY



LOG | FILES | OVERVIEW


#ifndef WONKY_INTEL_COMPILE_H
#define WONKY_INTEL_COMPILE_H WONKY_INTEL_COMPILE_H

#include <intel_asm.h>
#include <ast.h>
#include <map.h>
#include <wonky_malloc.h>

void compile_binary_expression(struct Compile_Data_Intel_Asm *compile_data,struct AST_Binary_Expression *bin);
void compile_unary_expression(struct Compile_Data_Intel_Asm *compile_data,struct AST_Unary_Expression *unary);

void compile_ast_to_intel_asm(struct Compile_Data_Intel_Asm *compile_data,struct AST *ast);
void compile_conditional_expression_to_intel_asm(struct Compile_Data_Intel_Asm *compile_data,struct AST_Conditional_Expression *expression);
void compile_function_expression_to_intel_asm(struct Compile_Data_Intel_Asm *compile_data,struct AST_Function_Expression *call);
void compile_constant_to_intel_asm(struct Compile_Data_Intel_Asm *compile_data,struct AST_Constant *constant);
void compile_string_literal_to_intel_asm(struct Compile_Data_Intel_Asm *compile_data,struct AST_String_Literal *literal);
void compile_designator_to_intel_asm(struct Compile_Data_Intel_Asm *compile_data,struct AST_Designator *designator);
void compile_labeled_statement_to_intel_asm(struct Compile_Data_Intel_Asm *compile_data,struct AST_Labeled_Statement *labeled);
void compile_break_continue_statement_to_intel_asm(struct Compile_Data_Intel_Asm *compile_data,struct AST_Break_Continue_Statement *br);
void compile_compound_statement_to_intel_asm(struct Compile_Data_Intel_Asm *compile_data,struct AST_Compound_Statement *statement);
void compile_for_to_intel_asm(struct Compile_Data_Intel_Asm *compile_data,struct AST_For_Statement *statement);
void compile_while_to_intel_asm(struct Compile_Data_Intel_Asm *compile_data,struct AST_While_Statement *wh);
void compile_do_while_to_intel_asm(struct Compile_Data_Intel_Asm *compile_data,struct AST_Do_While_Statement *do_while);
void compile_if_to_intel_asm(struct Compile_Data_Intel_Asm *compile_data,struct AST_If_Statement *statement);
void compile_goto_to_intel_asm(struct Compile_Data_Intel_Asm *compile_data,struct AST_Goto_Statement *jump);
void compile_switch_to_intel_asm(struct Compile_Data_Intel_Asm *compile_data,struct AST_Switch_Statement *sw);
void compile_default_to_intel_asm(struct Compile_Data_Intel_Asm *compile_data,struct AST_Default_Statement *def);
void compile_case_to_intel_asm(struct Compile_Data_Intel_Asm *compile_data,struct AST_Case_Statement *cs);
void compile_return_to_intel_asm(struct Compile_Data_Intel_Asm *compile_data,struct AST_Return_Statement *ret);
void compile_object_declaration_to_intel_asm(struct Compile_Data_Intel_Asm *compile_data,struct AST_Object_Declaration *objd);
void compile_function_definition_to_intel_asm(struct Compile_Data_Intel_Asm *compile_data,struct AST_Function_Definition *def);
void compile_translation_unit_to_intel_asm(struct Compile_Data_Intel_Asm *compile_data,struct AST_Translation_Unit *unit);
void compile_expression_statement(struct Compile_Data_Intel_Asm *compile_data,struct AST_Expression *expression);

void compile_comma_expression_to_intel_asm(struct Compile_Data_Intel_Asm *compile_data,struct AST_Binary_Expression *bin);
void compile_addition_to_intel_asm(struct Compile_Data_Intel_Asm *compile_data,struct AST_Binary_Expression *bin);
void compile_subtraction_to_intel_asm(struct Compile_Data_Intel_Asm *compile_data,struct AST_Binary_Expression *bin);
void compile_pointer_addition_to_intel_asm(struct Compile_Data_Intel_Asm *compile_data,struct AST_Binary_Expression *bin);
void compile_multiplication_to_intel_asm(struct Compile_Data_Intel_Asm *compile_data,struct AST_Binary_Expression *bin);
void compile_division_to_intel_asm(struct Compile_Data_Intel_Asm *compile_data,struct AST_Binary_Expression *bin);
void compile_remainder_to_intel_asm(struct Compile_Data_Intel_Asm *compile_data,struct AST_Binary_Expression *bin);
void compile_assign_to_intel_asm(struct Compile_Data_Intel_Asm *compile_data,struct AST_Binary_Expression *bin);
void compile_add_assign_to_intel_asm(struct Compile_Data_Intel_Asm *compile_data,struct AST_Binary_Expression *bin);
void compile_sub_assign_to_intel_asm(struct Compile_Data_Intel_Asm *compile_data,struct AST_Binary_Expression *bin);
void compile_mul_assign_to_intel_asm(struct Compile_Data_Intel_Asm *compile_data,struct AST_Binary_Expression *bin);
void compile_rem_assign_to_intel_asm(struct Compile_Data_Intel_Asm *compile_data,struct AST_Binary_Expression *bin);
void compile_div_assign_to_intel_asm(struct Compile_Data_Intel_Asm *compile_data,struct AST_Binary_Expression *bin);
void compile_shift_left_assign_to_intel_asm(struct Compile_Data_Intel_Asm *compile_data,struct AST_Binary_Expression *bin);
void compile_shift_right_assign_to_intel_asm(struct Compile_Data_Intel_Asm *compile_data,struct AST_Binary_Expression *bin);
void compile_and_assign_to_intel_asm(struct Compile_Data_Intel_Asm *compile_data,struct AST_Binary_Expression *bin);
void compile_xor_assign_to_intel_asm(struct Compile_Data_Intel_Asm *compile_data,struct AST_Binary_Expression *bin);
void compile_pipe_assign_to_intel_asm(struct Compile_Data_Intel_Asm *compile_data,struct AST_Binary_Expression *bin);
void compile_nop_to_intel_asm(struct Compile_Data_Intel_Asm *compile_data,void *dummy);
void compile_logical_or_to_intel_asm(struct Compile_Data_Intel_Asm *compile_data,struct AST_Binary_Expression *bin);
void compile_logical_and_to_intel_asm(struct Compile_Data_Intel_Asm *compile_data,struct AST_Binary_Expression *bin);
void compile_logical_not_to_intel_asm(struct Compile_Data_Intel_Asm *compile_data,struct AST_Unary_Expression *unary);
void compile_bitwise_or_to_intel_asm(struct Compile_Data_Intel_Asm *compile_data,struct AST_Binary_Expression *bin);
void compile_bitwise_and_to_intel_asm(struct Compile_Data_Intel_Asm *compile_data,struct AST_Binary_Expression *bin);
void compile_bitwise_xor_to_intel_asm(struct Compile_Data_Intel_Asm *compile_data,struct AST_Binary_Expression *bin);
void compile_bitwise_not_to_intel_asm(struct Compile_Data_Intel_Asm *compile_data,struct AST_Unary_Expression *unary);
void compile_get_address_to_intel_asm(struct Compile_Data_Intel_Asm *compile_data,struct AST_Unary_Expression *unary);
void compile_dereference_to_intel_asm(struct Compile_Data_Intel_Asm *compile_data,struct AST_Unary_Expression *unary);
void compile_member_from_ptr_to_intel_asm(struct Compile_Data_Intel_Asm *compile_data,struct AST_Binary_Expression *bin);
void compile_member_to_intel_asm(struct Compile_Data_Intel_Asm *compile_data,struct AST_Binary_Expression *bin);
void compile_subscript_to_intel_asm(struct Compile_Data_Intel_Asm *compile_data,struct AST_Binary_Expression *bin);
void compile_postfix_inc_to_intel_asm(struct Compile_Data_Intel_Asm *compile_data,struct AST_Unary_Expression *unary);
void compile_postfix_dec_to_intel_asm(struct Compile_Data_Intel_Asm *compile_data,struct AST_Unary_Expression *unary);
void compile_prefix_inc_to_intel_asm(struct Compile_Data_Intel_Asm *compile_data,struct AST_Unary_Expression *unary);
void compile_prefix_dec_to_intel_asm(struct Compile_Data_Intel_Asm *compile_data,struct AST_Unary_Expression *unary);
void compile_unary_plus_to_intel_asm(struct Compile_Data_Intel_Asm *compile_data,struct AST_Unary_Expression *unary);
void compile_unary_minus_to_intel_asm(struct Compile_Data_Intel_Asm *compile_data,struct AST_Unary_Expression *unary);
void compile_cast_to_intel_asm(struct Compile_Data_Intel_Asm *compile_data,struct AST_Unary_Expression *unary);
void compile_shift_left_to_intel_asm(struct Compile_Data_Intel_Asm *compile_data,struct AST_Binary_Expression *bin);
void compile_shift_right_to_intel_asm(struct Compile_Data_Intel_Asm *compile_data,struct AST_Binary_Expression *bin);
void compile_less_eq_to_intel_asm(struct Compile_Data_Intel_Asm *compile_data,struct AST_Binary_Expression *bin);
void compile_greater_eq_to_intel_asm(struct Compile_Data_Intel_Asm *compile_data,struct AST_Binary_Expression *bin);
void compile_less_to_intel_asm(struct Compile_Data_Intel_Asm *compile_data,struct AST_Binary_Expression *bin);
void compile_greater_to_intel_asm(struct Compile_Data_Intel_Asm *compile_data,struct AST_Binary_Expression *bin);
void compile_equal_to_intel_asm(struct Compile_Data_Intel_Asm *compile_data,struct AST_Binary_Expression *bin);
void compile_not_equal_to_intel_asm(struct Compile_Data_Intel_Asm *compile_data,struct AST_Binary_Expression *bin);

void compile_prefix_inc_dec_inner(struct Compile_Data_Intel_Asm *compile_data,struct AST_Unary_Expression *unary,enum Intel_Asm_Instruction_Type op);
void compile_postfix_inc_dec_inner(struct Compile_Data_Intel_Asm *compile_data,struct AST_Unary_Expression *unary,enum Intel_Asm_Instruction_Type op);
void compile_comparison_inner(struct Compile_Data_Intel_Asm *compile_data,struct AST_Binary_Expression *bin,enum Intel_Asm_Instruction_Type op);
void compile_shift_inner(struct Compile_Data_Intel_Asm *compile_data,struct AST_Binary_Expression *bin,enum Intel_Asm_Instruction_Type op);
void compile_simple_bin_inner(struct Compile_Data_Intel_Asm *compile_data,struct AST_Binary_Expression *bin,enum Intel_Asm_Instruction_Type op);
void compile_mul_div_inner(struct Compile_Data_Intel_Asm *compile_data,struct AST_Binary_Expression *bin,enum Intel_Asm_Instruction_Type op);
void compile_logical_and_or_inner(struct Compile_Data_Intel_Asm *compile_data,struct AST_Binary_Expression *bin,enum Intel_Asm_Instruction_Type cmp);
void compile_op_assign_inner(struct Compile_Data_Intel_Asm *compile_data,struct AST_Binary_Expression *bin,enum Intel_Asm_Instruction_Type op);
void compile_shift_assign_inner(struct Compile_Data_Intel_Asm *compile_data,struct AST_Binary_Expression *bin,enum Intel_Asm_Instruction_Type op);


#endif