OpenADFortTk (basic)
src/lib/support/XAIFStrings.cxx
Go to the documentation of this file.
00001 // ##########################################################
00002 // # This file is part of OpenADFortTk.                     #
00003 // # The full COPYRIGHT notice can be found in the top      #
00004 // # level directory of the OpenADFortTk source tree.       #
00005 // # For more information visit                             #
00006 // # http://www.mcs.anl.gov/openad                          #
00007 // ##########################################################
00008 
00009 #include <iostream>
00010 
00011 #include <stdlib.h>
00012 #include <string.h>
00013 
00014 #include "XAIFStrings.h"
00015 
00016 
00017 using std::cerr;
00018 using std::endl;
00019 
00020 
00021 XAIFStringRepository XAIFStrings;
00022 
00023 // Note: The order must match the enumeration!
00024 const char* XAIFStringRepository::c_strTbl[] = {
00025   // -----------------------------------------------------
00026   
00027   // Common attributes
00028   "annotation",
00029   "vertex_id",
00030   "edge_id",
00031   "scope_id",
00032   "symbol_id",
00033   
00034   "active",
00035   "deriv",
00036   
00037   "source",
00038   "target",
00039   
00040   "lineNumber",
00041 
00042   // -----------------------------------------------------
00043   // top level
00044 
00045   "prefix",
00046 
00047   // -----------------------------------------------------
00048   // xaif:CallGraph
00049   "xaif:CallGraph",
00050 
00051   // -----------------------------------------------------
00052   // xaif:ScopeHierarchy, xaif:Scope, xaif:SymbolTable
00053   "xaif:ScopeHierarchy",
00054   "xaif:Scope",
00055   "xaif:SymbolTable",
00056 
00057   // xaif:Symbol
00058   "xaif:Symbol",
00059   "kind",
00060   "type",
00061   "feType",
00062   "shape",
00063   "temp",
00064   
00065   // xaif:DimensionBounds
00066   "xaif:DimensionBounds",
00067   "lower",
00068   "upper",
00069   
00070   // -----------------------------------------------------
00071   
00072   // xaif:ControlFlowGraph, xaif:ReplacementList, xaif:Replacement
00073   "xaif:ControlFlowGraph",
00074   "xaif:ReplacementList", 
00075   
00076   "xaif:ArgumentList",
00077   "xaif:ArgumentSymbolReference",
00078   "intent",
00079   "structured",
00080   
00081   "xaif:Replacement",
00082   "placeholder",
00083   
00084   "xaif:ControlFlowEdge",
00085   "has_condition_value",
00086   "condition_value",
00087   
00088   // xaif:BasicBlock
00089   "xaif:BasicBlock",
00090   "xaif:Entry",
00091   "xaif:Exit",
00092   "xaif:Branch",
00093   "xaif:ForLoop",
00094   "xaif:PreLoop",
00095   "xaif:PostLoop",
00096   
00097   "xaif:EndBranch",
00098   "xaif:EndLoop",
00099   
00100   "xaif:Initialization",
00101   "xaif:Condition",
00102   "xaif:Update",
00103   
00104   // Statements
00105   "xaif:Assignment",
00106   "xaif:SubroutineCall",
00107   "xaif:InlinableSubroutineCall",
00108   "xaif:Marker",
00109   
00110   "xaif:AssignmentLHS",
00111   "xaif:AssignmentRHS",
00112   
00113   "xaif:Argument",
00114   
00115   "subroutine_name",
00116   "formalArgCount",
00117   
00118   // Expressions
00119   "xaif:VariableReference",
00120   "xaif:Constant",
00121   "xaif:Intrinsic",
00122   "xaif:FunctionCall",
00123   "xaif:BooleanOperation",
00124 
00125   "xaif:ExpressionEdge",
00126 
00127   "name",
00128   "value",
00129   "position",
00130   
00131   // Variable Reference Expressions
00132   "xaif:SymbolReference",
00133   "xaif:ArrayElementReference",
00134   
00135   "xaif:IndexTriplet",
00136   "xaif:Index",
00137   "xaif:Bound",
00138   "xaif:Stride",
00139   
00140   "xaif:VariableReferenceEdge",
00141 
00142   // DerivativeAccumulator
00143   "xaif:DerivativePropagator", // block
00144   
00145   "xaif:SetDeriv",             // stmt
00146   "xaif:SetNegDeriv",
00147   "xaif:IncDeriv",
00148   "xaif:DecDeriv",
00149   "xaif:ZeroDeriv",
00150   "xaif:Sax",
00151   "xaif:Saxpy",
00152   
00153   "xaif:Tgt",                  // expr
00154   "xaif:Src",
00155   "xaif:AX",
00156   "xaif:A",
00157   "xaif:X",
00158   "xaif:Y",
00159   
00160   // -----------------------------------------------------
00161   
00162   // Special tags
00163   "{SymTab_Id#",
00164   "{Sym_Id#",
00165   "{PU_Id#",
00166   "{WHIRL_Id#",
00167   
00168   "{StmtGoto#",
00169   "{StmtLabel#",
00170   "{StmtReturn#",
00171   
00172   "{IntrinsicKey#",
00173   "{PregId#",
00174   
00175   "}"
00176 };
00177 
00178 XAIFStringRepository::XAIFStringRepository()
00179 { 
00180   x_strTbl = new XMLCh*[NUM_STRINGS];
00181   for (int i = 0; i < NUM_STRINGS; ++i) {
00182     x_strTbl[i] = NULL;
00183   }
00184 }
00185 
00186 void
00187 XAIFStringRepository::XMLInitialize()
00188 { 
00189   for (int i = 0; i < NUM_STRINGS; ++i) {
00190     const char* str = c_strTbl[i];
00191     unsigned int len = strlen(str);
00192     
00193     x_strTbl[i] = new XMLCh[len + 1];
00194     XMLString::transcode(str, x_strTbl[i], len);
00195   }
00196 }
00197 
00198 XAIFStringRepository::~XAIFStringRepository()
00199 {
00200   for (int i = 0; i < NUM_STRINGS; ++i) {
00201     delete[] x_strTbl[i];
00202   }
00203   delete[] x_strTbl;
00204 }
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines