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

Subversion Repositories thor

[/] [thor/] [trunk/] [FT64v5/] [software/] [CC64/] [source/] [Statement.h] - Blame information for rev 48

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 48 robfinch
#ifndef _STATEMENT
2
#define _STATEMENT
3
 
4
// ============================================================================
5
//        __
6
//   \\__/ o\    (C) 2012-2017  Robert Finch, Waterloo
7
//    \  __ /    All rights reserved.
8
//     \/_//     robfinch<remove>@finitron.ca
9
//       ||
10
//
11
// C64 - 'C' derived language compiler
12
//  - 64 bit CPU
13
//
14
// This source file is free software: you can redistribute it and/or modify 
15
// it under the terms of the GNU Lesser General Public License as published 
16
// by the Free Software Foundation, either version 3 of the License, or     
17
// (at your option) any later version.                                      
18
//                                                                          
19
// This source file is distributed in the hope that it will be useful,      
20
// but WITHOUT ANY WARRANTY; without even the implied warranty of           
21
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the            
22
// GNU General Public License for more details.                             
23
//                                                                          
24
// You should have received a copy of the GNU General Public License        
25
// along with this program.  If not, see <http://www.gnu.org/licenses/>.    
26
//                                                                          
27
// ============================================================================
28
//
29
enum e_stmt {
30
                st_empty, st_funcbody,
31
        st_expr, st_compound, st_while,
32
                st_until, st_forever, st_firstcall, st_asm,
33
                st_dountil, st_doloop,
34
                st_try, st_catch, st_throw, st_critical, st_spinlock, st_spinunlock,
35
                st_for,
36
                st_do, st_if, st_switch, st_default,
37
        st_case, st_goto, st_break, st_continue, st_label,
38
        st_return, st_vortex, st_intoff, st_inton, st_stop, st_check };
39
 
40
class Statement {
41
public:
42
        __int8 stype;
43
        Statement *outer;
44
        Statement *next;
45
        Statement *prolog;
46
        Statement *epilog;
47
        bool nkd;
48
        int predreg;            // assigned predicate register
49
        ENODE *exp;         // condition or expression
50
        ENODE *initExpr;    // initialization expression - for loops
51
        ENODE *incrExpr;    // increment expression - for loops
52
        Statement *s1, *s2; // internal statements
53
        int num;                        // resulting expression type (hash code for throw)
54
        int64_t *label;     // label number for goto
55
        int64_t *casevals;      // case values
56
        TABLE ssyms;            // local symbols associated with statement
57
        char *fcname;       // firstcall block var name
58
        char *lptr;
59
        unsigned int prediction : 2;    // static prediction for if statements
60
 
61
        static Statement *ParseStop();
62
        static Statement *ParseCompound();
63
        static Statement *ParseDo();
64
        static Statement *ParseFor();
65
        static Statement *ParseForever();
66
        static Statement *ParseFirstcall();
67
        static Statement *ParseIf();
68
        static Statement *ParseCatch();
69
        static Statement *ParseCase();
70
        int CheckForDuplicateCases();
71
        static Statement *ParseThrow();
72
        static Statement *ParseContinue();
73
        static Statement *ParseAsm();
74
        static Statement *ParseTry();
75
        static Statement *ParseExpression();
76
        static Statement *ParseLabel();
77
        static Statement *ParseWhile();
78
        static Statement *ParseUntil();
79
        static Statement *ParseGoto();
80
        static Statement *ParseReturn();
81
        static Statement *ParseBreak();
82
        static Statement *ParseSwitch(bool);
83
        static Statement *Parse(bool);
84
 
85
        void GenMixedSource();
86
        void GenerateStop();
87
        void GenerateAsm();
88
        void GenerateFirstcall();
89
        void GenerateWhile();
90
        void GenerateUntil();
91
        void GenerateFor();
92
        void GenerateForever();
93
        void GenerateIf();
94
        void GenerateDo();
95
        void GenerateDoUntil();
96
        void GenerateCompound();
97
        void GenerateCase();
98
        void GenerateTry();
99
        void GenerateThrow();
100
        void GenerateCheck();
101
        void GenerateFuncBody();
102
        void GenerateSwitch();
103
        void GenerateLinearSwitch();
104
        void GenerateTabularSwitch();
105
        void Generate();
106
};
107
 
108
#endif

powered by: WebSVN 2.1.0

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