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

Subversion Repositories thor

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

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 48 robfinch
// ============================================================================
2
//        __
3
//   \\__/ o\    (C) 2012-2018  Robert Finch, Waterloo
4
//    \  __ /    All rights reserved.
5
//     \/_//     robfinch<remove>@finitron.ca
6
//       ||
7
//
8
// CC64 - 'C' derived language compiler
9
//  - 64 bit CPU
10
//
11
// This source file is free software: you can redistribute it and/or modify 
12
// it under the terms of the GNU Lesser General Public License as published 
13
// by the Free Software Foundation, either version 3 of the License, or     
14
// (at your option) any later version.                                      
15
//                                                                          
16
// This source file is distributed in the hope that it will be useful,      
17
// but WITHOUT ANY WARRANTY; without even the implied warranty of           
18
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the            
19
// GNU General Public License for more details.                             
20
//                                                                          
21
// You should have received a copy of the GNU General Public License        
22
// along with this program.  If not, see <http://www.gnu.org/licenses/>.    
23
//                                                                          
24
// ============================================================================
25
//
26
#include "stdafx.h"
27
 
28
extern char *rtrim(char *);
29
extern int caselit(scase *casetab,int64_t);
30
 
31
Operand *makereg(int r)
32
{
33
        Operand *ap;
34
    ap = allocOperand();
35
    ap->mode = am_reg;
36
    ap->preg = r;
37
    return (ap);
38
}
39
 
40
Operand *makevreg(int r)
41
{
42
        Operand *ap;
43
    ap = allocOperand();
44
    ap->mode = am_reg;
45
    ap->preg = r;
46
        ap->type = stdvector.GetIndex();
47
    return (ap);
48
}
49
 
50
Operand *makevmreg(int r)
51
{
52
        Operand *ap;
53
    ap = allocOperand();
54
    ap->mode = am_vmreg;
55
    ap->preg = r;
56
    return (ap);
57
}
58
 
59
Operand *makefpreg(int r)
60
{
61
        Operand *ap;
62
    ap = allocOperand();
63
    ap->mode = am_fpreg;
64
    ap->preg = r;
65
    ap->type = stddouble.GetIndex();
66
    return (ap);
67
}
68
 
69
Operand *makesreg(int r)
70
{
71
        Operand *ap;
72
    ap = allocOperand();
73
    ap->mode = am_sreg;
74
    ap->preg = r;
75
    return (ap);
76
}
77
 
78
Operand *makebreg(int r)
79
{
80
        Operand *ap;
81
    ap = allocOperand();
82
    ap->mode = am_breg;
83
    ap->preg = r;
84
    return (ap);
85
}
86
 
87
/*
88
 *      generate the mask address structure.
89
 */
90
Operand *make_mask(int mask)
91
{
92
        Operand *ap;
93
    ap = allocOperand();
94
    ap->mode = am_mask;
95
    ap->offset = (ENODE *)mask;
96
    return (ap);
97
}
98
 
99
/*
100
 *      make a direct reference to an immediate value.
101
 */
102
Operand *make_direct(int i)
103
{
104
        return make_offset(makeinode(en_icon,i));
105
}
106
 
107
Operand *make_indexed2(int lab, int i)
108
{
109
        Operand *ap;
110
    ENODE *ep;
111
    ep = allocEnode();
112
    ep->nodetype = en_clabcon;
113
    ep->i = lab;
114
    ap = allocOperand();
115
        ap->mode = am_indx;
116
        ap->preg = i;
117
    ap->offset = ep;
118
        ap->isUnsigned = TRUE;
119
    return (ap);
120
}
121
 
122
//
123
// Generate a direct reference to a string label.
124
//
125
Operand *make_strlab(std::string s)
126
{
127
        Operand *ap;
128
    ap = allocOperand();
129
    ap->mode = am_direct;
130
    ap->offset = makesnode(en_nacon,new std::string(s),new std::string(s),-1);
131
    return (ap);
132
}
133
 

powered by: WebSVN 2.1.0

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