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

Subversion Repositories c16

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

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 7 jsauermann
   static void ret();
48 2 jsauermann
 
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 7 jsauermann
   static void pop_jump(int diff);
54 2 jsauermann
   static void pop_return(int ret_bytes);
55
   static int  push_return(int ret_bytes);
56
   static void push_zero(int bytes);
57
 
58
   static void move_rr_to_ll();
59
 
60
   static void compute_unary(int what, const char * pretty);
61
   static void compute_binary(int what, bool uns, const char * pretty);
62
   static void compute_binary(int what, bool uns, const char * pretty,
63
                              int value);
64
   static void mult_shift(int value, bool negative);
65
   static void div_shift(int value, bool negative, bool uns);
66
   static void mod_and(int value, bool negative, bool uns);
67
 
68
   static void compute_binary(int what, bool uns, int value,
69
                              const char * pretty);
70
   static void content(SUW suw);
71
   static void scale_rr(int size);
72
   static void unscale_rr(int size, bool uns);
73
 
74
   static void asmbl(const char * asm_string);
75
   static void asm_adjust(const char * asm_line);
76
   static void label(int lab);
77
   static void label(const char * name);
78
   static void label(const char * name, int loop);
79
   static void label(const char * name, int loop, int value);
80
   static void branch(int lab);
81
   static void branch(const char * name, int loop);
82
   static void branch(const char * name);
83
   static void branch_true(const char * name, int loop, int size);
84
   static void branch_false(const char * name, int lab, int size);
85
   static void branch_case(const char * name, int loop, int size, int value);
86
   static int  GetSP()       { return stack_pointer; };
87
   static int  get_label()   { return label_num++; };
88
   static int  new_function(const char * fname);
89
 
90
private:
91
   static int stack_pointer;
92
   static int label_num;
93
   static int function_num;
94
};

powered by: WebSVN 2.1.0

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