1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118
|
#ifndef __TStatement__
#define __TStatement__
#include "TPrintable.hh"
#include "TType.hh"
#include "TIndex.hh"
#include "TAddress.hh"
#include <vector>
struct TValue;
struct TStatement : public TPrintable
{
virtual ~TStatement() {}
virtual void generate(ostream* dst, int n) = 0;
virtual void generateCPP(ostream* dst, int n) = 0;
virtual void generateCPPNoAlias(ostream* dst, int n) = 0;
};
struct TDeclareStatement : public TStatement
{
#ifdef ALT_VECTOR
TVectorAddress* fVector;
TDeclareStatement(TVectorAddress* vector):fVector(vector) {}
#else
TNamedAddress* fVector;
TDeclareStatement(TNamedAddress* vector):fVector(vector) {}
#endif
virtual ~TDeclareStatement() {}
virtual void generate(ostream* dst, int n);
virtual void generateCPP(ostream* dst, int n);
virtual void generateCPPNoAlias(ostream* dst, int n);
};
struct TDeclareTypeStatement : public TStatement
{
TType* fType;
TDeclareTypeStatement(TType* type):fType(type) {}
virtual ~TDeclareTypeStatement() {}
virtual void generate(ostream* dst, int n);
virtual void generateCPP(ostream* dst, int n);
virtual void generateCPPNoAlias(ostream* dst, int n);
};
struct TStoreStatement : public TStatement
{
TAddress* fAddress;
TValue* fValue;
TStoreStatement(TAddress* address, TValue* value):fAddress(address), fValue(value){}
virtual void generate(ostream* dst, int n);
virtual void generateCPP(ostream* dst, int n);
virtual void generateCPPNoAlias(ostream* dst, int n);
void generateSubLoops(ostream* dst, int n, const vector<int>& dimensions, int deep);
TValue* generateSubValues(TValue* value, const vector<int>& dim);
TAddress* generateSubAddressLoad(TAddress* address, const vector<int>& dim);
TAddress* generateSubAddressStore(TAddress* address, const vector<int>& dim);
};
struct TBlockStatement : public TStatement
{
vector<TStatement*> fCode;
virtual void generate(ostream* dst, int n);
virtual void generateCPP(ostream* dst, int n);
virtual void generateCPPNoAlias(ostream* dst, int n);
};
struct TLoopStatement : public TStatement
{
int fSize;
TIndex* fIndex;
TBlockStatement* fCode;
TLoopStatement(int size, TIndex* index, TBlockStatement* code):fSize(size), fIndex(index), fCode(code) {}
virtual void generate(ostream* dst, int n);
virtual void generateCPP(ostream* dst, int n);
virtual void generateCPPNoAlias(ostream* dst, int n);
};
struct TSubLoopStatement : public TLoopStatement
{
TSubLoopStatement(int size, TIndex* index, TBlockStatement* code):TLoopStatement(size, index, code) {}
virtual void generate(ostream* dst, int n);
virtual void generateCPP(ostream* dst, int n);
virtual void generateCPPNoAlias(ostream* dst, int n);
};
struct TIfStatement : public TStatement
{
TIndex* fIndex;
TBlockStatement* fCode;
TIfStatement(TIndex* index, TBlockStatement* code):fIndex(index), fCode(code) {}
virtual void generate(ostream* dst, int n);
virtual void generateCPP(ostream* dst, int n);
virtual void generateCPPNoAlias(ostream* dst, int n);
};
#endif
|