summaryrefslogtreecommitdiff
path: root/include/stencil.hh
blob: 09471e89f6b4a5a430a55be4801d7e14192ca5f4 (plain)
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

#pragma once

#include "ir_clang.hh"
#include "chillAST/chillASTs.hh"

//#include <omega.h>
#include <omegatools.hh>
#include "code_gen/CG_chillRepr.h"

// #include "loop.hh"
#include "ir_code.hh"



// *extern Loop *myloop;  // ???


//void stencil( chillAST_Node *topstatement, class stencilInfo &SI ); // stencilInfo was originally a struct, and this was the way it got filled in.  TODO remove


class stencilInfo {
public:
  uint dimensions;        // number of dimensions in the stencil
  uint elements;          // total number of elements in the stencil
  chillAST_VarDecl *srcArrayVariable;   // the variable of the source array
  chillAST_VarDecl *dstArrayVariable;   // the variable of the destination array

  int minOffset[3];         // the minimum offset for each dimension  NOTE hardcoded to 3 dimensions TODO 
  int maxOffset[3];         // the maximum offset for each dimension

  chillAST_VarDecl *indexVariables[3];  // the variable used for indexing each dimension

  std::vector<std::vector<int> > offsets;  //  k+1, j-47, i+0   etc


  std::vector<std::vector<chillAST_Node *> > coefficients;  // the coefficients of for each element, NOT IN ANY SET ORDER
  chillAST_Node *find_coefficient(int i, int j, int k); // hardcoded 3 dimensions TODO

  // constructors
  stencilInfo();

  stencilInfo(chillAST_Node *topstatement);

  void walktree(chillAST_Node *node, std::vector<chillAST_Node *> &coeffstohere);

  void print(FILE *fp = stdout);

  int radius();

  bool isSymmetric();

};  // class stencilInfo