OpenCores
URL https://opencores.org/ocsvn/c16/c16/trunk

Subversion Repositories c16

[/] [c16/] [trunk/] [compiler/] [Backend.hh] - Blame information for rev 2

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 jsauermann
 
2
#include 
3
#include 
4
 
5
#include "Node.hh"
6
 
7
enum Size
8
{
9
   SIZE_CHAR     = 1,
10
   SIZE_SHORT    = 2,
11
   SIZE_LONG     = 4,
12
 
13
   SIZE_INT      = SIZE_SHORT,
14
   SIZE_POINTER  = SIZE_INT
15
};
16
 
17
extern FILE * out;
18
 
19
class Backend
20
{
21
public:
22
   static int  check_size(int size, const char * function);
23
   static int  check_size(SUW suw,  const char * function);
24
   static void file_header();
25
   static void file_footer();
26
 
27
   static void load_rr_string(int snum, int offset);
28
   static void load_ll_string(int snum, int offset);
29
   static void load_rr_constant(int constant);
30
   static void load_ll_constant(int constant);
31
 
32
   static void load_rr_var(const char * name, SUW suw);
33
   static void load_ll_var(const char * name, SUW suw);
34
   static void load_rr_var(const char * name, int sp_offset, SUW suw);
35
   static void load_ll_var(const char * name, int sp_offset, SUW suw);
36
 
37
   static void store_rr_var(const char * name, SUW suw);
38
   static void store_rr_var(const char * name, int sp_offset, SUW suw);
39
 
40
   static void load_address(const char * name);
41
   static void add_address(const char * name);
42
   static void load_address(const char * name, int sp_offset);
43
   static void assign(int size);
44
 
45
   static void call(const char * name);
46
   static void call_ptr();
47
   static void ret(int autosize);
48
 
49
   static void push_rr(SUW suw);
50
   static void pop_rr (SUW suw);
51
   static void pop_ll (SUW suw);
52
   static void pop(int pushed);
53
   static void pop_return(int ret_bytes);
54
   static int  push_return(int ret_bytes);
55
   static void push_zero(int bytes);
56
 
57
   static void move_rr_to_ll();
58
 
59
   static void compute_unary(int what, const char * pretty);
60
   static void compute_binary(int what, bool uns, const char * pretty);
61
   static void compute_binary(int what, bool uns, const char * pretty,
62
                              int value);
63
   static void mult_shift(int value, bool negative);
64
   static void div_shift(int value, bool negative, bool uns);
65
   static void mod_and(int value, bool negative, bool uns);
66
 
67
   static void compute_binary(int what, bool uns, int value,
68
                              const char * pretty);
69
   static void content(SUW suw);
70
   static void scale_rr(int size);
71
   static void unscale_rr(int size, bool uns);
72
 
73
   static void asmbl(const char * asm_string);
74
   static void asm_adjust(const char * asm_line);
75
   static void label(int lab);
76
   static void label(const char * name);
77
   static void label(const char * name, int loop);
78
   static void label(const char * name, int loop, int value);
79
   static void branch(int lab);
80
   static void branch(const char * name, int loop);
81
   static void branch(const char * name);
82
   static void branch_true(const char * name, int loop, int size);
83
   static void branch_false(const char * name, int lab, int size);
84
   static void branch_case(const char * name, int loop, int size, int value);
85
   static int  GetSP()       { return stack_pointer; };
86
   static int  get_label()   { return label_num++; };
87
   static int  new_function(const char * fname);
88
 
89
private:
90
   static int stack_pointer;
91
   static int label_num;
92
   static int function_num;
93
};

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.