OpenADFortTk (including Open64 and OpenAnalysis references)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
WhirlParentize.h
Go to the documentation of this file.
1 // -*-Mode: C++;-*-
2 // $Header: /Volumes/cvsrep/developer/OpenADFortTk/src/WhirlParentize.h,v 1.4 2004/04/14 21:25:21 eraxxon Exp $
3 #ifndef WhirlParentize_h_INCLUDED
4 #define WhirlParentize_h_INCLUDED
5 
7 
8 namespace fortTkSupport {
9 
10  // FindParentWNBlock: Given two WHIRL nodes, a subtree 'wn_tree' and an
11  // some descendent 'wn', return the BLOCK WN that contains 'wn', or
12  // NULL.
13  //
14  // Warning: This routine does not require creation of a
15  // 'WhirlParentMap'. Use sparingly and carefully or order statistics
16  // will bite you!
17  extern WN*
18  FindParentWNBlock(const WN* wn_tree, const WN* wn);
19 
20 
27  public:
28 
30  WhirlParentMap(const WN* wn); // automatically creates the map
32 
33  // Create: Given a WN*, creates the map. Clears any previously existing map.
34  void Create(const WN* wn);
35 
36  // Clear: Clears the map.
37  void Clear();
38 
39  // Find: Given a WN*, return its parent. N.B. Does not check that
40  // the map exists.
41  WN* Find(const WN* wn) { return (WN *)WN_MAP_Get(parentMap, wn); }
42 
43  // Find: Given a WN*, find the first enclosing block or NULL.
44  // N.B. Does not check that the map exists.
45  WN* FindBlock(const WN* wn);
46 
47  // Insert: Given a WN* and its parent, insert in the map. Overwrites
48  // any existing value.
49  void Insert(const WN* wn, const WN* parent) {
50  WN_MAP_Set(parentMap, (WN*)wn, (void *)parent);
51  }
52 
53  // GetMap: returns the parent map. Intended to be only used with
54  // Open64 routines that want a parent map.
55  WN_MAP GetMap() const { return parentMap; }
56 
57  private:
58  void Ctor();
59  void Parentize(const WN* wn);
60 
61  private:
62  // For now keep the implementation using Open64's WN_MAP
65  };
66 
67 
68 
69 }
70 
71 #endif