WONKY



LOG | FILES | OVERVIEW


#ifndef WONKY_INTEL_ASM_INSTRUCTION_H
#define WONKY_INTEL_ASM_INSTRUCTION_H WONKY_INTEL_ASM_INSTRUCTION_H
#include <intel_instruction.hh>

#include <intel_location.h>
#include <intel_asm.h>
#include <stdio.h>
#include <stdlib.h>
#include <wonky_malloc.h>
#include <wonky_stream.h>

struct Intel_Asm_Instruction
{
	enum Intel_Asm_Instruction_Type type;
};
struct Intel_Asm_Label
{
	enum Intel_Asm_Instruction_Type type;
	char *label_name;
};
struct Intel_Asm_Instruction_Binary
{
	enum Intel_Asm_Instruction_Type type;

	struct Intel_Asm_Memory_Location *left;
	struct Intel_Asm_Memory_Location *right;
};
struct Intel_Asm_Instruction_Unary
{
	enum Intel_Asm_Instruction_Type type;

	struct Intel_Asm_Memory_Location *operand;
};
struct Intel_Asm_Instruction_Jump
{
	enum Intel_Asm_Instruction_Type type;

	struct Intel_Asm_Label *where_to; 
};
struct Intel_Asm_Instruction_Define_Bytes
{
	enum Intel_Asm_Instruction_Type type;

	int number_of_bytes;
	unsigned char *bytes;

};
struct Intel_Asm_Instruction* get_intel_asm_import(char *what);
struct Intel_Asm_Instruction* get_intel_asm_export(char *what);
struct Intel_Asm_Instruction* get_intel_asm_label_inner(char *label,enum Intel_Asm_Instruction_Type type);
struct Intel_Asm_Instruction* get_intel_asm_label(char *label);
struct Intel_Asm_Instruction* get_intel_asm_new_unique_label(struct Compile_Data_Intel_Asm *compile_data);
struct Intel_Asm_Instruction* get_intel_asm_binary_instruction(struct Intel_Asm_Memory_Location *left,struct Intel_Asm_Memory_Location *right,enum Intel_Asm_Instruction_Type type);
struct Intel_Asm_Instruction* get_intel_asm_unary_instruction(struct Intel_Asm_Memory_Location *operand,enum Intel_Asm_Instruction_Type type);
struct Intel_Asm_Instruction* get_intel_asm_jump_instruction(struct Intel_Asm_Label *where_to,enum Intel_Asm_Instruction_Type type);
struct Intel_Asm_Instruction* get_intel_asm_simple_instruction(enum Intel_Asm_Instruction_Type type);
struct Intel_Asm_Instruction* get_intel_asm_define_bytes(unsigned char *bytes,int number_of_bytes);

struct Intel_Asm_Instruction* intel_asm_get_pop(enum Intel_Asm_Memory_Location_Type reg);
struct Intel_Asm_Instruction* intel_asm_get_push(enum Intel_Asm_Memory_Location_Type reg);

void save_intel_asm_instruction(struct Intel_Asm_Instruction *instruction,struct wonky_stream *out);
void save_intel_asm_label(struct Intel_Asm_Label *label,struct wonky_stream *out);
void save_intel_asm_import(struct Intel_Asm_Label *im,struct wonky_stream *out);
void save_intel_asm_export(struct Intel_Asm_Label *ex,struct wonky_stream *out);
void save_intel_asm_binary_instruction(struct Intel_Asm_Instruction_Binary *bin,struct wonky_stream *out);
void save_intel_asm_unary_instruction(struct Intel_Asm_Instruction_Unary *unary,struct wonky_stream *out);
void save_intel_asm_jump_instruction(struct Intel_Asm_Instruction_Jump *jmp,struct wonky_stream *out);
void save_intel_asm_simple_instruction(struct Intel_Asm_Instruction *instruction,struct wonky_stream *out);
void save_intel_asm_define_bytes(struct Intel_Asm_Instruction_Define_Bytes *instruction,struct wonky_stream *out);

#endif