[Rose-commits] r116 - in trunk: . docs/Rose/Tutorial projects/AstEquivalence projects/AstEquivalence/gui projects/BinQ src/ROSETTA src/ROSETTA/Grammar src/ROSETTA/src src/frontend/BinaryDisassembly src/frontend/CxxFrontend src/frontend/OpenFortranParser_SAGE_Connection src/frontend/SageIII src/frontend/SageIII/astMerge src/frontend/SageIII/sageInterface src/midend/abstractHandle src/midend/astRewriteMechanism src/midend/astUtil/astInterface tests/roseTests/programTransformationTests tutorial

liaoch at osp5.lbl.gov liaoch at osp5.lbl.gov
Wed Nov 5 13:05:35 PST 2008


Author: liaoch
Date: 2008-11-05 13:05:34 -0800 (Wed, 05 Nov 2008)
New Revision: 116

Added:
   trunk/src/frontend/CxxFrontend/roseBinaryEDG-i686-apple-darwin9.5.0-b0847234cb4f3e1afaefa965207df2c0.tar.gz
   trunk/src/frontend/CxxFrontend/roseBinaryEDG-i686-pc-linux-gnu-b0847234cb4f3e1afaefa965207df2c0.tar.gz
   trunk/src/frontend/CxxFrontend/roseBinaryEDG-x86_64-pc-linux-gnu-b0847234cb4f3e1afaefa965207df2c0.tar.gz
Removed:
   trunk/src/frontend/CxxFrontend/roseBinaryEDG-i686-apple-darwin9.5.0-a5c62cade59e5dde06c3a52de198435b.tar.gz
   trunk/src/frontend/CxxFrontend/roseBinaryEDG-i686-pc-linux-gnu-a5c62cade59e5dde06c3a52de198435b.tar.gz
   trunk/src/frontend/CxxFrontend/roseBinaryEDG-x86_64-pc-linux-gnu-a5c62cade59e5dde06c3a52de198435b.tar.gz
Modified:
   trunk/configure.in
   trunk/docs/Rose/Tutorial/abstractHandle.tex
   trunk/projects/AstEquivalence/createTextFiles.C
   trunk/projects/AstEquivalence/gui/compilerFlagsGui.C
   trunk/projects/BinQ/BinQGui.C
   trunk/projects/BinQ/Clone.C
   trunk/projects/BinQ/slide.C
   trunk/src/ROSETTA/Grammar/Support.code
   trunk/src/ROSETTA/astNodeList
   trunk/src/ROSETTA/src/grammar.C
   trunk/src/ROSETTA/src/support.C
   trunk/src/frontend/BinaryDisassembly/RoseBin_support.h
   trunk/src/frontend/BinaryDisassembly/instructionDispatch.cpp
   trunk/src/frontend/BinaryDisassembly/make-decision-tree.tcl
   trunk/src/frontend/CxxFrontend/Makefile.am
   trunk/src/frontend/OpenFortranParser_SAGE_Connection/FortranModuleInfo.C
   trunk/src/frontend/SageIII/astMerge/merge.C
   trunk/src/frontend/SageIII/sageInterface/sageBuilder.C
   trunk/src/frontend/SageIII/sageInterface/sageInterface.h
   trunk/src/frontend/SageIII/sageSupport.C
   trunk/src/midend/abstractHandle/loopAdapter.cpp
   trunk/src/midend/abstractHandle/myloop.h
   trunk/src/midend/abstractHandle/testMyLoop.cpp
   trunk/src/midend/astRewriteMechanism/rewriteMidLevelInterfaceTemplatesImpl.h
   trunk/src/midend/astUtil/astInterface/AstInterface.C
   trunk/tests/roseTests/programTransformationTests/finiteDifferencingDemo.C
   trunk/tutorial/abstractHandle2.cpp
Log:
Load rose-0.9.4a-2922 into trunk.


Modified: trunk/configure.in
===================================================================
--- trunk/configure.in	2008-11-04 21:05:45 UTC (rev 115)
+++ trunk/configure.in	2008-11-05 21:05:34 UTC (rev 116)
@@ -730,7 +730,7 @@
 
 AM_CONDITIONAL(BINARY_EDG_TARBALL_ENABLED, [test "x$binary_edg_tarball_enabled" = "xyes"])
 
-release_binary_compatibility_signature="a5c62cade59e5dde06c3a52de198435b" # This variable will be substituted in binary-EDG release copies of configure.in
+release_binary_compatibility_signature="b0847234cb4f3e1afaefa965207df2c0" # This variable will be substituted in binary-EDG release copies of configure.in
 build_triplet_without_redhat=`echo $build | sed s/-redhat-/-pc-/ | sed s/-unknown-/-pc-/`
 expected_binary_edg_dirname="roseBinaryEDG-${build_triplet_without_redhat}-${release_binary_compatibility_signature}"
 expected_binary_edg_tarball="${expected_binary_edg_dirname}.tar.gz"

Modified: trunk/docs/Rose/Tutorial/abstractHandle.tex
===================================================================
--- trunk/docs/Rose/Tutorial/abstractHandle.tex	2008-11-04 21:05:45 UTC (rev 115)
+++ trunk/docs/Rose/Tutorial/abstractHandle.tex	2008-11-05 21:05:34 UTC (rev 116)
@@ -1,38 +1,66 @@
 \chapter{Abstract Handles to Language Constructs}
-This chapter describes a reference design and its corresponding implementation for supporting abstract handles to language constructs in source code and optimization phases. 
-It can be used to facilitate the interoperability between compilers and tools. 
+This chapter describes a reference design and its corresponding implementation for
+supporting abstract handles to language constructs in source code and optimization
+phases. It can be used to facilitate the interoperability between compilers and tools.
+We define an abstract handle as a representation for a unique language construct in a
+specific program.  Interoperability between tools is achieved by writing out the abstract handles as
+strings and reading them within other tools to build the equivalent abstract handle.
+\footnote{Abstract Handles are not appropriate for program analysis
+since they are not intended to be used to capture the full structure of a program. Instead, 
+Abstract Handles represent references to language constructs in a program, capturing only
+a program's local structure; intended to support interoperability between source based
+tools (including compilers).  We don't advise the use of abstract handles in an
+aggressive way to construct an alternative intermediate representation (IR) for a full
+program.}
 
-The idea is to define unique identifiers for statements, loops, functions, 
-and other language constructs in source code. Given the diverse user
-requirements, an ideal specification should include multiple forms to specify a language construct. 
-Current, we are interested in the following forms for specifying language constructs:
+The idea is to define identifiers for unique statements, loops, functions, 
+and other language constructs in source code. Given the diverse user requirements, an
+ideal specification should include multiple forms to specify a language construct.
+
+Currently, we are interested in the following forms for specifying language constructs:
 \begin{itemize}
-\item Source file position information including path, filename, line and column number etc. 
-GNU standard source position from
-\url{http://www.gnu.org/prep/standards/html\_node/Errors.html} presents
-some examples.  
-\item Global or local numbering of specified language construct in source file
-  (e.g. 2nd "do" loop in a global scope).  The file is itself specified using an abstract
-          handle (typically generated from the file name). 
-\item Global or local names of constructs. Some language constructs, such
-as files, function definitions and namespace, have names which can be
-used as their handle within a context.
-\item Language-specific label mechanisms. They include named constructs in Fortran, numbered labels in Fortran, and statement labels in C and C++ and so on. 
+   \item Source file position information including path, filename, line and column number etc. 
+      GNU standard source position from 
+      \url{http://www.gnu.org/prep/standards/html\_node/Errors.html} presents
+      some examples.  
+   \item Global or local numbering of specified language construct in source file
+      (e.g. 2nd "do" loop in a global scope).  The file is itself specified using an
+       abstract handle (typically generated from the file name). 
+   \item Global or local names of constructs. Some language constructs, such
+      as files, function definitions and namespace, have names which can be
+      used as their handle within a context.
+   \item Language-specific label mechanisms. These include named constructs in Fortran,
+      numbered labels in Fortran, and statement labels in C and C++, etc. 
 \end{itemize}
 In addition to human-readable forms, compilers and tools can generate
 internal IDs for language constructs. It is up to compiler/tool developers
 to provide a way to convert their internal representations into human-readable formats. 
 
-We define an abstract handle as a unique representation for a language construct. It can have any of the human-readable or machine-generated forms. 
-A handle can be used alone or combined with other handles to specify a language construct. 
-A handle can also be converted from one form to another.
+% We define an abstract handle as a unique representation for a language construct. It can
+Abstract Handles can
+have any of the human-readable or machine-generated forms. A handle can be used alone or
+combined with other handles to specify a language construct. A handle can also be
+converted from one form to another (e.g. from a compiler specific form to an human
+readable form relative to the source position; filename, line number, etc.).
 Abstract handles can have different lifetimes depending on their use and implementation. 
-An abstract handle might be required to be persistent if it is used to reference a language construct that would be optimized over  multiple executions of one or more different tools. 
-Where as an abstract-handle might be internally generated only for purposes of
-           optimizations used in a single execution (e.g. optimization within a compiler). 
+An abstract handle might be required to be persistent if it is used to reference a
+language construct that would be optimized over multiple executions of one or more
+different tools. Where as an abstract-handle might be internally generated only for
+purposes of optimizations used in a single execution (e.g. optimization within a compiler).
 
+\section{Use Case}
+   A typical use can for Abstract Handles might be for a performance tool to 
+identify a collection of loops in functions that are computationally intensive
+and to construct Abstract Handles that refer to this specific loops.  Then
+pass the Abstract Handles to a second tool that might analyze the source code
+and/or the binary executable to evaluate if the computational costs are reasonable 
+or if optimizations might be possible.  The specific goal of the Abstract Handles
+is to support these sorts of uses within autotuning using diverse tools used
+and/or developed as part of autotuning research within the DOE SciDAC PERI project.
+
 \section{Syntax}
-A possible specification of language handles can have the following syntax:
+%  A possible specification of language handles can have the following syntax:
+   A possible grammar for abstract handles could be:
 
 \begin{verbatim}
 /* a handle is a single handle item or a link of them separated by ::, or
@@ -86,7 +114,7 @@
 
 \section{Examples}
 We give some examples of language handles using the syntax mentioned above. 
-ROSE AST's node type names are used as the construct type names. 
+Canonical AST's node type names are used as the construct type names. 
 Other implementations can use their own construct type names.
 
 \begin{itemize}
@@ -132,29 +160,34 @@
 \end{itemize}
 
 \section{Reference Implementation}
-We provide a reference implementation of the abstract handle concept. 
-The source files are located in \textit{src/midend/abstractHandle}.
+Abstract Handles are fundamentally compiler and tool independent, however to
+clarify the concepts, provide meaningful examples, a working reference 
+implementation we have provided a reference implementation in ROSE.
+% Within ROSE we provide a reference implementation of the abstract handle concept. 
+The source files are located in \textit{src/midend/abstractHandle} in the ROSE distribution.
 A generic interface (abstract\_handle.h and abstract\_handle.cpp) provides
-data structures and operations for manipulating abstract handles using source file positions, numbering, or names. 
-Any compilers and tools can have their own implementations using the same interface.  
+data structures and operations for manipulating abstract handles using source file
+positions, numbering, or names. Any compilers and tools can have their own implementations
+using the same interface.
+
 \subsection{Connecting to ROSE}
 A ROSE adapter (roseAdapter.h and roseAdapter.cpp) using the interface is
 provided as a concrete implementation for the maximum capability of the
-implementation.
-
-Figure~\ref{Tutorial:abstractHandle1} shows the code to generate abstract
+implementation (within a source-to-source compiler).
+Figure~\ref{Tutorial:abstractHandle1} shows the code (using ROSE) to generate abstract
 handles for loops in an input source file (as in
 Figure~\ref{Tutorial:abstractHandle1input}). 
-Abstract handle constructors generate handles from abstract nodes, which are implemented using ROSE AST nodes. 
-Source position is used by default to generate a handle item. 
+Abstract handle constructors generate handles from abstract nodes, which are implemented
+using ROSE AST nodes. Source position is used by default to generate a handle item. 
 Names or numbering are used instead when source position information is not available. 
-The Constructor can also be used to generate a handle item using a
-specified handle type (numbering handles in the example).
-Figure~\ref{Tutorial:abstractHandle1out} is the output showing the generated handles for the loops.
+The Constructor can also be used to generate a handle item using a specified handle type
+(numbering handles in the example). Figure~\ref{Tutorial:abstractHandle1out} is the output
+showing the generated handles for the loops.
+
 %---------------------example 1. ----------------------
 \begin{figure}[!h]
 {\indent
-{\mySmallestFontSize
+{\mySmallFontSize
 % Do this when processing latex to generate non-html (not using latex2html)
 \begin{latexonly}
   \lstinputlisting{\TutorialExampleDirectory/abstractHandle1.cpp}
@@ -169,13 +202,13 @@
 }
 % End of scope in indentation
 }
-\caption{Generated handles for loops: using constructors with or without a specified handle type}
+\caption{Example 1: Generated handles for loops: using constructors with or without a specified handle type.}
 \label{Tutorial:abstractHandle1}
 \end{figure}
 %------------------ input------------------------------
 \begin{figure}[!h]
 {\indent
-{\mySmallestFontSize
+{\mySmallFontSize
 % Do this when processing latex to generate non-html (not using latex2html)
 \begin{latexonly}
   \lstinputlisting{\TutorialExampleDirectory/inputCode_AbstractHandle1.cpp}
@@ -190,7 +223,7 @@
 }
 % End of scope in indentation
 }
-\caption{Source code with some loops}
+\caption{Example 1: Example source code with some loops, used as input.}
 \label{Tutorial:abstractHandle1input}
 \end{figure}
 
@@ -198,7 +231,7 @@
 %---------------------example 1's output ----------------------
 \begin{figure}[!h]
 {\indent
-{\mySmallestFontSize
+{\mySmallFontSize
 % Do this when processing latex to generate non-html (not using latex2html)
 \begin{latexonly}
   \lstinputlisting{\TutorialExampleBuildDirectory/abstractHandle1.outx}
@@ -213,11 +246,12 @@
 }
 % End of scope in indentation
 }
-\caption{Handles generated for loops}
+\caption{Example 1: Abstract handles generated for loops.}
 \label{Tutorial:abstractHandle1out}
 \end{figure}
 
-Another example (shown in Figure~\ref{Tutorial:abstractHandle2})
+\clearpage
+A second example (shown in Figure~\ref{Tutorial:abstractHandle2})
 demonstrates how to create handles using user-specified strings
 representing handle items for language constructs within a source file
 (shown in Figure~\ref{Tutorial:abstractHandle2input}). 
@@ -227,7 +261,7 @@
 %---------------------example 2. ----------------------
 \begin{figure}[!h]
 {\indent
-{\mySmallestFontSize
+{\mySmallFontSize
 % Do this when processing latex to generate non-html (not using latex2html)
 \begin{latexonly}
   \lstinputlisting{\TutorialExampleDirectory/abstractHandle2.cpp}
@@ -242,14 +276,14 @@
 }
 % End of scope in indentation
 }
-\caption{Generated handles from strings representing handle items}
+\caption{Example 2: Generated handles from strings representing handle items.}
 \label{Tutorial:abstractHandle2}
 \end{figure}
 
 %------------------ input------------------------------
 \begin{figure}[!h]
 {\indent
-{\mySmallestFontSize
+{\mySmallFontSize
 % Do this when processing latex to generate non-html (not using latex2html)
 \begin{latexonly}
   \lstinputlisting{\TutorialExampleDirectory/inputCode_AbstractHandle2.cpp}
@@ -264,7 +298,7 @@
 }
 % End of scope in indentation
 }
-\caption{Source code with some language constructs}
+\caption{Example 2: Source code with some language constructs.}
 \label{Tutorial:abstractHandle2input}
 \end{figure}
 
@@ -272,7 +306,7 @@
 %---------------------example 2's output ----------------------
 \begin{figure}[!h]
 {\indent
-{\mySmallestFontSize
+{\mySmallFontSize
 % Do this when processing latex to generate non-html (not using latex2html)
 \begin{latexonly}
   \lstinputlisting{\TutorialExampleBuildDirectory/abstractHandle2.outx}
@@ -287,21 +321,25 @@
 }
 % End of scope in indentation
 }
-\caption{Handles generated from string and their language constructs}
+\caption{Example 2: Handles generated from string and their language constructs.}
 \label{Tutorial:abstractHandle2out}
 \end{figure}
 
+\clearpage
 \subsection{Connecting to External Tools}
-We give yet another example to demonstrate how to use the abstract interface
-with any other tools, which may have less features in terms of
-supported language constructs and their correlations compared to a compiler. 
-Assume a tool operating on some simple for-loops
-within a source file. The data structure representing such loops is given
-in Figure~\ref{Tutorial:myloop}.
-
+   A third example is provided to demonstrate how to use the abstract interface
+with any other tools, which may have less features in terms of supported language
+constructs and their correlations compared to a compiler. 
+Assume a tool operating on some simple for-loops within an arbitrary source file (the
+input file is not shown in this example). Such a tool might
+have an internal data structure representing loops; such as that in given in 
+Figure~\ref{Tutorial:myloop}.  We will show how the tool specific data structure
+for loops can be used to generate abstract handles and output as strings that can
+be used by other tools which use abstract handles (which would generate the
+abstract handles by reading the strings).
 \begin{figure}[!h]
 {\indent
-{\mySmallestFontSize
+{\mySmallFontSize
 % Do this when processing latex to generate non-html (not using latex2html)
 \begin{latexonly}
   \lstinputlisting{\TutorialExampleDirectory/../src/midend/abstractHandle/myloop.h}
@@ -316,27 +354,25 @@
 }
 % End of scope in indentation
 }
-\caption{A simple data structure representing a loop}
+\caption{Example 3: A simple data structure used to represent a loop in an arbitrary tool.}
 \label{Tutorial:myloop}
 \end{figure}
 
-
 An adapter (loopAdapter.h and loopAdapter.cpp) using the proposed abstract
 handle interface is given in \textit{src/midend/abstractHandle}.
 It provides a concrete implementation for the interface for the simple loops and adds a
-node to support file nodes (Compared to the full-featured ROSE IR, this
-additional file node is additional work when using tools without internal nodes
-supporting files). 
+node to support file nodes (Compared to a full-featured IR for a compiler, the
+file node is an additional detail for tools without data structures to support files).
 The test program is given in Figure ~\ref{Tutorial:testMyLoop}.
 Again, it creates a top level file handle first. Then a loop handle
-(loop\_handle1) is
-created within the file handle using its relative numbering information. 
-loop\_handl2 is created from from its string format using file position
-information. loop\_handl3 uses its relative numbering information within
-loop\_handle1. 
+({\em loop\_handle1}) is created within the file handle using its relative numbering information. 
+The {\em loop\_handle2} is created from from its string format using file position
+information (using GNU standard file position syntax). The {\em loop\_handle3} uses its
+relative numbering information within {\em loop\_handle1}.
+
 \begin{figure}[!h]
 {\indent
-{\mySmallestFontSize
+{\mySmallFontSize
 % Do this when processing latex to generate non-html (not using latex2html)
 \begin{latexonly}
   \lstinputlisting{\TutorialExampleDirectory/../src/midend/abstractHandle/testMyLoop.cpp}
@@ -351,19 +387,23 @@
 }
 % End of scope in indentation
 }
-\caption{A test program for simple loops' abstract handles}
+\caption{Example 3: A test program for simple loops' abstract handles.}
 \label{Tutorial:testMyLoop}
 \end{figure}
 
 
-The output of the program is shown in Figure~\ref{Tutorial:testMyLoopOutput}
+The output of the program is shown in Figure~\ref{Tutorial:testMyLoopOutput}.  It
+demonstrates the generated strings to represent the abstract handles in the 
+arbitrary code operated upon by the tool.  Interoperability is achieved by 
+another tool reading in the generated string representation to generate an
+abstract handle to the same source code language construct.
 %\begin{verbatim}
 \begin{figure}[!h]
 {\indent
-{\mySmallestFontSize
+{\mySmallFontSize
 \begin{latexonly}
 \begin{lstlisting} 
-bash-3.00$ ./testMyLoop
+bash-3.00: ./testMyLoop
 Created a file handle:
 SourceFile<name,file1.c>
 Created a loop handle:
@@ -378,10 +418,22 @@
 }
 % End of scope in indentation
 }
-\caption{Output of the test program for simple loops' abstract handles}
+\caption{Example 3: Output of the test program for simple loops' abstract handles (as strings).}
 \label{Tutorial:testMyLoopOutput}
 \end{figure}
 
+\clearpage
+\section{Summary}
 
+   Abstract handles are low level mechanisms to support multiple tools
+to exchange references to source code.  Several examples are used to
+present the different features of abstract handles.  Importantly, the 
+specification of abstract handles is tool independent.  A reference
+implementation is provided and is publically available within the
+ROSE compiler framework.  We encourage debate on the pros and cons
+of this concept to support interoperability of tools which must
+pass references to source code between them.  This work is expected
+to a small piece of the infrastructure to suport autotuning research.
+
 %\end{verbatim}
 

Modified: trunk/projects/AstEquivalence/createTextFiles.C
===================================================================
--- trunk/projects/AstEquivalence/createTextFiles.C	2008-11-04 21:05:45 UTC (rev 115)
+++ trunk/projects/AstEquivalence/createTextFiles.C	2008-11-05 21:05:34 UTC (rev 116)
@@ -242,7 +242,29 @@
 //  SgNode* disFile = disassembleFile(argv[1]);
   SgProject* disFile = frontend(argc,argv);
 
+
+  VariantVector vv1(V_SgAsmPEDLL);
+  vv1.push_back(V_SgAsmPEDLL); 
+  std::vector<SgNode*> peDLL = NodeQuery::querySubTree(disFile,vv1);
+
+  std::cout << "size: " << peDLL.size();
+    std::cout << "BEGIN - PEDLL" <<std::endl;
+
+  for(int i=0; i < peDLL.size() ; i++)
   {
+    SgAddressList addrList = isSgAsmPEDLL(peDLL[i])->get_hintname_rvas();
+    for(int j = 0; i < addrList.size() ; j++ )
+    {
+    std::cout << addrList[j] << " ";
+
+    }
+      
+
+  };
+ 
+  std::cout << "END - PEDLL" <<std::endl;
+ 
+  {
 //  normalizeInstructionInSubTree(disFile);
   
   FindInstructionsVisitor vis;
@@ -250,6 +272,7 @@
   //  backend((SgProject*)disFile);
   vector<SgNode*> insnsA;
 
+  
 
   AstQueryNamespace::querySubTree(disFile, std::bind2nd( vis, &insnsA ));
 

Modified: trunk/projects/AstEquivalence/gui/compilerFlagsGui.C
===================================================================
--- trunk/projects/AstEquivalence/gui/compilerFlagsGui.C	2008-11-04 21:05:45 UTC (rev 115)
+++ trunk/projects/AstEquivalence/gui/compilerFlagsGui.C	2008-11-05 21:05:34 UTC (rev 116)
@@ -371,7 +371,7 @@
       {
         selectSeparateDatasets += " join function_statistics stat1 on stat1.function_id=function_id_A join function_statistics stat2 on stat2.function_id=function_id_B ";
 
-        selectSeparateDatasets += " where ( (stat1.num_instructions - " +boost::lexical_cast<string>(windowSize)+ ")/" +boost::lexical_cast<string>(stride)+") =( end_index_within_function_A-begin_index_within_function_A  )";
+        selectSeparateDatasets += " AND ( (stat1.num_instructions - " +boost::lexical_cast<string>(windowSize)+ ")/" +boost::lexical_cast<string>(stride)+") =( end_index_within_function_A-begin_index_within_function_A  )";
         selectSeparateDatasets += " AND   ( (stat2.num_instructions - " +boost::lexical_cast<string>(windowSize)+ ")/" +boost::lexical_cast<string>(stride)+") =( end_index_within_function_B-begin_index_within_function_B  )"  ;
 
       }
@@ -380,10 +380,10 @@
       {
        
 
-        if(wholeFunction->currentIndex() == 1) 
+//        if(wholeFunction->currentIndex() == 1) 
           selectSeparateDatasets += " AND ";
-        else
-          selectSeparateDatasets+=" where ";
+  //      else
+    //      selectSeparateDatasets+=" where ";
 
 
         
@@ -446,117 +446,118 @@
 BinaryCloneGui::run( ) 
 {
 
-    
-    //Fill in table
-    // unlink activation callback, which otherwise would trigger each
-    // time we add a row in the table.
-    QROSE::unlink(tableWidget, SIGNAL(activated(int, int, int, int)));
 
-    while(tableWidget->rowCount()) tableWidget->removeRow(0);
+  //Fill in table
+  // unlink activation callback, which otherwise would trigger each
+  // time we add a row in the table.
+  QROSE::unlink(tableWidget, SIGNAL(activated(int, int, int, int)));
 
-    //Read in all largest clones
-    readIntoVector(conA, vectorOfClonesA);
-    std::cout << "Opening database B" << std::endl;
-    readIntoVector(conB, vectorOfClonesB);
-    std::cout << "Opening database B" << std::endl;
+  while(tableWidget->rowCount()) tableWidget->removeRow(0);
 
-    //vectorOfClones.allocate(  vectorOfClonesA.size() > vectorOfClonesB.size() ? vectorOfClonesA.size()  : vectorOfClonesB.size()  );
+  //Read in all largest clones
+  readIntoVector(conA, vectorOfClonesA);
+  std::cout << "Opening database B" << std::endl;
+  readIntoVector(conB, vectorOfClonesB);
+  std::cout << "Opening database B" << std::endl;
 
+  //vectorOfClones.allocate(  vectorOfClonesA.size() > vectorOfClonesB.size() ? vectorOfClonesA.size()  : vectorOfClonesB.size()  );
 
-    std::cout << "WALLIE" << std::endl;
-    //FIXME: Some functions in B may not be in A
-    for(unsigned int i = 0 ; i < vectorOfClonesA.size() ; i++ )
+
+  std::cout << "WALLIE" << std::endl;
+  //FIXME: Some functions in B may not be in A
+  for(unsigned int i = 0 ; i < vectorOfClonesA.size() ; i++ )
+  {
+    int j=0;
+    for(j = 0 ; j != (int)vectorOfClonesB.size() ; j++ )
     {
-      int j=0;
-      for(j = 0 ; j != (int)vectorOfClonesB.size() ; j++ )
+      if( vectorOfClonesA[i].file_A == vectorOfClonesB[j].file_A && 
+          vectorOfClonesA[i].function_name_A == vectorOfClonesB[j].function_name_A &&
+          vectorOfClonesA[i].file_B == vectorOfClonesB[j].file_B && 
+          vectorOfClonesA[i].function_name_B == vectorOfClonesB[j].function_name_B 
+        )
       {
-        if( vectorOfClonesA[i].file_A == vectorOfClonesB[j].file_A && 
-            vectorOfClonesA[i].function_name_A == vectorOfClonesB[j].function_name_A &&
-            vectorOfClonesA[i].file_B == vectorOfClonesB[j].file_B && 
-            vectorOfClonesA[i].function_name_B == vectorOfClonesB[j].function_name_B 
-            )
-        {
 
-          mapAtoB[i] = j;
-          break;
-        }
+        mapAtoB[i] = j;
+        break;
       }
-      if(j == (int)vectorOfClonesB.size())
-        mapAtoB[i]=-1;
-
     }
+    if(j == (int)vectorOfClonesB.size())
+      mapAtoB[i]=-1;
 
-    //FIXME: Some functions in B may not be in A
-    for(unsigned int i = 0 ; i < vectorOfClonesB.size() ; i++ )
+  }
+
+  //FIXME: Some functions in B may not be in A
+  for(unsigned int j = 0 ; j < vectorOfClonesB.size() ; j++ )
+  {
+    int i=0;
+    for(i = 0 ; i != (int)vectorOfClonesA.size() ; i++ )
     {
-      int j=0;
-      for(j = 0 ; j != (int)vectorOfClonesA.size() ; j++ )
+      if( vectorOfClonesA[i].file_A == vectorOfClonesB[j].file_A && 
+          vectorOfClonesA[i].function_name_A == vectorOfClonesB[j].function_name_A &&
+          vectorOfClonesA[i].file_B == vectorOfClonesB[j].file_B && 
+          vectorOfClonesA[i].function_name_B == vectorOfClonesB[j].function_name_B 
+        )
       {
-        if( vectorOfClonesA[i].file_A == vectorOfClonesB[j].file_A && 
-            vectorOfClonesA[i].function_name_A == vectorOfClonesB[j].function_name_A &&
-            vectorOfClonesA[i].file_B == vectorOfClonesB[j].file_B && 
-            vectorOfClonesA[i].function_name_B == vectorOfClonesB[j].function_name_B 
-            )
-        {
 
-          mapBtoA[i] = j;
-          break;
-        }
+        mapBtoA[i] = j;
+        break;
       }
-      if(j == (int)vectorOfClonesB.size())
-        mapBtoA[i]=-1;
-
     }
+    if(i == (int)vectorOfClonesA.size())
+      mapBtoA[j]=-1;
 
-    std::cout << "WALLIE" << std::endl;
+  }
 
-    int row =0;
+  std::cout << "WALLIE" << std::endl;
 
-    if(displayResults->currentIndex() == 0)
+  int row =0;
+
+  if(displayResults->currentIndex() == 0)
+  {
+    for(int i = 0 ; i < (int) vectorOfClonesA.size() ; i++ )
     {
-      for(int i = 0 ; i < (int) vectorOfClonesA.size() ; i++ )
+      if(mapAtoB[i] != -1 )
       {
-        if(mapAtoB[i] != -1 )
-        {
         Element cur_elem  = vectorOfClonesA[i];
         insert_into_table_row(row, cur_elem);
         mapRowtoDB[row]=i;
-        }
+        row++;
       }
-    }else if( displayResults->currentIndex() == 1 )
-    {
+    }
+  }else if( displayResults->currentIndex() == 1 )
+  {
 
     int row =0;
 
     for( std::map<int,int>::iterator mapAitr = mapAtoB.begin(); mapAitr != mapAtoB.end(); ++ mapAitr )
     {
       if(mapAitr->second == -1)
-        {
-          Element cur_elem  = vectorOfClonesA[mapAitr->first];
-          insert_into_table_row(row, cur_elem);
-          mapRowtoDB[row] = mapAitr->first;
-          row++;
+      {
+        Element cur_elem  = vectorOfClonesA[mapAitr->first];
+        insert_into_table_row(row, cur_elem);
+        mapRowtoDB[row] = mapAitr->first;
+        row++;
 
-        }
+      }
     }
 
-    }else if( displayResults->currentIndex() == 2 )
-    {
+  }else if( displayResults->currentIndex() == 2 )
+  {
 
     int row =0;
 
     for( std::map<int,int>::iterator mapBitr = mapBtoA.begin(); mapBitr != mapBtoA.end(); ++ mapBitr )
     {
       if(mapBitr->second == -1)
-        {
-          Element cur_elem  = vectorOfClonesB[mapBitr->first];
-          insert_into_table_row(row, cur_elem);
-          mapRowtoDB[row] = mapBitr->first;
-          row++;
-        }
+      {
+        Element cur_elem  = vectorOfClonesB[mapBitr->first];
+        insert_into_table_row(row, cur_elem);
+        mapRowtoDB[row] = mapBitr->first;
+        row++;
+      }
     }
 
-    }
+  }
 
     QROSE::link(tableWidget, SIGNAL(activated(int, int, int, int)), 
         &tableCellActivated, this);
@@ -567,11 +568,25 @@
 BinaryCloneGui::insert_into_table_row(int row, Element& cur_elem )
 {
 
-  int rowInB = mapAtoB.find(row)->second;
+  int rowInB = -1;
+  Element cur_elemB; 
+  
+  if(displayResults->currentIndex() == 0)
+  {
 
+    rowInB = mapAtoB.find(row)->second;
   ROSE_ASSERT(rowInB >= 0);
-  Element cur_elemB  =  rowInB >= 0 ? vectorOfClonesA[row] : Element();
+  Element cur_elemB  = vectorOfClonesB[rowInB] ;
 
+  }else if( displayResults->currentIndex() == 1 )
+  {
+  }else if( displayResults->currentIndex() == 2 )
+  {
+
+  }
+
+
+
   tableWidget->addRows(1);
   int diffA =  (cur_elem.end_index_within_function_A-cur_elem.begin_index_within_function_A+1)*windowSize;
   int diffB = (cur_elem.end_index_within_function_B-cur_elem.begin_index_within_function_B+1)*windowSize;
@@ -593,7 +608,7 @@
 
   tableWidget->setHAlignment(true, false, 0); // left horizontal alignment
 
-  mapRowtoDB[row] = row;
+//  mapRowtoDB[row] = row;
 
 };
 

Modified: trunk/projects/BinQ/BinQGui.C
===================================================================
--- trunk/projects/BinQ/BinQGui.C	2008-11-04 21:05:45 UTC (rev 115)
+++ trunk/projects/BinQ/BinQGui.C	2008-11-05 21:05:34 UTC (rev 116)
@@ -212,12 +212,14 @@
       f.setBold(true);
       codeTableWidget2->setCurrentCell(row,0);
       Item* item = itemsFileB[row];
-      for (int j=1;j<maxrows;j++) {
-	codeTableWidget2->setFont(f, j, row);
-	if (item->function) 
-	  codeTableWidget2->setBgColor(QColor(120,120,120),j,row);
-	else
-	  codeTableWidget2->setBgColor(QColor(255,255,0),j,row);
+      if (item) {
+	for (int j=1;j<maxrows;j++) {
+	  codeTableWidget2->setFont(f, j, row);
+	  if (item->function) 
+	    codeTableWidget2->setBgColor(QColor(120,120,120),j,row);
+	  else
+	    codeTableWidget2->setBgColor(QColor(255,255,0),j,row);
+	}
       }
     }
   } //if(row >= 0)
@@ -237,9 +239,11 @@
       QFont f = codeTableWidget2->getFont(0, row);
       f.setBold(false);
       Item* item = itemsFileB[row];
-      for (int j=1;j<maxrows;j++) {      
-	codeTableWidget2->setFont(f, j, row);
-	codeTableWidget2->setBgColor(item->bg,j,row);
+      if (item) {
+	for (int j=1;j<maxrows;j++) {      
+	  codeTableWidget2->setFont(f, j, row);
+	  codeTableWidget2->setBgColor(item->bg,j,row);
+	}
       }
     }
   } //if (row >= 0)
@@ -254,17 +258,21 @@
   // update byteItemList
   for (unsigned int i=0;i<itemsFileA.size();++i) {
     Item* a = itemsFileA[i];
-    int pos = a->pos;
-    int length = a->length;
-    for (int k=0; k<length;++k)
-      byteItemFileA[pos+k]=a;
+    if (a) {
+      int pos = a->pos;
+      int length = a->length;
+      for (int k=0; k<length;++k)
+	byteItemFileA[pos+k]=a;
+    }
   }
   for (unsigned int i=0;i<itemsFileB.size();++i) {
     Item* b = itemsFileB[i];
-    int pos = b->pos;
-    int length = b->length;
-    for (int k=0; k<length;++k)
-      byteItemFileB[pos+k]=b;
+    if (b) {
+      int pos = b->pos;
+      int length = b->length;
+      for (int k=0; k<length;++k)
+	byteItemFileB[pos+k]=b;
+    }
   }
   slide->colorize();
   showFileA(0);
@@ -330,12 +338,16 @@
       if (entry) {
 	rose_addr_t addr = entry->get_sh_addr();
 	rose_addr_t size = entry->get_sh_size();
+	rose_addr_t offset = entry->get_sh_offset();
 	string addrS = RoseBin_support::HexToString(addr);
 	string sizeS = RoseBin_support::HexToString(size);
-	fileInfo->append( QString("%1 Addr: %2  Size: %3")
+	string offsetS = RoseBin_support::HexToString(offset);
+	fileInfo->append( QString("%1           type:     %2 Addr: %3  Size: %4   Offset: %5")
+			  .arg(QString(h->get_name()->get_string().c_str()))
 			  .arg(h->class_name().c_str())
 			  .arg(addrS.c_str())
-			  .arg(sizeS.c_str()));	 
+			  .arg(sizeS.c_str())
+			  .arg(offsetS.c_str()));	 
       }
     } else {
       fileInfo->append( QString("%1")
@@ -525,9 +537,8 @@
       item = new Item(false,isSgLocatedNode(*it),0,0,row,length,pos,
 		      isSgLocatedNode(*it)->class_name(),line);
     } else {
-      cerr << "unknown node" << endl;//*it->class_name() << endl;
-      item = new Item(false,NULL,0,0,row,0,pos,
-		      " ",0);
+      //      cerr << "unknown node " << endl;//*it->class_name() << endl;
+      //      item = new Item(false,NULL,0,0,row,0,pos, " ",0);
     }
     //example -- color pushes red
     if (isSgAsmx86Instruction(*it)) {
@@ -555,9 +566,11 @@
 
       }
     }
-    row++;
-    itemsFileB.push_back(item);
-    pos+=length;
+    if (item) {
+      row++;
+      itemsFileB.push_back(item);
+      pos+=length;
+    }
   }
 
 }
@@ -1016,7 +1029,6 @@
       addRow=true;
     } 
     else {
-      //      cerr << itemsFileB[i]->statement->class_name() << endl;
 	codeTableWidget2->addRows(1);
 	itemsFileB[i]->bg=QColor(128,128,128);
 	QColor back = itemsFileB[i]->bg;

Modified: trunk/projects/BinQ/Clone.C
===================================================================
--- trunk/projects/BinQ/Clone.C	2008-11-04 21:05:45 UTC (rev 115)
+++ trunk/projects/BinQ/Clone.C	2008-11-05 21:05:34 UTC (rev 116)
@@ -24,6 +24,11 @@
       string mne = iA->get_mnemonic();
       boost::to_lower(mne);
 
+      if( isSgAsmx86Instruction(iA) != NULL) 
+        normalizex86Mnemonic(mne);
+      else if( isSgAsmArmInstruction(iA) != NULL  )
+        normalizeArmMnemonic(mne);
+      
       value += mne;
       const SgAsmExpressionPtrList& operands = getOperands(iA);
       // Add to total for this variant
@@ -137,6 +142,65 @@
     instance->analysisResult->append(res);  
 
 
+
+
+
+    // doing the minus stuff
+    for (unsigned int k=0;k<minusInst.size();++k) {
+      std::pair<int,int> p = minusInst[k];
+      int a = p.first;
+      int b = p.second;
+      SgAsmInstruction* instA = isSgAsmInstruction(insnsA[a]);
+      SgAsmInstruction* instB = isSgAsmInstruction(insnsB[b]);
+#if 0
+      cerr << i << " Found MINUS in A  (a:" << a <<",b:"<<b<<") : " << endl << 
+	"     " << RoseBin_support::HexToString(instA->get_address()) << "  " <<
+	instA->get_mnemonic() <<endl <<
+	"     " << RoseBin_support::HexToString(instB->get_address()) << "  " <<
+	instB->get_mnemonic() <<endl;
+#endif
+
+      int myPosA=0;
+      int myPosB=0;
+      for(size_t i=0; i < instance->itemsFileA.size(); i++ )    {
+	SgAsmStatement* stmts = isSgAsmStatement(instance->itemsFileA[i]->statement);
+	//	ROSE_ASSERT(stmts);
+	SgAsmInstruction* inst = isSgAsmInstruction(stmts);
+	if (inst && inst->get_address()==instA->get_address()) {
+	  myPosA=instance->itemsFileA[i]->row;
+	  //  instance->itemsFileA[i]->plus=true;
+	  instance->itemsFileA[i]->bg=QColor(233,150,122);
+	  for (int j=1;j<instance->maxrows;j++)
+	    instance->codeTableWidget->setBgColor(instance->itemsFileA[i]->bg,j,i);
+	}
+      }
+      for(size_t i=0; i < instance->itemsFileB.size(); i++ )    {
+	SgNode* stmts = instance->itemsFileB[i]->statement;
+	SgAsmInstruction* inst = isSgAsmInstruction(stmts);
+	if (inst && inst->get_address()==instB->get_address()) {
+	  myPosB=instance->itemsFileB[i]->row;
+	  instance->itemsFileA[i]->bg=QColor(233,150,122);
+	  for (int j=1;j<instance->maxrows;j++)
+	    instance->codeTableWidget2->setBgColor(instance->itemsFileB[i]->bg,j,i);
+	}
+      }
+
+      QString res = QString("%1 Found MINUS in A  (a:%2,b:%3) (a:%4,b:%5)  %6 %7   %8 %9")
+	.arg(k)
+	.arg(a)
+	.arg(b)
+	.arg(myPosA)
+	.arg(myPosB)
+	.arg(QString(RoseBin_support::HexToString(instA->get_address()).c_str()))
+	.arg(QString(instA->get_mnemonic().c_str()))
+	.arg(QString(RoseBin_support::HexToString(instB->get_address()).c_str()))
+	.arg(QString(instB->get_mnemonic().c_str()));
+      instance->analysisResult->append(res);  
+
+    }
+
+
+    // doing the add stuff
     for (unsigned int k=0;k<addInstr.size();++k) {
       std::pair<int,int> p = addInstr[k];
       int a = p.first;

Modified: trunk/projects/BinQ/slide.C
===================================================================
--- trunk/projects/BinQ/slide.C	2008-11-04 21:05:45 UTC (rev 115)
+++ trunk/projects/BinQ/slide.C	2008-11-05 21:05:34 UTC (rev 116)
@@ -37,6 +37,7 @@
   int pos=0;
   for (;it!=gui->itemsFileA.end();++it) {
     Item* item = *it;
+    if (item) {
     int pos = item->pos;
     int length=item->length;
     int color = item->resolved;
@@ -46,6 +47,7 @@
     if (color==3)   painter.setBrush(Qt::red);
     if (color==4)   painter.setBrush(Qt::gray);
     painter.drawRect(QRect(pos, 0, length, 15));
+    }
   }
 
   ite = gui->itemsFileB;
@@ -53,6 +55,7 @@
   pos=0;
   for (;it!=gui->itemsFileB.end();++it) {
     Item* item = *it;
+    if (item) {
     int pos = item->pos;
     int length=item->length;
     int color = item->resolved;
@@ -62,6 +65,7 @@
     if (color==3)   painter.setBrush(Qt::red);
     if (color==4)   painter.setBrush(Qt::gray);
     painter.drawRect(QRect(pos, 15, length, 15));
+    }
   }
 
   painter.setPen(Qt::white);

Modified: trunk/src/ROSETTA/Grammar/Support.code
===================================================================
--- trunk/src/ROSETTA/Grammar/Support.code	2008-11-04 21:05:45 UTC (rev 115)
+++ trunk/src/ROSETTA/Grammar/Support.code	2008-11-05 21:05:34 UTC (rev 116)
@@ -3738,11 +3738,13 @@
       //! errorCode is the return value assembled from the multiple error codes associated with the 
       //! different phases of the compilation.  The fileNameIndex is the index into the list of
       //! file names input on the user's command line.  We need a way to process them individually!
-          SgFile ( int & argc, char** & argv, int & errorCode, int fileNameIndex = 0, SgProject* project = NULL );
-          SgFile(std::vector<std::string>& argv, int& errorCode, int fileNameIndex = 0, SgProject* project = NULL);
+          SgFile ( int & argc, char** & argv,  SgProject* project = NULL );
+          SgFile(std::vector<std::string>& argv,  SgProject* project = NULL);
 
        // SgFile ( int & argc, char** & argv, int & errorCode, int fileNameIndex, SgProject* project );
-          void doSetupForConstructor(const std::vector<std::string>& argv, int& errorCode, int fileNameIndex, SgProject* project);
+       //   virtual void doSetupForConstructor(const std::vector<std::string>& argv, int& errorCode, int fileNameIndex, SgProject* project);
+       //AS(10/04/08) Changed semantics of doSetupForConstructor to not call frontend
+          virtual void doSetupForConstructor(const std::vector<std::string>& argv, SgProject* project);
 
        // DQ (8/16/2008): Added this function to the SgFile IR node (defined in sageSupport.C).
           void generateBinaryExecutableFileInformation ( std::string sourceFilename, SgAsmFile* asmFile );
@@ -3800,7 +3802,7 @@
        // int callFrontEnd ( int & argc, char** & argv );
 
        // Get the commandline from where it is stored internally
-          int callFrontEnd();
+          virtual int callFrontEnd();
 
        // DQ (9/2/2008): Added to factor out detail fo building the AST in callFrontEnd().
           virtual int buildAST( std::vector<std::string> argv, std::vector<std::string> inputCommandLine );
@@ -3896,7 +3898,8 @@
 HEADER_APPLICATION_SOURCE_FILE_START
      public:
        // SgSourceFile ( int & argc, char** & argv, int & errorCode, int fileNameIndex = 0, SgProject* project = NULL );
-          SgSourceFile(std::vector<std::string>& argv, int& errorCode, int fileNameIndex = 0, SgProject* project = NULL);
+          SgSourceFile(std::vector<std::string>& argv, SgProject* project = NULL);
+          virtual int callFrontEnd();
        // SgSourceFile ( const SgSourceFile & X );
 
       //! Default constructor (not meant to be used)
@@ -3911,6 +3914,7 @@
           int build_Fortran_AST( std::vector<std::string> argv, std::vector<std::string> inputCommandLine );
           int build_C_and_Cxx_AST( std::vector<std::string> argv, std::vector<std::string> inputCommandLine );
           int build_PHP_AST();
+          virtual void doSetupForConstructor(const std::vector<std::string>& argv, SgProject* project);
 
        // DQ (9/5/2008): Support for older name of the SgGlobal in SgSourceFile
        // SgGlobal* get_root() const;
@@ -3930,18 +3934,31 @@
 HEADER_APPLICATION_BINARY_FILE_START
      public:
        // SgBinaryFile ( int & argc, char** & argv, int & errorCode, int fileNameIndex = 0, SgProject* project = NULL );
-          SgBinaryFile(std::vector<std::string>& argv, int& errorCode, int fileNameIndex = 0, SgProject* project = NULL);
+          SgBinaryFile(std::vector<std::string>& argv,  SgProject* project = NULL);
        // SgBinaryFile ( const SgBinaryFile & X );
 
+          virtual int callFrontEnd();
       //  Default constructor (not meant to be used)
       //  JJW (9/5/2008): the normal constructor has defaults for all of its arguments, so this is ambiguous
       //  SgBinaryFile() ROSE_DEPRECATED_FUNCTION;
 
+           virtual void doSetupForConstructor(const std::vector<std::string>& argv, SgProject* project);
+
           virtual int buildAST( std::vector<std::string> argv, std::vector<std::string> inputCommandLine );
 
 HEADER_APPLICATION_BINARY_FILE_END
 
+HEADER_APPLICATION_UNKNOWN_FILE_START
+     public:
+          SgUnknownFile(std::vector<std::string>& argv, SgProject* project = NULL);
 
+          virtual int callFrontEnd();
+          virtual void doSetupForConstructor(const std::vector<std::string>& argv, SgProject* project);
+
+HEADER_APPLICATION_UNKNOWN_FILE_END
+
+
+
 HEADER_APPLICATION_FILE_LIST_START
 HEADER_APPLICATION_FILE_LIST_END
 
@@ -9413,21 +9430,21 @@
 // Moved to sageSupport.C: void SgFile::setupSourceFilename ( const vector<string>& argv )
 // Moved to sageSupport.C: void SgFile::doSetupForConstructor(const vector<string>& argv, int& errorCode, int fileNameIndex, SgProject* project)
 
-SgFile::SgFile ( int & argc, char** & argv , int & errorCode, int fileNameIndex, SgProject* project )
+SgFile::SgFile ( int & argc, char** & argv , SgProject* project )
 // : p_numberOfCommandLineArguments(argc) , p_commandLineArgumentList(NULL)
    {
   // This constructor actually makes the call to EDG to build the AST (via callFrontEnd()).
      ROSE_ASSERT (argv && argc >= 0);
 
   // Note use of pointer arithmetic in the computation of "argv + argc", this is standard STL fair.
-     doSetupForConstructor(vector<string>(argv, argv + argc), errorCode, fileNameIndex, project);
+     doSetupForConstructor(vector<string>(argv, argv + argc),  project);
    }
 
-SgFile::SgFile ( vector<string> & argv , int & errorCode, int fileNameIndex, SgProject* project )
+SgFile::SgFile ( vector<string> & argv ,  SgProject* project )
 // : p_numberOfCommandLineArguments(argc) , p_commandLineArgumentList(NULL)
    {
   // This constructor actually makes the call to EDG to build the AST (via callFrontEnd()).
-     doSetupForConstructor(argv, errorCode, fileNameIndex, project);
+     doSetupForConstructor(argv,  project);
    }
 
 #if 0
@@ -10414,6 +10431,15 @@
 SOURCE_APPLICATION_BINARY_FILE_START
 SOURCE_APPLICATION_BINARY_FILE_END
 
+SOURCE_APPLICATION_UNKNOWN_FILE_START
+SgUnknownFile::SgUnknownFile ( vector<string> & argv ,  SgProject* project )
+   {
+     SgFile(argv, project);
+   }
+
+SOURCE_APPLICATION_UNKNOWN_FILE_END
+
+
 SOURCE_APPLICATION_FILE_LIST_START
 SOURCE_APPLICATION_FILE_LIST_END
 

Modified: trunk/src/ROSETTA/astNodeList
===================================================================
--- trunk/src/ROSETTA/astNodeList	2008-11-04 21:05:45 UTC (rev 115)
+++ trunk/src/ROSETTA/astNodeList	2008-11-05 21:05:34 UTC (rev 116)
@@ -161,6 +161,7 @@
 SgFile
 SgSourceFile
 SgBinaryFile
+SgUnknownFile
 Sg_File_Info
 SgFileList
 SgFloatVal

Modified: trunk/src/ROSETTA/src/grammar.C
===================================================================
--- trunk/src/ROSETTA/src/grammar.C	2008-11-04 21:05:45 UTC (rev 115)
+++ trunk/src/ROSETTA/src/grammar.C	2008-11-05 21:05:34 UTC (rev 116)
@@ -2450,6 +2450,10 @@
 
 #endif
 
+
+
+
+
 #if 1
    //-----------------------------------------------
    // generate code for the new and delete operators

Modified: trunk/src/ROSETTA/src/support.C
===================================================================
--- trunk/src/ROSETTA/src/support.C	2008-11-04 21:05:45 UTC (rev 115)
+++ trunk/src/ROSETTA/src/support.C	2008-11-05 21:05:34 UTC (rev 116)
@@ -92,9 +92,10 @@
   // to an analysis phase to define and not defined in the structure of the AST.
      NEW_TERMINAL_MACRO (SourceFile, "SourceFile", "SourceFileTag" );
      NEW_TERMINAL_MACRO (BinaryFile, "BinaryFile", "BinaryFileTag" );
+     NEW_TERMINAL_MACRO (UnknownFile, "UnknownFile", "UnknownFileTag" );
 
   // Mark this as being able to be an IR node for now and later make it false.
-     NEW_NONTERMINAL_MACRO (File, SourceFile | BinaryFile, "File", "FileTag", false);
+     NEW_NONTERMINAL_MACRO (File, SourceFile | BinaryFile | UnknownFile , "File", "FileTag", false);
 #endif
      NEW_TERMINAL_MACRO (FileList, "FileList", "FileListTag" );
      NEW_TERMINAL_MACRO (Directory, "Directory", "DirectoryTag" );
@@ -484,6 +485,10 @@
 
      BinaryFile.setFunctionPrototype          ( "HEADER_APPLICATION_BINARY_FILE", "../Grammar/Support.code");
 
+     UnknownFile.setFunctionPrototype          ( "HEADER_APPLICATION_UNKNOWN_FILE", "../Grammar/Support.code");
+
+     
+
      File.setFunctionPrototype                ( "HEADER_APPLICATION_FILE", "../Grammar/Support.code");
   // File.setAutomaticGenerationOfConstructor(false);
   // Later we can have this be autogenerated (let's see what we need first)
@@ -713,6 +718,10 @@
   // the *.mod files to be put.  This is the data member for the list.
      SourceFile.setDataPrototype   ( "SgModuleStatementPtrList", "module_list", "",
                                      NO_CONSTRUCTOR_PARAMETER, BUILD_LIST_ACCESS_FUNCTIONS, NO_TRAVERSAL, NO_DELETE);
+
+     UnknownFile.setDataPrototype   ( "SgGlobal*", "globalScope", "= NULL",
+                                     NO_CONSTRUCTOR_PARAMETER, BUILD_ACCESS_FUNCTIONS, DEF_TRAVERSAL, NO_DELETE);
+
 #endif
 
   // DQ (10/16/2005): Added to support C++ style argument handling in SgFile
@@ -997,7 +1006,9 @@
                  NO_CONSTRUCTOR_PARAMETER, BUILD_ACCESS_FUNCTIONS, NO_TRAVERSAL, NO_DELETE);
      File.setDataPrototype         ( "bool", "sourceFileUsesBinaryFileExtension", "= false",
                  NO_CONSTRUCTOR_PARAMETER, BUILD_ACCESS_FUNCTIONS, NO_TRAVERSAL, NO_DELETE);
-
+     File.setDataPrototype         ( "bool", "sourceFileTypeIsUnknown", "= false",
+                 NO_CONSTRUCTOR_PARAMETER, BUILD_ACCESS_FUNCTIONS, NO_TRAVERSAL, NO_DELETE);
+     
   // DQ (10/13/2007): Add the binary file to the SgFile IR node so that we can hold both the source
   // code AST and the binary AST together.  This also permits the binary AST to be handled similarly
   // the the source code AST (for traversals, file I/O, etc.).
@@ -1745,6 +1756,7 @@
      SourceFile.setFunctionSource      ( "SOURCE_APPLICATION_SOURCE_FILE", "../Grammar/Support.code");
      BinaryFile.setFunctionSource      ( "SOURCE_APPLICATION_BINARY_FILE", "../Grammar/Support.code");
      FileList.setFunctionSource        ( "SOURCE_APPLICATION_FILE_LIST", "../Grammar/Support.code");
+     UnknownFile.setFunctionSource     ( "SOURCE_APPLICATION_UNKNOWN_FILE", "../Grammar/Support.code");
 
      Project.setFunctionSource         ( "SOURCE_APPLICATION_PROJECT", "../Grammar/Support.code");
      Options.setFunctionSource         ( "SOURCE_OPTIONS", "../Grammar/Support.code");

Modified: trunk/src/frontend/BinaryDisassembly/RoseBin_support.h
===================================================================
--- trunk/src/frontend/BinaryDisassembly/RoseBin_support.h	2008-11-04 21:05:45 UTC (rev 115)
+++ trunk/src/frontend/BinaryDisassembly/RoseBin_support.h	2008-11-05 21:05:34 UTC (rev 116)
@@ -323,6 +323,9 @@
 SgAsmx86Instruction* createx86Instruction(uint64_t address,
                                           const std::string& mnemonic);
 
+void normalizex86Mnemonic(std::string& mnemonic);
+void normalizeArmMnemonic(std::string& mnemonic);
+
 // From RoseBin_support.cpp:
 bool isAsmUnconditionalBranch(SgAsmInstruction*);
 bool isAsmBranch(SgAsmInstruction*);

Modified: trunk/src/frontend/BinaryDisassembly/instructionDispatch.cpp
===================================================================
--- trunk/src/frontend/BinaryDisassembly/instructionDispatch.cpp	2008-11-04 21:05:45 UTC (rev 115)
+++ trunk/src/frontend/BinaryDisassembly/instructionDispatch.cpp	2008-11-05 21:05:34 UTC (rev 116)
@@ -2581,6 +2581,2582 @@
   }
   return insn;
 }
+void normalizex86Mnemonic(std::string& mnemonic) {
+  switch (mnemonic.size()) {
+    case 2:
+      switch (mnemonic[0]) {
+        case 'b': { // 'b'
+          if (mnemonic[1] == 't') { // 'bt'
+            mnemonic = "Bt";
+          }
+        break;}
+        case 'i': { // 'i'
+          if (mnemonic[1] == 'n') { // 'in'
+            mnemonic = "In";
+          }
+        break;}
+        case 'j': { // 'j'
+          switch (mnemonic[1]) {
+            case 'a': { // 'ja'
+              mnemonic = "Ja";
+            break;}
+            case 'b': { // 'jb'
+              mnemonic = "Jb";
+            break;}
+            case 'c': { // 'jc'
+              mnemonic = "Jb";
+            break;}
+            case 'e': { // 'je'
+              mnemonic = "Je";
+            break;}
+            case 'g': { // 'jg'
+              mnemonic = "Jg";
+            break;}
+            case 'l': { // 'jl'
+              mnemonic = "Jl";
+            break;}
+            case 'o': { // 'jo'
+              mnemonic = "Jo";
+            break;}
+            case 'p': { // 'jp'
+              mnemonic = "Jpe";
+            break;}
+            case 's': { // 'js'
+              mnemonic = "Js";
+            break;}
+            case 'z': { // 'jz'
+              mnemonic = "Je";
+            break;}
+            default: break;
+          }
+        break;}
+        case 'o': { // 'o'
+          if (mnemonic[1] == 'r') { // 'or'
+            mnemonic = "Or";
+          }
+        break;}
+        default: break;
+      }
+    break;
+    case 3:
+      switch (mnemonic[0]) {
+        case 'a': { // 'a'
+          switch (mnemonic[1]) {
+            case 'a': { // 'aa'
+              switch (mnemonic[2]) {
+                case 'a': { // 'aaa'
+                  mnemonic = "Aaa";
+                break;}
+                case 'd': { // 'aad'
+                  mnemonic = "Aad";
+                break;}
+                case 'm': { // 'aam'
+                  mnemonic = "Aam";
+                break;}
+                case 's': { // 'aas'
+                  mnemonic = "Aas";
+                break;}
+                default: break;
+              }
+            break;}
+            case 'd': { // 'ad'
+              switch (mnemonic[2]) {
+                case 'c': { // 'adc'
+                  mnemonic = "Adc";
+                break;}
+                case 'd': { // 'add'
+                  mnemonic = "Add";
+                break;}
+                default: break;
+              }
+            break;}
+            case 'n': { // 'an'
+              if (mnemonic[2] == 'd') { // 'and'
+                mnemonic = "And";
+              }
+            break;}
+            default: break;
+          }
+        break;}
+        case 'b': { // 'b'
+          switch (mnemonic[1]) {
+            case 's': { // 'bs'
+              switch (mnemonic[2]) {
+                case 'f': { // 'bsf'
+                  mnemonic = "Bsf";
+                break;}
+                case 'r': { // 'bsr'
+                  mnemonic = "Bsr";
+                break;}
+                default: break;
+              }
+            break;}
+            case 't': { // 'bt'
+              switch (mnemonic[2]) {
+                case 'c': { // 'btc'
+                  mnemonic = "Btc";
+                break;}
+                case 'l': { // 'btl'
+                  mnemonic = "Bt";
+                break;}
+                case 'r': { // 'btr'
+                  mnemonic = "Btr";
+                break;}
+                case 's': { // 'bts'
+                  mnemonic = "Bts";
+                break;}
+                default: break;
+              }
+            break;}
+            default: break;
+          }
+        break;}
+        case 'c': { // 'c'
+          switch (mnemonic[1]) {
+            case 'b': { // 'cb'
+              if (mnemonic[2] == 'w') { // 'cbw'
+                mnemonic = "Cbw";
+              }
+            break;}
+            case 'd': { // 'cd'
+              if (mnemonic[2] == 'q') { // 'cdq'
+                mnemonic = "Cdq";
+              }
+            break;}
+            case 'l': { // 'cl'
+              switch (mnemonic[2]) {
+                case 'c': { // 'clc'
+                  mnemonic = "Clc";
+                break;}
+                case 'd': { // 'cld'
+                  mnemonic = "Cld";
+                break;}
+                case 'i': { // 'cli'
+                  mnemonic = "Cli";
+                break;}
+                default: break;
+              }
+            break;}
+            case 'm': { // 'cm'
+              switch (mnemonic[2]) {
+                case 'c': { // 'cmc'
+                  mnemonic = "Cmc";
+                break;}
+                case 'p': { // 'cmp'
+                  mnemonic = "Cmp";
+                break;}
+                default: break;
+              }
+            break;}
+            case 'q': { // 'cq'
+              if (mnemonic[2] == 'o') { // 'cqo'
+                mnemonic = "Cqo";
+              }
+            break;}
+            case 'w': { // 'cw'
+              if (mnemonic[2] == 'd') { // 'cwd'
+                mnemonic = "Cwd";
+              }
+            break;}
+            default: break;
+          }
+        break;}
+        case 'd': { // 'd'
+          switch (mnemonic[1]) {
+            case 'a': { // 'da'
+              switch (mnemonic[2]) {
+                case 'a': { // 'daa'
+                  mnemonic = "Daa";
+                break;}
+                case 's': { // 'das'
+                  mnemonic = "Das";
+                break;}
+                default: break;
+              }
+            break;}
+            case 'e': { // 'de'
+              if (mnemonic[2] == 'c') { // 'dec'
+                mnemonic = "Dec";
+              }
+            break;}
+            case 'i': { // 'di'
+              if (mnemonic[2] == 'v') { // 'div'
+                mnemonic = "Div";
+              }
+            break;}
+            default: break;
+          }
+        break;}
+        case 'e': { // 'e'
+          if (mnemonic[1] == 's') { // 'es'
+            if (mnemonic[2] == 'c') { // 'esc'
+              mnemonic = "Esc";
+            }
+          }
+        break;}
+        case 'f': { // 'f'
+          switch (mnemonic[1]) {
+            case 'l': { // 'fl'
+              if (mnemonic[2] == 'd') { // 'fld'
+                mnemonic = "Fld";
+              }
+            break;}
+            case 's': { // 'fs'
+              if (mnemonic[2] == 't') { // 'fst'
+                mnemonic = "Fst";
+              }
+            break;}
+            default: break;
+          }
+        break;}
+        case 'h': { // 'h'
+          if (mnemonic[1] == 'l') { // 'hl'
+            if (mnemonic[2] == 't') { // 'hlt'
+              mnemonic = "Hlt";
+            }
+          }
+        break;}
+        case 'i': { // 'i'
+          if (mnemonic[1] == 'n') { // 'in'
+            switch (mnemonic[2]) {
+              case 'b': { // 'inb'
+                mnemonic = "In";
+              break;}
+              case 'c': { // 'inc'
+                mnemonic = "Inc";
+              break;}
+              case 'd': { // 'ind'
+                mnemonic = "In";
+              break;}
+              case 'l': { // 'inl'
+                mnemonic = "In";
+              break;}
+              case 't': { // 'int'
+                mnemonic = "Int";
+              break;}
+              case 'w': { // 'inw'
+                mnemonic = "In";
+              break;}
+              default: break;
+            }
+          }
+        break;}
+        case 'j': { // 'j'
+          switch (mnemonic[1]) {
+            case 'a': { // 'ja'
+              if (mnemonic[2] == 'e') { // 'jae'
+                mnemonic = "Jae";
+              }
+            break;}
+            case 'b': { // 'jb'
+              if (mnemonic[2] == 'e') { // 'jbe'
+                mnemonic = "Jbe";
+              }
+            break;}
+            case 'g': { // 'jg'
+              if (mnemonic[2] == 'e') { // 'jge'
+                mnemonic = "Jge";
+              }
+            break;}
+            case 'l': { // 'jl'
+              if (mnemonic[2] == 'e') { // 'jle'
+                mnemonic = "Jle";
+              }
+            break;}
+            case 'm': { // 'jm'
+              if (mnemonic[2] == 'p') { // 'jmp'
+                mnemonic = "Jmp";
+              }
+            break;}
+            case 'n': { // 'jn'
+              switch (mnemonic[2]) {
+                case 'a': { // 'jna'
+                  mnemonic = "Jbe";
+                break;}
+                case 'b': { // 'jnb'
+                  mnemonic = "Jae";
+                break;}
+                case 'c': { // 'jnc'
+                  mnemonic = "Jae";
+                break;}
+                case 'e': { // 'jne'
+                  mnemonic = "Jne";
+                break;}
+                case 'g': { // 'jng'
+                  mnemonic = "Jle";
+                break;}
+                case 'l': { // 'jnl'
+                  mnemonic = "Jge";
+                break;}
+                case 'o': { // 'jno'
+                  mnemonic = "Jno";
+                break;}
+                case 'p': { // 'jnp'
+                  mnemonic = "Jpo";
+                break;}
+                case 's': { // 'jns'
+                  mnemonic = "Jns";
+                break;}
+                case 'z': { // 'jnz'
+                  mnemonic = "Jne";
+                break;}
+                default: break;
+              }
+            break;}
+            case 'p': { // 'jp'
+              switch (mnemonic[2]) {
+                case 'e': { // 'jpe'
+                  mnemonic = "Jpe";
+                break;}
+                case 'o': { // 'jpo'
+                  mnemonic = "Jpo";
+                break;}
+                default: break;
+              }
+            break;}
+            default: break;
+          }
+        break;}
+        case 'l': { // 'l'
+          switch (mnemonic[1]) {
+            case 'd': { // 'ld'
+              if (mnemonic[2] == 's') { // 'lds'
+                mnemonic = "Lds";
+              }
+            break;}
+            case 'e': { // 'le'
+              switch (mnemonic[2]) {
+                case 'a': { // 'lea'
+                  mnemonic = "Lea";
+                break;}
+                case 's': { // 'les'
+                  mnemonic = "Les";
+                break;}
+                default: break;
+              }
+            break;}
+            case 'f': { // 'lf'
+              if (mnemonic[2] == 's') { // 'lfs'
+                mnemonic = "Lfs";
+              }
+            break;}
+            case 'g': { // 'lg'
+              if (mnemonic[2] == 's') { // 'lgs'
+                mnemonic = "Lgs";
+              }
+            break;}
+            case 's': { // 'ls'
+              if (mnemonic[2] == 's') { // 'lss'
+                mnemonic = "Lss";
+              }
+            break;}
+            default: break;
+          }
+        break;}
+        case 'm': { // 'm'
+          switch (mnemonic[1]) {
+            case 'o': { // 'mo'
+              if (mnemonic[2] == 'v') { // 'mov'
+                mnemonic = "Mov";
+              }
+            break;}
+            case 'u': { // 'mu'
+              if (mnemonic[2] == 'l') { // 'mul'
+                mnemonic = "Mul";
+              }
+            break;}
+            default: break;
+          }
+        break;}
+        case 'n': { // 'n'
+          switch (mnemonic[1]) {
+            case 'e': { // 'ne'
+              if (mnemonic[2] == 'g') { // 'neg'
+                mnemonic = "Neg";
+              }
+            break;}
+            case 'o': { // 'no'
+              switch (mnemonic[2]) {
+                case 'p': { // 'nop'
+                  mnemonic = "Nop";
+                break;}
+                case 't': { // 'not'
+                  mnemonic = "Not";
+                break;}
+                default: break;
+              }
+            break;}
+            default: break;
+          }
+        break;}
+        case 'o': { // 'o'
+          if (mnemonic[1] == 'u') { // 'ou'
+            if (mnemonic[2] == 't') { // 'out'
+              mnemonic = "Out";
+            }
+          }
+        break;}
+        case 'p': { // 'p'
+          if (mnemonic[1] == 'o') { // 'po'
+            if (mnemonic[2] == 'p') { // 'pop'
+              mnemonic = "Pop";
+            }
+          }
+        break;}
+        case 'r': { // 'r'
+          switch (mnemonic[1]) {
+            case 'c': { // 'rc'
+              switch (mnemonic[2]) {
+                case 'l': { // 'rcl'
+                  mnemonic = "Rcl";
+                break;}
+                case 'r': { // 'rcr'
+                  mnemonic = "Rcr";
+                break;}
+                default: break;
+              }
+            break;}
+            case 'e': { // 're'
+              if (mnemonic[2] == 't') { // 'ret'
+                mnemonic = "Ret";
+              }
+            break;}
+            case 'o': { // 'ro'
+              switch (mnemonic[2]) {
+                case 'l': { // 'rol'
+                  mnemonic = "Rol";
+                break;}
+                case 'r': { // 'ror'
+                  mnemonic = "Ror";
+                break;}
+                default: break;
+              }
+            break;}
+            default: break;
+          }
+        break;}
+        case 's': { // 's'
+          switch (mnemonic[1]) {
+            case 'a': { // 'sa'
+              switch (mnemonic[2]) {
+                case 'l': { // 'sal'
+                  mnemonic = "Shl";
+                break;}
+                case 'r': { // 'sar'
+                  mnemonic = "Sar";
+                break;}
+                default: break;
+              }
+            break;}
+            case 'b': { // 'sb'
+              if (mnemonic[2] == 'b') { // 'sbb'
+                mnemonic = "Sbb";
+              }
+            break;}
+            case 'h': { // 'sh'
+              switch (mnemonic[2]) {
+                case 'l': { // 'shl'
+                  mnemonic = "Shl";
+                break;}
+                case 'r': { // 'shr'
+                  mnemonic = "Shr";
+                break;}
+                default: break;
+              }
+            break;}
+            case 't': { // 'st'
+              switch (mnemonic[2]) {
+                case 'c': { // 'stc'
+                  mnemonic = "Stc";
+                break;}
+                case 'd': { // 'std'
+                  mnemonic = "Std";
+                break;}
+                case 'i': { // 'sti'
+                  mnemonic = "Sti";
+                break;}
+                default: break;
+              }
+            break;}
+            case 'u': { // 'su'
+              if (mnemonic[2] == 'b') { // 'sub'
+                mnemonic = "Sub";
+              }
+            break;}
+            default: break;
+          }
+        break;}
+        case 'u': { // 'u'
+          if (mnemonic[1] == 'd') { // 'ud'
+            if (mnemonic[2] == '2') { // 'ud2'
+              mnemonic = "Ud2";
+            }
+          }
+        break;}
+        case 'x': { // 'x'
+          if (mnemonic[1] == 'o') { // 'xo'
+            if (mnemonic[2] == 'r') { // 'xor'
+              mnemonic = "Xor";
+            }
+          }
+        break;}
+        default: break;
+      }
+    break;
+    case 4:
+      switch (mnemonic[0]) {
+        case 'a': { // 'a'
+          if (mnemonic[1] == 'r') { // 'ar'
+            if (mnemonic[2] == 'p') { // 'arp'
+              if (mnemonic[3] == 'l') { // 'arpl'
+                mnemonic = "Arpl";
+              }
+            }
+          }
+        break;}
+        case 'b': { // 'b'
+          if (mnemonic[1] == 't') { // 'bt'
+            switch (mnemonic[2]) {
+              case 'c': { // 'btc'
+                if (mnemonic[3] == 'l') { // 'btcl'
+                  mnemonic = "Btc";
+                }
+              break;}
+              case 'r': { // 'btr'
+                if (mnemonic[3] == 'l') { // 'btrl'
+                  mnemonic = "Btr";
+                }
+              break;}
+              case 's': { // 'bts'
+                if (mnemonic[3] == 'l') { // 'btsl'
+                  mnemonic = "Bts";
+                }
+              break;}
+              default: break;
+            }
+          }
+        break;}
+        case 'c': { // 'c'
+          switch (mnemonic[1]) {
+            case 'a': { // 'ca'
+              if (mnemonic[2] == 'l') { // 'cal'
+                if (mnemonic[3] == 'l') { // 'call'
+                  mnemonic = "Call";
+                }
+              }
+            break;}
+            case 'd': { // 'cd'
+              if (mnemonic[2] == 'q') { // 'cdq'
+                if (mnemonic[3] == 'e') { // 'cdqe'
+                  mnemonic = "Cdqe";
+                }
+              }
+            break;}
+            case 'w': { // 'cw'
+              if (mnemonic[2] == 'd') { // 'cwd'
+                if (mnemonic[3] == 'e') { // 'cwde'
+                  mnemonic = "Cwde";
+                }
+              }
+            break;}
+            default: break;
+          }
+        break;}
+        case 'e': { // 'e'
+          if (mnemonic[1] == 'm') { // 'em'
+            if (mnemonic[2] == 'm') { // 'emm'
+              if (mnemonic[3] == 's') { // 'emms'
+                mnemonic = "Emms";
+              }
+            }
+          }
+        break;}
+        case 'f': { // 'f'
+          switch (mnemonic[1]) {
+            case 'a': { // 'fa'
+              switch (mnemonic[2]) {
+                case 'b': { // 'fab'
+                  if (mnemonic[3] == 's') { // 'fabs'
+                    mnemonic = "Fabs";
+                  }
+                break;}
+                case 'd': { // 'fad'
+                  if (mnemonic[3] == 'd') { // 'fadd'
+                    mnemonic = "Fadd";
+                  }
+                break;}
+                default: break;
+              }
+            break;}
+            case 'c': { // 'fc'
+              switch (mnemonic[2]) {
+                case 'h': { // 'fch'
+                  if (mnemonic[3] == 's') { // 'fchs'
+                    mnemonic = "Fchs";
+                  }
+                break;}
+                case 'o': { // 'fco'
+                  switch (mnemonic[3]) {
+                    case 'm': { // 'fcom'
+                      mnemonic = "Fcom";
+                    break;}
+                    case 's': { // 'fcos'
+                      mnemonic = "Fcos";
+                    break;}
+                    default: break;
+                  }
+                break;}
+                default: break;
+              }
+            break;}
+            case 'd': { // 'fd'
+              if (mnemonic[2] == 'i') { // 'fdi'
+                if (mnemonic[3] == 'v') { // 'fdiv'
+                  mnemonic = "Fdiv";
+                }
+              }
+            break;}
+            case 'i': { // 'fi'
+              switch (mnemonic[2]) {
+                case 'l': { // 'fil'
+                  if (mnemonic[3] == 'd') { // 'fild'
+                    mnemonic = "Fild";
+                  }
+                break;}
+                case 's': { // 'fis'
+                  if (mnemonic[3] == 't') { // 'fist'
+                    mnemonic = "Fist";
+                  }
+                break;}
+                default: break;
+              }
+            break;}
+            case 'l': { // 'fl'
+              if (mnemonic[2] == 'd') { // 'fld'
+                switch (mnemonic[3]) {
+                  case '1': { // 'fld1'
+                    mnemonic = "Fld1";
+                  break;}
+                  case 'l': { // 'fldl'
+                    mnemonic = "Fld";
+                  break;}
+                  case 's': { // 'flds'
+                    mnemonic = "Fld";
+                  break;}
+                  case 't': { // 'fldt'
+                    mnemonic = "Fld";
+                  break;}
+                  case 'z': { // 'fldz'
+                    mnemonic = "Fldz";
+                  break;}
+                  default: break;
+                }
+              }
+            break;}
+            case 'm': { // 'fm'
+              if (mnemonic[2] == 'u') { // 'fmu'
+                if (mnemonic[3] == 'l') { // 'fmul'
+                  mnemonic = "Fmul";
+                }
+              }
+            break;}
+            case 'n': { // 'fn'
+              if (mnemonic[2] == 'o') { // 'fno'
+                if (mnemonic[3] == 'p') { // 'fnop'
+                  mnemonic = "Fnop";
+                }
+              }
+            break;}
+            case 's': { // 'fs'
+              switch (mnemonic[2]) {
+                case 'i': { // 'fsi'
+                  if (mnemonic[3] == 'n') { // 'fsin'
+                    mnemonic = "Fsin";
+                  }
+                break;}
+                case 't': { // 'fst'
+                  switch (mnemonic[3]) {
+                    case 'l': { // 'fstl'
+                      mnemonic = "Fst";
+                    break;}
+                    case 'p': { // 'fstp'
+                      mnemonic = "Fstp";
+                    break;}
+                    case 's': { // 'fsts'
+                      mnemonic = "Fst";
+                    break;}
+                    default: break;
+                  }
+                break;}
+                case 'u': { // 'fsu'
+                  if (mnemonic[3] == 'b') { // 'fsub'
+                    mnemonic = "Fsub";
+                  }
+                break;}
+                default: break;
+              }
+            break;}
+            case 't': { // 'ft'
+              if (mnemonic[2] == 's') { // 'fts'
+                if (mnemonic[3] == 't') { // 'ftst'
+                  mnemonic = "Ftst";
+                }
+              }
+            break;}
+            case 'x': { // 'fx'
+              if (mnemonic[2] == 'c') { // 'fxc'
+                if (mnemonic[3] == 'h') { // 'fxch'
+                  mnemonic = "Fxch";
+                }
+              }
+            break;}
+            default: break;
+          }
+        break;}
+        case 'i': { // 'i'
+          switch (mnemonic[1]) {
+            case 'd': { // 'id'
+              if (mnemonic[2] == 'i') { // 'idi'
+                if (mnemonic[3] == 'v') { // 'idiv'
+                  mnemonic = "IDiv";
+                }
+              }
+            break;}
+            case 'm': { // 'im'
+              if (mnemonic[2] == 'u') { // 'imu'
+                if (mnemonic[3] == 'l') { // 'imul'
+                  mnemonic = "IMul";
+                }
+              }
+            break;}
+            case 'n': { // 'in'
+              switch (mnemonic[2]) {
+                case 's': { // 'ins'
+                  switch (mnemonic[3]) {
+                    case 'b': { // 'insb'
+                      mnemonic = "Insb";
+                    break;}
+                    case 'd': { // 'insd'
+                      mnemonic = "Insd";
+                    break;}
+                    case 'w': { // 'insw'
+                      mnemonic = "Insw";
+                    break;}
+                    default: break;
+                  }
+                break;}
+                case 't': { // 'int'
+                  if (mnemonic[3] == 'o') { // 'into'
+                    mnemonic = "Into";
+                  }
+                break;}
+                default: break;
+              }
+            break;}
+            case 'r': { // 'ir'
+              if (mnemonic[2] == 'e') { // 'ire'
+                if (mnemonic[3] == 't') { // 'iret'
+                  mnemonic = "IRet";
+                }
+              }
+            break;}
+            default: break;
+          }
+        break;}
+        case 'j': { // 'j'
+          switch (mnemonic[1]) {
+            case 'c': { // 'jc'
+              if (mnemonic[2] == 'x') { // 'jcx'
+                if (mnemonic[3] == 'z') { // 'jcxz'
+                  mnemonic = "Jcxz";
+                }
+              }
+            break;}
+            case 'n': { // 'jn'
+              switch (mnemonic[2]) {
+                case 'a': { // 'jna'
+                  if (mnemonic[3] == 'e') { // 'jnae'
+                    mnemonic = "Jb";
+                  }
+                break;}
+                case 'b': { // 'jnb'
+                  if (mnemonic[3] == 'e') { // 'jnbe'
+                    mnemonic = "Ja";
+                  }
+                break;}
+                case 'g': { // 'jng'
+                  if (mnemonic[3] == 'e') { // 'jnge'
+                    mnemonic = "Jl";
+                  }
+                break;}
+                case 'l': { // 'jnl'
+                  if (mnemonic[3] == 'e') { // 'jnle'
+                    mnemonic = "Jg";
+                  }
+                break;}
+                default: break;
+              }
+            break;}
+            default: break;
+          }
+        break;}
+        case 'l': { // 'l'
+          switch (mnemonic[1]) {
+            case 'a': { // 'la'
+              if (mnemonic[2] == 'h') { // 'lah'
+                if (mnemonic[3] == 'f') { // 'lahf'
+                  mnemonic = "Lahf";
+                }
+              }
+            break;}
+            case 'o': { // 'lo'
+              switch (mnemonic[2]) {
+                case 'c': { // 'loc'
+                  if (mnemonic[3] == 'k') { // 'lock'
+                    mnemonic = "Lock";
+                  }
+                break;}
+                case 'o': { // 'loo'
+                  if (mnemonic[3] == 'p') { // 'loop'
+                    mnemonic = "Loop";
+                  }
+                break;}
+                default: break;
+              }
+            break;}
+            default: break;
+          }
+        break;}
+        case 'p': { // 'p'
+          switch (mnemonic[1]) {
+            case 'a': { // 'pa'
+              if (mnemonic[2] == 'n') { // 'pan'
+                if (mnemonic[3] == 'd') { // 'pand'
+                  mnemonic = "Pand";
+                }
+              }
+            break;}
+            case 'o': { // 'po'
+              if (mnemonic[2] == 'p') { // 'pop'
+                switch (mnemonic[3]) {
+                  case 'a': { // 'popa'
+                    mnemonic = "Popa";
+                  break;}
+                  case 'f': { // 'popf'
+                    mnemonic = "Popf";
+                  break;}
+                  default: break;
+                }
+              }
+            break;}
+            case 'u': { // 'pu'
+              if (mnemonic[2] == 's') { // 'pus'
+                if (mnemonic[3] == 'h') { // 'push'
+                  mnemonic = "Push";
+                }
+              }
+            break;}
+            case 'x': { // 'px'
+              if (mnemonic[2] == 'o') { // 'pxo'
+                if (mnemonic[3] == 'r') { // 'pxor'
+                  mnemonic = "Pxor";
+                }
+              }
+            break;}
+            default: break;
+          }
+        break;}
+        case 's': { // 's'
+          switch (mnemonic[1]) {
+            case 'a': { // 'sa'
+              if (mnemonic[2] == 'h') { // 'sah'
+                if (mnemonic[3] == 'f') { // 'sahf'
+                  mnemonic = "Sahf";
+                }
+              }
+            break;}
+            case 'e': { // 'se'
+              if (mnemonic[2] == 't') { // 'set'
+                switch (mnemonic[3]) {
+                  case 'a': { // 'seta'
+                    mnemonic = "Seta";
+                  break;}
+                  case 'b': { // 'setb'
+                    mnemonic = "Setb";
+                  break;}
+                  case 'c': { // 'setc'
+                    mnemonic = "Setb";
+                  break;}
+                  case 'e': { // 'sete'
+                    mnemonic = "Sete";
+                  break;}
+                  case 'g': { // 'setg'
+                    mnemonic = "Setg";
+                  break;}
+                  case 'l': { // 'setl'
+                    mnemonic = "Setl";
+                  break;}
+                  case 'o': { // 'seto'
+                    mnemonic = "Seto";
+                  break;}
+                  case 'p': { // 'setp'
+                    mnemonic = "Setpe";
+                  break;}
+                  case 's': { // 'sets'
+                    mnemonic = "Sets";
+                  break;}
+                  case 'z': { // 'setz'
+                    mnemonic = "Sete";
+                  break;}
+                  default: break;
+                }
+              }
+            break;}
+            case 'h': { // 'sh'
+              switch (mnemonic[2]) {
+                case 'l': { // 'shl'
+                  if (mnemonic[3] == 'd') { // 'shld'
+                    mnemonic = "Shld";
+                  }
+                break;}
+                case 'r': { // 'shr'
+                  if (mnemonic[3] == 'd') { // 'shrd'
+                    mnemonic = "Shrd";
+                  }
+                break;}
+                default: break;
+              }
+            break;}
+            case 'l': { // 'sl'
+              if (mnemonic[2] == 'd') { // 'sld'
+                if (mnemonic[3] == 't') { // 'sldt'
+                  mnemonic = "Sldt";
+                }
+              }
+            break;}
+            default: break;
+          }
+        break;}
+        case 't': { // 't'
+          if (mnemonic[1] == 'e') { // 'te'
+            if (mnemonic[2] == 's') { // 'tes'
+              if (mnemonic[3] == 't') { // 'test'
+                mnemonic = "Test";
+              }
+            }
+          }
+        break;}
+        case 'v': { // 'v'
+          if (mnemonic[1] == 'e') { // 've'
+            if (mnemonic[2] == 'r') { // 'ver'
+              switch (mnemonic[3]) {
+                case 'r': { // 'verr'
+                  mnemonic = "Verr";
+                break;}
+                case 'w': { // 'verw'
+                  mnemonic = "Verw";
+                break;}
+                default: break;
+              }
+            }
+          }
+        break;}
+        case 'w': { // 'w'
+          if (mnemonic[1] == 'a') { // 'wa'
+            if (mnemonic[2] == 'i') { // 'wai'
+              if (mnemonic[3] == 't') { // 'wait'
+                mnemonic = "Wait";
+              }
+            }
+          }
+        break;}
+        case 'x': { // 'x'
+          switch (mnemonic[1]) {
+            case 'a': { // 'xa'
+              if (mnemonic[2] == 'd') { // 'xad'
+                if (mnemonic[3] == 'd') { // 'xadd'
+                  mnemonic = "Xadd";
+                }
+              }
+            break;}
+            case 'c': { // 'xc'
+              if (mnemonic[2] == 'h') { // 'xch'
+                if (mnemonic[3] == 'g') { // 'xchg'
+                  mnemonic = "Xchg";
+                }
+              }
+            break;}
+            case 'l': { // 'xl'
+              if (mnemonic[2] == 'a') { // 'xla'
+                if (mnemonic[3] == 't') { // 'xlat'
+                  mnemonic = "Xlatb";
+                }
+              }
+            break;}
+            default: break;
+          }
+        break;}
+        default: break;
+      }
+    break;
+    case 5:
+      switch (mnemonic[0]) {
+        case 'a': { // 'a'
+          switch (mnemonic[1]) {
+            case 'd': { // 'ad'
+              if (mnemonic[2] == 'd') { // 'add'
+                if (mnemonic[3] == 's') { // 'adds'
+                  switch (mnemonic[4]) {
+                    case 'd': { // 'addsd'
+                      mnemonic = "Addsd";
+                    break;}
+                    case 's': { // 'addss'
+                      mnemonic = "Addss";
+                    break;}
+                    default: break;
+                  }
+                }
+              }
+            break;}
+            case 'n': { // 'an'
+              if (mnemonic[2] == 'd') { // 'and'
+                if (mnemonic[3] == 'p') { // 'andp'
+                  if (mnemonic[4] == 'd') { // 'andpd'
+                    mnemonic = "Andpd";
+                  }
+                }
+              }
+            break;}
+            default: break;
+          }
+        break;}
+        case 'b': { // 'b'
+          switch (mnemonic[1]) {
+            case 'o': { // 'bo'
+              if (mnemonic[2] == 'u') { // 'bou'
+                if (mnemonic[3] == 'n') { // 'boun'
+                  if (mnemonic[4] == 'd') { // 'bound'
+                    mnemonic = "Bound";
+                  }
+                }
+              }
+            break;}
+            case 's': { // 'bs'
+              if (mnemonic[2] == 'w') { // 'bsw'
+                if (mnemonic[3] == 'a') { // 'bswa'
+                  if (mnemonic[4] == 'p') { // 'bswap'
+                    mnemonic = "Bswap";
+                  }
+                }
+              }
+            break;}
+            default: break;
+          }
+        break;}
+        case 'c': { // 'c'
+          switch (mnemonic[1]) {
+            case 'm': { // 'cm'
+              switch (mnemonic[2]) {
+                case 'o': { // 'cmo'
+                  if (mnemonic[3] == 'v') { // 'cmov'
+                    switch (mnemonic[4]) {
+                      case 'a': { // 'cmova'
+                        mnemonic = "CMova";
+                      break;}
+                      case 'b': { // 'cmovb'
+                        mnemonic = "CMovb";
+                      break;}
+                      case 'c': { // 'cmovc'
+                        mnemonic = "CMovb";
+                      break;}
+                      case 'e': { // 'cmove'
+                        mnemonic = "CMove";
+                      break;}
+                      case 'g': { // 'cmovg'
+                        mnemonic = "CMovg";
+                      break;}
+                      case 'l': { // 'cmovl'
+                        mnemonic = "CMovl";
+                      break;}
+                      case 'o': { // 'cmovo'
+                        mnemonic = "CMovo";
+                      break;}
+                      case 'p': { // 'cmovp'
+                        mnemonic = "CMovpe";
+                      break;}
+                      case 's': { // 'cmovs'
+                        mnemonic = "CMovs";
+                      break;}
+                      case 'z': { // 'cmovz'
+                        mnemonic = "CMove";
+                      break;}
+                      default: break;
+                    }
+                  }
+                break;}
+                case 'p': { // 'cmp'
+                  if (mnemonic[3] == 's') { // 'cmps'
+                    switch (mnemonic[4]) {
+                      case 'b': { // 'cmpsb'
+                        mnemonic = "Cmpsb";
+                      break;}
+                      case 'd': { // 'cmpsd'
+                        mnemonic = "Cmpsd";
+                      break;}
+                      case 'q': { // 'cmpsq'
+                        mnemonic = "Cmpsq";
+                      break;}
+                      case 'w': { // 'cmpsw'
+                        mnemonic = "Cmpsw";
+                      break;}
+                      default: break;
+                    }
+                  }
+                break;}
+                default: break;
+              }
+            break;}
+            case 'p': { // 'cp'
+              if (mnemonic[2] == 'u') { // 'cpu'
+                if (mnemonic[3] == 'i') { // 'cpui'
+                  if (mnemonic[4] == 'd') { // 'cpuid'
+                    mnemonic = "Cpuid";
+                  }
+                }
+              }
+            break;}
+            default: break;
+          }
+        break;}
+        case 'd': { // 'd'
+          if (mnemonic[1] == 'i') { // 'di'
+            if (mnemonic[2] == 'v') { // 'div'
+              if (mnemonic[3] == 's') { // 'divs'
+                if (mnemonic[4] == 'd') { // 'divsd'
+                  mnemonic = "Divsd";
+                }
+              }
+            }
+          }
+        break;}
+        case 'e': { // 'e'
+          if (mnemonic[1] == 'n') { // 'en'
+            if (mnemonic[2] == 't') { // 'ent'
+              if (mnemonic[3] == 'e') { // 'ente'
+                if (mnemonic[4] == 'r') { // 'enter'
+                  mnemonic = "Enter";
+                }
+              }
+            }
+          }
+        break;}
+        case 'f': { // 'f'
+          switch (mnemonic[1]) {
+            case '2': { // 'f2'
+              if (mnemonic[2] == 'x') { // 'f2x'
+                if (mnemonic[3] == 'm') { // 'f2xm'
+                  if (mnemonic[4] == '1') { // 'f2xm1'
+                    mnemonic = "F2xm1";
+                  }
+                }
+              }
+            break;}
+            case 'a': { // 'fa'
+              if (mnemonic[2] == 'd') { // 'fad'
+                if (mnemonic[3] == 'd') { // 'fadd'
+                  switch (mnemonic[4]) {
+                    case 'l': { // 'faddl'
+                      mnemonic = "Fadd";
+                    break;}
+                    case 'p': { // 'faddp'
+                      mnemonic = "Faddp";
+                    break;}
+                    case 's': { // 'fadds'
+                      mnemonic = "Fadd";
+                    break;}
+                    default: break;
+                  }
+                }
+              }
+            break;}
+            case 'c': { // 'fc'
+              if (mnemonic[2] == 'o') { // 'fco'
+                if (mnemonic[3] == 'm') { // 'fcom'
+                  switch (mnemonic[4]) {
+                    case 'l': { // 'fcoml'
+                      mnemonic = "Fcom";
+                    break;}
+                    case 'p': { // 'fcomp'
+                      mnemonic = "Fcomp";
+                    break;}
+                    case 's': { // 'fcoms'
+                      mnemonic = "Fcom";
+                    break;}
+                    default: break;
+                  }
+                }
+              }
+            break;}
+            case 'd': { // 'fd'
+              if (mnemonic[2] == 'i') { // 'fdi'
+                if (mnemonic[3] == 'v') { // 'fdiv'
+                  switch (mnemonic[4]) {
+                    case 'l': { // 'fdivl'
+                      mnemonic = "Fdiv";
+                    break;}
+                    case 'p': { // 'fdivp'
+                      mnemonic = "Fdivp";
+                    break;}
+                    case 'r': { // 'fdivr'
+                      mnemonic = "Fdivr";
+                    break;}
+                    case 's': { // 'fdivs'
+                      mnemonic = "Fdiv";
+                    break;}
+                    default: break;
+                  }
+                }
+              }
+            break;}
+            case 'f': { // 'ff'
+              if (mnemonic[2] == 'r') { // 'ffr'
+                if (mnemonic[3] == 'e') { // 'ffre'
+                  if (mnemonic[4] == 'e') { // 'ffree'
+                    mnemonic = "Ffree";
+                  }
+                }
+              }
+            break;}
+            case 'i': { // 'fi'
+              switch (mnemonic[2]) {
+                case 'a': { // 'fia'
+                  if (mnemonic[3] == 'd') { // 'fiad'
+                    if (mnemonic[4] == 'd') { // 'fiadd'
+                      mnemonic = "Fiadd";
+                    }
+                  }
+                break;}
+                case 'd': { // 'fid'
+                  if (mnemonic[3] == 'i') { // 'fidi'
+                    if (mnemonic[4] == 'v') { // 'fidiv'
+                      mnemonic = "Fidiv";
+                    }
+                  }
+                break;}
+                case 'l': { // 'fil'
+                  if (mnemonic[3] == 'd') { // 'fild'
+                    if (mnemonic[4] == 'l') { // 'fildl'
+                      mnemonic = "Fild";
+                    }
+                  }
+                break;}
+                case 'm': { // 'fim'
+                  if (mnemonic[3] == 'u') { // 'fimu'
+                    if (mnemonic[4] == 'l') { // 'fimul'
+                      mnemonic = "Fimul";
+                    }
+                  }
+                break;}
+                case 's': { // 'fis'
+                  if (mnemonic[3] == 't') { // 'fist'
+                    switch (mnemonic[4]) {
+                      case 'l': { // 'fistl'
+                        mnemonic = "Fist";
+                      break;}
+                      case 'p': { // 'fistp'
+                        mnemonic = "Fistp";
+                      break;}
+                      default: break;
+                    }
+                  }
+                break;}
+                default: break;
+              }
+            break;}
+            case 'l': { // 'fl'
+              if (mnemonic[2] == 'd') { // 'fld'
+                switch (mnemonic[3]) {
+                  case 'c': { // 'fldc'
+                    if (mnemonic[4] == 'w') { // 'fldcw'
+                      mnemonic = "Fldcw";
+                    }
+                  break;}
+                  case 'p': { // 'fldp'
+                    if (mnemonic[4] == 'i') { // 'fldpi'
+                      mnemonic = "Fldpi";
+                    }
+                  break;}
+                  default: break;
+                }
+              }
+            break;}
+            case 'm': { // 'fm'
+              if (mnemonic[2] == 'u') { // 'fmu'
+                if (mnemonic[3] == 'l') { // 'fmul'
+                  switch (mnemonic[4]) {
+                    case 'l': { // 'fmull'
+                      mnemonic = "Fmul";
+                    break;}
+                    case 'p': { // 'fmulp'
+                      mnemonic = "Fmulp";
+                    break;}
+                    case 's': { // 'fmuls'
+                      mnemonic = "Fmul";
+                    break;}
+                    default: break;
+                  }
+                }
+              }
+            break;}
+            case 'p': { // 'fp'
+              switch (mnemonic[2]) {
+                case 'r': { // 'fpr'
+                  if (mnemonic[3] == 'e') { // 'fpre'
+                    if (mnemonic[4] == 'm') { // 'fprem'
+                      mnemonic = "Fprem";
+                    }
+                  }
+                break;}
+                case 't': { // 'fpt'
+                  if (mnemonic[3] == 'a') { // 'fpta'
+                    if (mnemonic[4] == 'n') { // 'fptan'
+                      mnemonic = "Fptan";
+                    }
+                  }
+                break;}
+                default: break;
+              }
+            break;}
+            case 's': { // 'fs'
+              switch (mnemonic[2]) {
+                case 'a': { // 'fsa'
+                  if (mnemonic[3] == 'v') { // 'fsav'
+                    if (mnemonic[4] == 'e') { // 'fsave'
+                      mnemonic = "Fsave";
+                    }
+                  }
+                break;}
+                case 'q': { // 'fsq'
+                  if (mnemonic[3] == 'r') { // 'fsqr'
+                    if (mnemonic[4] == 't') { // 'fsqrt'
+                      mnemonic = "Fsqrt";
+                    }
+                  }
+                break;}
+                case 't': { // 'fst'
+                  if (mnemonic[3] == 'p') { // 'fstp'
+                    switch (mnemonic[4]) {
+                      case 'l': { // 'fstpl'
+                        mnemonic = "Fstp";
+                      break;}
+                      case 's': { // 'fstps'
+                        mnemonic = "Fstp";
+                      break;}
+                      case 't': { // 'fstpt'
+                        mnemonic = "Fstp";
+                      break;}
+                      default: break;
+                    }
+                  }
+                break;}
+                case 'u': { // 'fsu'
+                  if (mnemonic[3] == 'b') { // 'fsub'
+                    switch (mnemonic[4]) {
+                      case 'l': { // 'fsubl'
+                        mnemonic = "Fsub";
+                      break;}
+                      case 'p': { // 'fsubp'
+                        mnemonic = "Fsubp";
+                      break;}
+                      case 'r': { // 'fsubr'
+                        mnemonic = "Fsubr";
+                      break;}
+                      case 's': { // 'fsubs'
+                        mnemonic = "Fsub";
+                      break;}
+                      default: break;
+                    }
+                  }
+                break;}
+                default: break;
+              }
+            break;}
+            case 'u': { // 'fu'
+              if (mnemonic[2] == 'c') { // 'fuc'
+                if (mnemonic[3] == 'o') { // 'fuco'
+                  if (mnemonic[4] == 'm') { // 'fucom'
+                    mnemonic = "Fucom";
+                  }
+                }
+              }
+            break;}
+            case 'w': { // 'fw'
+              if (mnemonic[2] == 'a') { // 'fwa'
+                if (mnemonic[3] == 'i') { // 'fwai'
+                  if (mnemonic[4] == 't') { // 'fwait'
+                    mnemonic = "Fwait";
+                  }
+                }
+              }
+            break;}
+            case 'y': { // 'fy'
+              if (mnemonic[2] == 'l') { // 'fyl'
+                if (mnemonic[3] == '2') { // 'fyl2'
+                  if (mnemonic[4] == 'x') { // 'fyl2x'
+                    mnemonic = "Fyl2x";
+                  }
+                }
+              }
+            break;}
+            default: break;
+          }
+        break;}
+        case 'i': { // 'i'
+          if (mnemonic[1] == 'r') { // 'ir'
+            if (mnemonic[2] == 'e') { // 'ire'
+              if (mnemonic[3] == 't') { // 'iret'
+                switch (mnemonic[4]) {
+                  case 'd': { // 'iretd'
+                    mnemonic = "IRet";
+                  break;}
+                  case 'l': { // 'iretl'
+                    mnemonic = "IRet";
+                  break;}
+                  case 'q': { // 'iretq'
+                    mnemonic = "IRet";
+                  break;}
+                  default: break;
+                }
+              }
+            }
+          }
+        break;}
+        case 'j': { // 'j'
+          switch (mnemonic[1]) {
+            case 'e': { // 'je'
+              if (mnemonic[2] == 'c') { // 'jec'
+                if (mnemonic[3] == 'x') { // 'jecx'
+                  if (mnemonic[4] == 'z') { // 'jecxz'
+                    mnemonic = "Jecxz";
+                  }
+                }
+              }
+            break;}
+            case 'r': { // 'jr'
+              if (mnemonic[2] == 'c') { // 'jrc'
+                if (mnemonic[3] == 'x') { // 'jrcx'
+                  if (mnemonic[4] == 'z') { // 'jrcxz'
+                    mnemonic = "Jrcxz";
+                  }
+                }
+              }
+            break;}
+            default: break;
+          }
+        break;}
+        case 'l': { // 'l'
+          switch (mnemonic[1]) {
+            case 'e': { // 'le'
+              if (mnemonic[2] == 'a') { // 'lea'
+                if (mnemonic[3] == 'v') { // 'leav'
+                  if (mnemonic[4] == 'e') { // 'leave'
+                    mnemonic = "Leave";
+                  }
+                }
+              }
+            break;}
+            case 'o': { // 'lo'
+              switch (mnemonic[2]) {
+                case 'd': { // 'lod'
+                  if (mnemonic[3] == 's') { // 'lods'
+                    switch (mnemonic[4]) {
+                      case 'b': { // 'lodsb'
+                        mnemonic = "Lodsb";
+                      break;}
+                      case 'd': { // 'lodsd'
+                        mnemonic = "Lodsd";
+                      break;}
+                      case 'q': { // 'lodsq'
+                        mnemonic = "Lodsq";
+                      break;}
+                      case 'w': { // 'lodsw'
+                        mnemonic = "Lodsw";
+                      break;}
+                      default: break;
+                    }
+                  }
+                break;}
+                case 'o': { // 'loo'
+                  if (mnemonic[3] == 'p') { // 'loop'
+                    switch (mnemonic[4]) {
+                      case 'e': { // 'loope'
+                        mnemonic = "Loopz";
+                      break;}
+                      case 'l': { // 'loopl'
+                        mnemonic = "Loop";
+                      break;}
+                      case 'z': { // 'loopz'
+                        mnemonic = "Loopz";
+                      break;}
+                      default: break;
+                    }
+                  }
+                break;}
+                default: break;
+              }
+            break;}
+            default: break;
+          }
+        break;}
+        case 'm': { // 'm'
+          if (mnemonic[1] == 'o') { // 'mo'
+            if (mnemonic[2] == 'v') { // 'mov'
+              switch (mnemonic[3]) {
+                case 's': { // 'movs'
+                  switch (mnemonic[4]) {
+                    case 'b': { // 'movsb'
+                      mnemonic = "Movsb";
+                    break;}
+                    case 'd': { // 'movsd'
+                      mnemonic = "Movsd";
+                    break;}
+                    case 'q': { // 'movsq'
+                      mnemonic = "Movsq";
+                    break;}
+                    case 's': { // 'movss'
+                      mnemonic = "Movss";
+                    break;}
+                    case 'w': { // 'movsw'
+                      mnemonic = "Movsw";
+                    break;}
+                    case 'x': { // 'movsx'
+                      mnemonic = "Movsx";
+                    break;}
+                    default: break;
+                  }
+                break;}
+                case 'z': { // 'movz'
+                  if (mnemonic[4] == 'x') { // 'movzx'
+                    mnemonic = "Movzx";
+                  }
+                break;}
+                default: break;
+              }
+            }
+          }
+        break;}
+        case 'o': { // 'o'
+          if (mnemonic[1] == 'u') { // 'ou'
+            if (mnemonic[2] == 't') { // 'out'
+              if (mnemonic[3] == 's') { // 'outs'
+                switch (mnemonic[4]) {
+                  case 'b': { // 'outsb'
+                    mnemonic = "Outsb";
+                  break;}
+                  case 'd': { // 'outsd'
+                    mnemonic = "Outsd";
+                  break;}
+                  case 'w': { // 'outsw'
+                    mnemonic = "Outsw";
+                  break;}
+                  default: break;
+                }
+              }
+            }
+          }
+        break;}
+        case 'p': { // 'p'
+          switch (mnemonic[1]) {
+            case 'a': { // 'pa'
+              switch (mnemonic[2]) {
+                case 'd': { // 'pad'
+                  if (mnemonic[3] == 'd') { // 'padd'
+                    switch (mnemonic[4]) {
+                      case 'b': { // 'paddb'
+                        mnemonic = "Padd";
+                      break;}
+                      case 'd': { // 'paddd'
+                        mnemonic = "Padd";
+                      break;}
+                      case 'q': { // 'paddq'
+                        mnemonic = "Padd";
+                      break;}
+                      case 'w': { // 'paddw'
+                        mnemonic = "Padd";
+                      break;}
+                      default: break;
+                    }
+                  }
+                break;}
+                case 'n': { // 'pan'
+                  if (mnemonic[3] == 'd') { // 'pand'
+                    if (mnemonic[4] == 'n') { // 'pandn'
+                      mnemonic = "Pandn";
+                    }
+                  }
+                break;}
+                case 'u': { // 'pau'
+                  if (mnemonic[3] == 's') { // 'paus'
+                    if (mnemonic[4] == 'e') { // 'pause'
+                      mnemonic = "Pause";
+                    }
+                  }
+                break;}
+                default: break;
+              }
+            break;}
+            case 'o': { // 'po'
+              if (mnemonic[2] == 'p') { // 'pop'
+                switch (mnemonic[3]) {
+                  case 'a': { // 'popa'
+                    if (mnemonic[4] == 'd') { // 'popad'
+                      mnemonic = "Popad";
+                    }
+                  break;}
+                  case 'f': { // 'popf'
+                    switch (mnemonic[4]) {
+                      case 'd': { // 'popfd'
+                        mnemonic = "Popfd";
+                      break;}
+                      case 'q': { // 'popfq'
+                        mnemonic = "Popfq";
+                      break;}
+                      default: break;
+                    }
+                  break;}
+                  default: break;
+                }
+              }
+            break;}
+            case 's': { // 'ps'
+              switch (mnemonic[2]) {
+                case 'l': { // 'psl'
+                  if (mnemonic[3] == 'l') { // 'psll'
+                    switch (mnemonic[4]) {
+                      case 'd': { // 'pslld'
+                        mnemonic = "Psll";
+                      break;}
+                      case 'q': { // 'psllq'
+                        mnemonic = "Psll";
+                      break;}
+                      case 'w': { // 'psllw'
+                        mnemonic = "Psll";
+                      break;}
+                      default: break;
+                    }
+                  }
+                break;}
+                case 'r': { // 'psr'
+                  if (mnemonic[3] == 'l') { // 'psrl'
+                    switch (mnemonic[4]) {
+                      case 'd': { // 'psrld'
+                        mnemonic = "Psrl";
+                      break;}
+                      case 'q': { // 'psrlq'
+                        mnemonic = "Psrl";
+                      break;}
+                      case 'w': { // 'psrlw'
+                        mnemonic = "Psrl";
+                      break;}
+                      default: break;
+                    }
+                  }
+                break;}
+                case 'u': { // 'psu'
+                  if (mnemonic[3] == 'b') { // 'psub'
+                    switch (mnemonic[4]) {
+                      case 'b': { // 'psubb'
+                        mnemonic = "Psub";
+                      break;}
+                      case 'd': { // 'psubd'
+                        mnemonic = "Psub";
+                      break;}
+                      case 'w': { // 'psubw'
+                        mnemonic = "Psub";
+                      break;}
+                      default: break;
+                    }
+                  }
+                break;}
+                default: break;
+              }
+            break;}
+            case 'u': { // 'pu'
+              if (mnemonic[2] == 's') { // 'pus'
+                if (mnemonic[3] == 'h') { // 'push'
+                  switch (mnemonic[4]) {
+                    case 'a': { // 'pusha'
+                      mnemonic = "Pusha";
+                    break;}
+                    case 'f': { // 'pushf'
+                      mnemonic = "Pushf";
+                    break;}
+                    default: break;
+                  }
+                }
+              }
+            break;}
+            default: break;
+          }
+        break;}
+        case 'r': { // 'r'
+          if (mnemonic[1] == 'd') { // 'rd'
+            if (mnemonic[2] == 't') { // 'rdt'
+              if (mnemonic[3] == 's') { // 'rdts'
+                if (mnemonic[4] == 'c') { // 'rdtsc'
+                  mnemonic = "Rdtsc";
+                }
+              }
+            }
+          }
+        break;}
+        case 's': { // 's'
+          switch (mnemonic[1]) {
+            case 'c': { // 'sc'
+              if (mnemonic[2] == 'a') { // 'sca'
+                if (mnemonic[3] == 's') { // 'scas'
+                  switch (mnemonic[4]) {
+                    case 'b': { // 'scasb'
+                      mnemonic = "Scasb";
+                    break;}
+                    case 'd': { // 'scasd'
+                      mnemonic = "Scasd";
+                    break;}
+                    case 'q': { // 'scasq'
+                      mnemonic = "Scasq";
+                    break;}
+                    case 'w': { // 'scasw'
+                      mnemonic = "Scasw";
+                    break;}
+                    default: break;
+                  }
+                }
+              }
+            break;}
+            case 'e': { // 'se'
+              if (mnemonic[2] == 't') { // 'set'
+                switch (mnemonic[3]) {
+                  case 'a': { // 'seta'
+                    if (mnemonic[4] == 'e') { // 'setae'
+                      mnemonic = "Setb";
+                    }
+                  break;}
+                  case 'b': { // 'setb'
+                    if (mnemonic[4] == 'e') { // 'setbe'
+                      mnemonic = "Setbe";
+                    }
+                  break;}
+                  case 'g': { // 'setg'
+                    if (mnemonic[4] == 'e') { // 'setge'
+                      mnemonic = "Setge";
+                    }
+                  break;}
+                  case 'l': { // 'setl'
+                    if (mnemonic[4] == 'e') { // 'setle'
+                      mnemonic = "Setle";
+                    }
+                  break;}
+                  case 'n': { // 'setn'
+                    switch (mnemonic[4]) {
+                      case 'a': { // 'setna'
+                        mnemonic = "Setbe";
+                      break;}
+                      case 'b': { // 'setnb'
+                        mnemonic = "Setae";
+                      break;}
+                      case 'c': { // 'setnc'
+                        mnemonic = "Setae";
+                      break;}
+                      case 'e': { // 'setne'
+                        mnemonic = "Setne";
+                      break;}
+                      case 'g': { // 'setng'
+                        mnemonic = "Setle";
+                      break;}
+                      case 'l': { // 'setnl'
+                        mnemonic = "Setge";
+                      break;}
+                      case 'o': { // 'setno'
+                        mnemonic = "Setno";
+                      break;}
+                      case 'p': { // 'setnp'
+                        mnemonic = "Setpo";
+                      break;}
+                      case 's': { // 'setns'
+                        mnemonic = "Setns";
+                      break;}
+                      case 'z': { // 'setnz'
+                        mnemonic = "Setne";
+                      break;}
+                      default: break;
+                    }
+                  break;}
+                  case 'p': { // 'setp'
+                    switch (mnemonic[4]) {
+                      case 'e': { // 'setpe'
+                        mnemonic = "Setpe";
+                      break;}
+                      case 'o': { // 'setpo'
+                        mnemonic = "Setpo";
+                      break;}
+                      default: break;
+                    }
+                  break;}
+                  default: break;
+                }
+              }
+            break;}
+            case 'l': { // 'sl'
+              if (mnemonic[2] == 'd') { // 'sld'
+                if (mnemonic[3] == 't') { // 'sldt'
+                  if (mnemonic[4] == 'l') { // 'sldtl'
+                    mnemonic = "Sldt";
+                  }
+                }
+              }
+            break;}
+            case 't': { // 'st'
+              if (mnemonic[2] == 'o') { // 'sto'
+                if (mnemonic[3] == 's') { // 'stos'
+                  switch (mnemonic[4]) {
+                    case 'b': { // 'stosb'
+                      mnemonic = "Stosb";
+                    break;}
+                    case 'd': { // 'stosd'
+                      mnemonic = "Stosd";
+                    break;}
+                    case 'q': { // 'stosq'
+                      mnemonic = "Stosq";
+                    break;}
+                    case 'w': { // 'stosw'
+                      mnemonic = "Stosw";
+                    break;}
+                    default: break;
+                  }
+                }
+              }
+            break;}
+            case 'u': { // 'su'
+              if (mnemonic[2] == 'b') { // 'sub'
+                if (mnemonic[3] == 's') { // 'subs'
+                  switch (mnemonic[4]) {
+                    case 'd': { // 'subsd'
+                      mnemonic = "Subsd";
+                    break;}
+                    case 's': { // 'subss'
+                      mnemonic = "Subss";
+                    break;}
+                    default: break;
+                  }
+                }
+              }
+            break;}
+            default: break;
+          }
+        break;}
+        case 'x': { // 'x'
+          switch (mnemonic[1]) {
+            case 'a': { // 'xa'
+              if (mnemonic[2] == 'd') { // 'xad'
+                if (mnemonic[3] == 'd') { // 'xadd'
+                  if (mnemonic[4] == 'l') { // 'xaddl'
+                    mnemonic = "Xadd";
+                  }
+                }
+              }
+            break;}
+            case 'l': { // 'xl'
+              if (mnemonic[2] == 'a') { // 'xla'
+                if (mnemonic[3] == 't') { // 'xlat'
+                  if (mnemonic[4] == 'b') { // 'xlatb'
+                    mnemonic = "Xlatb";
+                  }
+                }
+              }
+            break;}
+            case 'o': { // 'xo'
+              if (mnemonic[2] == 'r') { // 'xor'
+                if (mnemonic[3] == 'p') { // 'xorp'
+                  switch (mnemonic[4]) {
+                    case 'd': { // 'xorpd'
+                      mnemonic = "Xorpd";
+                    break;}
+                    case 's': { // 'xorps'
+                      mnemonic = "Xorps";
+                    break;}
+                    default: break;
+                  }
+                }
+              }
+            break;}
+            default: break;
+          }
+        break;}
+        default: break;
+      }
+    break;
+    case 6:
+      switch (mnemonic[0]) {
+        case 'a': { // 'a'
+          if (mnemonic[1] == 'n') { // 'an'
+            if (mnemonic[2] == 'd') { // 'and'
+              if (mnemonic[3] == 'n') { // 'andn'
+                if (mnemonic[4] == 'p') { // 'andnp'
+                  switch (mnemonic[5]) {
+                    case 'd': { // 'andnpd'
+                      mnemonic = "Andnpd";
+                    break;}
+                    case 's': { // 'andnps'
+                      mnemonic = "Andnpd";
+                    break;}
+                    default: break;
+                  }
+                }
+              }
+            }
+          }
+        break;}
+        case 'b': { // 'b'
+          if (mnemonic[1] == 'o') { // 'bo'
+            if (mnemonic[2] == 'u') { // 'bou'
+              if (mnemonic[3] == 'n') { // 'boun'
+                if (mnemonic[4] == 'd') { // 'bound'
+                  if (mnemonic[5] == 'l') { // 'boundl'
+                    mnemonic = "Bound";
+                  }
+                }
+              }
+            }
+          }
+        break;}
+        case 'c': { // 'c'
+          if (mnemonic[1] == 'm') { // 'cm'
+            if (mnemonic[2] == 'o') { // 'cmo'
+              if (mnemonic[3] == 'v') { // 'cmov'
+                switch (mnemonic[4]) {
+                  case 'a': { // 'cmova'
+                    if (mnemonic[5] == 'e') { // 'cmovae'
+                      mnemonic = "CMovae";
+                    }
+                  break;}
+                  case 'b': { // 'cmovb'
+                    if (mnemonic[5] == 'e') { // 'cmovbe'
+                      mnemonic = "CMovbe";
+                    }
+                  break;}
+                  case 'g': { // 'cmovg'
+                    if (mnemonic[5] == 'e') { // 'cmovge'
+                      mnemonic = "CMovge";
+                    }
+                  break;}
+                  case 'l': { // 'cmovl'
+                    if (mnemonic[5] == 'e') { // 'cmovle'
+                      mnemonic = "CMovle";
+                    }
+                  break;}
+                  case 'n': { // 'cmovn'
+                    switch (mnemonic[5]) {
+                      case 'a': { // 'cmovna'
+                        mnemonic = "CMovbe";
+                      break;}
+                      case 'b': { // 'cmovnb'
+                        mnemonic = "CMovae";
+                      break;}
+                      case 'c': { // 'cmovnc'
+                        mnemonic = "CMovae";
+                      break;}
+                      case 'e': { // 'cmovne'
+                        mnemonic = "CMovne";
+                      break;}
+                      case 'g': { // 'cmovng'
+                        mnemonic = "CMovle";
+                      break;}
+                      case 'l': { // 'cmovnl'
+                        mnemonic = "CMovge";
+                      break;}
+                      case 'o': { // 'cmovno'
+                        mnemonic = "CMovno";
+                      break;}
+                      case 'p': { // 'cmovnp'
+                        mnemonic = "CMovpo";
+                      break;}
+                      case 's': { // 'cmovns'
+                        mnemonic = "CMovns";
+                      break;}
+                      case 'z': { // 'cmovnz'
+                        mnemonic = "CMovne";
+                      break;}
+                      default: break;
+                    }
+                  break;}
+                  case 'p': { // 'cmovp'
+                    switch (mnemonic[5]) {
+                      case 'e': { // 'cmovpe'
+                        mnemonic = "CMovpe";
+                      break;}
+                      case 'o': { // 'cmovpo'
+                        mnemonic = "CMovpo";
+                      break;}
+                      default: break;
+                    }
+                  break;}
+                  default: break;
+                }
+              }
+            }
+          }
+        break;}
+        case 'd': { // 'd'
+          if (mnemonic[1] == 'a') { // 'da'
+            if (mnemonic[2] == 't') { // 'dat'
+              if (mnemonic[3] == 'a') { // 'data'
+                if (mnemonic[4] == '1') { // 'data1'
+                  if (mnemonic[5] == '6') { // 'data16'
+                    mnemonic = "Data16";
+                  }
+                }
+              }
+            }
+          }
+        break;}
+        case 'e': { // 'e'
+          if (mnemonic[1] == 'n') { // 'en'
+            if (mnemonic[2] == 't') { // 'ent'
+              if (mnemonic[3] == 'e') { // 'ente'
+                if (mnemonic[4] == 'r') { // 'enter'
+                  if (mnemonic[5] == 'l') { // 'enterl'
+                    mnemonic = "Enter";
+                  }
+                }
+              }
+            }
+          }
+        break;}
+        case 'f': { // 'f'
+          switch (mnemonic[1]) {
+            case 'c': { // 'fc'
+              if (mnemonic[2] == 'o') { // 'fco'
+                if (mnemonic[3] == 'm') { // 'fcom'
+                  if (mnemonic[4] == 'p') { // 'fcomp'
+                    switch (mnemonic[5]) {
+                      case 'l': { // 'fcompl'
+                        mnemonic = "Fcomp";
+                      break;}
+                      case 'p': { // 'fcompp'
+                        mnemonic = "Fcompp";
+                      break;}
+                      case 's': { // 'fcomps'
+                        mnemonic = "Fcomp";
+                      break;}
+                      default: break;
+                    }
+                  }
+                }
+              }
+            break;}
+            case 'd': { // 'fd'
+              if (mnemonic[2] == 'i') { // 'fdi'
+                if (mnemonic[3] == 'v') { // 'fdiv'
+                  if (mnemonic[4] == 'r') { // 'fdivr'
+                    switch (mnemonic[5]) {
+                      case 'l': { // 'fdivrl'
+                        mnemonic = "Fdivr";
+                      break;}
+                      case 'p': { // 'fdivrp'
+                        mnemonic = "Fdivrp";
+                      break;}
+                      case 's': { // 'fdivrs'
+                        mnemonic = "Fdivr";
+                      break;}
+                      default: break;
+                    }
+                  }
+                }
+              }
+            break;}
+            case 'i': { // 'fi'
+              switch (mnemonic[2]) {
+                case 'a': { // 'fia'
+                  if (mnemonic[3] == 'd') { // 'fiad'
+                    if (mnemonic[4] == 'd') { // 'fiadd'
+                      if (mnemonic[5] == 'l') { // 'fiaddl'
+                        mnemonic = "Fiadd";
+                      }
+                    }
+                  }
+                break;}
+                case 'd': { // 'fid'
+                  if (mnemonic[3] == 'i') { // 'fidi'
+                    if (mnemonic[4] == 'v') { // 'fidiv'
+                      if (mnemonic[5] == 'l') { // 'fidivl'
+                        mnemonic = "Fidiv";
+                      }
+                    }
+                  }
+                break;}
+                case 'm': { // 'fim'
+                  if (mnemonic[3] == 'u') { // 'fimu'
+                    if (mnemonic[4] == 'l') { // 'fimul'
+                      if (mnemonic[5] == 'l') { // 'fimull'
+                        mnemonic = "Fimul";
+                      }
+                    }
+                  }
+                break;}
+                case 's': { // 'fis'
+                  if (mnemonic[3] == 't') { // 'fist'
+                    if (mnemonic[4] == 'p') { // 'fistp'
+                      if (mnemonic[5] == 'l') { // 'fistpl'
+                        mnemonic = "Fistp";
+                      }
+                    }
+                  }
+                break;}
+                default: break;
+              }
+            break;}
+            case 'l': { // 'fl'
+              if (mnemonic[2] == 'd') { // 'fld'
+                if (mnemonic[3] == 'l') { // 'fldl'
+                  switch (mnemonic[4]) {
+                    case '2': { // 'fldl2'
+                      switch (mnemonic[5]) {
+                        case 'e': { // 'fldl2e'
+                          mnemonic = "Fldl2e";
+                        break;}
+                        case 't': { // 'fldl2t'
+                          mnemonic = "Fldl2t";
+                        break;}
+                        default: break;
+                      }
+                    break;}
+                    case 'g': { // 'fldlg'
+                      if (mnemonic[5] == '2') { // 'fldlg2'
+                        mnemonic = "Fldlg2";
+                      }
+                    break;}
+                    case 'n': { // 'fldln'
+                      if (mnemonic[5] == '2') { // 'fldln2'
+                        mnemonic = "Fldln2";
+                      }
+                    break;}
+                    default: break;
+                  }
+                }
+              }
+            break;}
+            case 'n': { // 'fn'
+              if (mnemonic[2] == 's') { // 'fns'
+                if (mnemonic[3] == 't') { // 'fnst'
+                  switch (mnemonic[4]) {
+                    case 'c': { // 'fnstc'
+                      if (mnemonic[5] == 'w') { // 'fnstcw'
+                        mnemonic = "Fnstcw";
+                      }
+                    break;}
+                    case 's': { // 'fnsts'
+                      if (mnemonic[5] == 'w') { // 'fnstsw'
+                        mnemonic = "Fnstsw";
+                      }
+                    break;}
+                    default: break;
+                  }
+                }
+              }
+            break;}
+            case 'p': { // 'fp'
+              if (mnemonic[2] == 'a') { // 'fpa'
+                if (mnemonic[3] == 't') { // 'fpat'
+                  if (mnemonic[4] == 'a') { // 'fpata'
+                    if (mnemonic[5] == 'n') { // 'fpatan'
+                      mnemonic = "Fpatan";
+                    }
+                  }
+                }
+              }
+            break;}
+            case 's': { // 'fs'
+              switch (mnemonic[2]) {
+                case 'c': { // 'fsc'
+                  if (mnemonic[3] == 'a') { // 'fsca'
+                    if (mnemonic[4] == 'l') { // 'fscal'
+                      if (mnemonic[5] == 'e') { // 'fscale'
+                        mnemonic = "Fscale";
+                      }
+                    }
+                  }
+                break;}
+                case 'u': { // 'fsu'
+                  if (mnemonic[3] == 'b') { // 'fsub'
+                    if (mnemonic[4] == 'r') { // 'fsubr'
+                      switch (mnemonic[5]) {
+                        case 'l': { // 'fsubrl'
+                          mnemonic = "Fsubr";
+                        break;}
+                        case 'p': { // 'fsubrp'
+                          mnemonic = "Fsubrp";
+                        break;}
+                        case 's': { // 'fsubrs'
+                          mnemonic = "Fsubr";
+                        break;}
+                        default: break;
+                      }
+                    }
+                  }
+                break;}
+                default: break;
+              }
+            break;}
+            case 'u': { // 'fu'
+              if (mnemonic[2] == 'c') { // 'fuc'
+                if (mnemonic[3] == 'o') { // 'fuco'
+                  if (mnemonic[4] == 'm') { // 'fucom'
+                    switch (mnemonic[5]) {
+                      case 'i': { // 'fucomi'
+                        mnemonic = "Fucom";
+                      break;}
+                      case 'p': { // 'fucomp'
+                        mnemonic = "Fucomp";
+                      break;}
+                      default: break;
+                    }
+                  }
+                }
+              }
+            break;}
+            case 'x': { // 'fx'
+              if (mnemonic[2] == 's') { // 'fxs'
+                if (mnemonic[3] == 'a') { // 'fxsa'
+                  if (mnemonic[4] == 'v') { // 'fxsav'
+                    if (mnemonic[5] == 'e') { // 'fxsave'
+                      mnemonic = "Fxsave";
+                    }
+                  }
+                }
+              }
+            break;}
+            default: break;
+          }
+        break;}
+        case 'l': { // 'l'
+          if (mnemonic[1] == 'o') { // 'lo'
+            if (mnemonic[2] == 'o') { // 'loo'
+              if (mnemonic[3] == 'p') { // 'loop'
+                if (mnemonic[4] == 'n') { // 'loopn'
+                  switch (mnemonic[5]) {
+                    case 'e': { // 'loopne'
+                      mnemonic = "Loopnz";
+                    break;}
+                    case 'z': { // 'loopnz'
+                      mnemonic = "Loopnz";
+                    break;}
+                    default: break;
+                  }
+                }
+              }
+            }
+          }
+        break;}
+        case 'm': { // 'm'
+          if (mnemonic[1] == 'o') { // 'mo'
+            if (mnemonic[2] == 'v') { // 'mov'
+              switch (mnemonic[3]) {
+                case 'a': { // 'mova'
+                  if (mnemonic[4] == 'p') { // 'movap'
+                    if (mnemonic[5] == 's') { // 'movaps'
+                      mnemonic = "Movaps";
+                    }
+                  }
+                break;}
+                case 'd': { // 'movd'
+                  if (mnemonic[4] == 'q') { // 'movdq'
+                    if (mnemonic[5] == 'u') { // 'movdqu'
+                      mnemonic = "Movdqu";
+                    }
+                  }
+                break;}
+                case 'l': { // 'movl'
+                  if (mnemonic[4] == 'p') { // 'movlp'
+                    if (mnemonic[5] == 'd') { // 'movlpd'
+                      mnemonic = "Movlpd";
+                    }
+                  }
+                break;}
+                case 'n': { // 'movn'
+                  if (mnemonic[4] == 't') { // 'movnt'
+                    if (mnemonic[5] == 'q') { // 'movntq'
+                      mnemonic = "Movntq";
+                    }
+                  }
+                break;}
+                default: break;
+              }
+            }
+          }
+        break;}
+        case 'p': { // 'p'
+          if (mnemonic[1] == 'u') { // 'pu'
+            if (mnemonic[2] == 's') { // 'pus'
+              if (mnemonic[3] == 'h') { // 'push'
+                switch (mnemonic[4]) {
+                  case 'a': { // 'pusha'
+                    if (mnemonic[5] == 'd') { // 'pushad'
+                      mnemonic = "Pushad";
+                    }
+                  break;}
+                  case 'f': { // 'pushf'
+                    switch (mnemonic[5]) {
+                      case 'd': { // 'pushfd'
+                        mnemonic = "Pushfd";
+                      break;}
+                      case 'q': { // 'pushfq'
+                        mnemonic = "Pushfq";
+                      break;}
+                      default: break;
+                    }
+                  break;}
+                  default: break;
+                }
+              }
+            }
+          }
+        break;}
+        case 's': { // 's'
+          if (mnemonic[1] == 'e') { // 'se'
+            if (mnemonic[2] == 't') { // 'set'
+              if (mnemonic[3] == 'n') { // 'setn'
+                switch (mnemonic[4]) {
+                  case 'b': { // 'setnb'
+                    if (mnemonic[5] == 'e') { // 'setnbe'
+                      mnemonic = "Seta";
+                    }
+                  break;}
+                  case 'g': { // 'setng'
+                    if (mnemonic[5] == 'e') { // 'setnge'
+                      mnemonic = "Setl";
+                    }
+                  break;}
+                  case 'l': { // 'setnl'
+                    if (mnemonic[5] == 'e') { // 'setnle'
+                      mnemonic = "Setg";
+                    }
+                  break;}
+                  default: break;
+                }
+              }
+            }
+          }
+        break;}
+        default: break;
+      }
+    break;
+    case 7:
+      switch (mnemonic[0]) {
+        case 'c': { // 'c'
+          if (mnemonic[1] == 'm') { // 'cm'
+            switch (mnemonic[2]) {
+              case 'o': { // 'cmo'
+                if (mnemonic[3] == 'v') { // 'cmov'
+                  if (mnemonic[4] == 'n') { // 'cmovn'
+                    switch (mnemonic[5]) {
+                      case 'a': { // 'cmovna'
+                        if (mnemonic[6] == 'e') { // 'cmovnae'
+                          mnemonic = "CMovb";
+                        }
+                      break;}
+                      case 'b': { // 'cmovnb'
+                        if (mnemonic[6] == 'e') { // 'cmovnbe'
+                          mnemonic = "CMova";
+                        }
+                      break;}
+                      case 'g': { // 'cmovng'
+                        if (mnemonic[6] == 'e') { // 'cmovnge'
+                          mnemonic = "CMovl";
+                        }
+                      break;}
+                      case 'l': { // 'cmovnl'
+                        if (mnemonic[6] == 'e') { // 'cmovnle'
+                          mnemonic = "CMovg";
+                        }
+                      break;}
+                      default: break;
+                    }
+                  }
+                }
+              break;}
+              case 'p': { // 'cmp'
+                if (mnemonic[3] == 'x') { // 'cmpx'
+                  if (mnemonic[4] == 'c') { // 'cmpxc'
+                    if (mnemonic[5] == 'h') { // 'cmpxch'
+                      if (mnemonic[6] == 'g') { // 'cmpxchg'
+                        mnemonic = "Cmpxchg";
+                      }
+                    }
+                  }
+                }
+              break;}
+              default: break;
+            }
+          }
+        break;}
+        case 'f': { // 'f'
+          if (mnemonic[1] == 'u') { // 'fu'
+            if (mnemonic[2] == 'c') { // 'fuc'
+              if (mnemonic[3] == 'o') { // 'fuco'
+                if (mnemonic[4] == 'm') { // 'fucom'
+                  if (mnemonic[5] == 'p') { // 'fucomp'
+                    if (mnemonic[6] == 'p') { // 'fucompp'
+                      mnemonic = "Fucompp";
+                    }
+                  }
+                }
+              }
+            }
+          }
+        break;}
+        case 'l': { // 'l'
+          if (mnemonic[1] == 'd') { // 'ld'
+            if (mnemonic[2] == 'm') { // 'ldm'
+              if (mnemonic[3] == 'x') { // 'ldmx'
+                if (mnemonic[4] == 'c') { // 'ldmxc'
+                  if (mnemonic[5] == 's') { // 'ldmxcs'
+                    if (mnemonic[6] == 'r') { // 'ldmxcsr'
+                      mnemonic = "Ldmxcsr";
+                    }
+                  }
+                }
+              }
+            }
+          }
+        break;}
+        case 'p': { // 'p'
+          switch (mnemonic[1]) {
+            case 'a': { // 'pa'
+              if (mnemonic[2] == 'd') { // 'pad'
+                if (mnemonic[3] == 'd') { // 'padd'
+                  if (mnemonic[4] == 'u') { // 'paddu'
+                    if (mnemonic[5] == 's') { // 'paddus'
+                      switch (mnemonic[6]) {
+                        case 'b': { // 'paddusb'
+                          mnemonic = "Paddus";
+                        break;}
+                        case 'w': { // 'paddusw'
+                          mnemonic = "Paddus";
+                        break;}
+                        default: break;
+                      }
+                    }
+                  }
+                }
+              }
+            break;}
+            case 'c': { // 'pc'
+              if (mnemonic[2] == 'm') { // 'pcm'
+                if (mnemonic[3] == 'p') { // 'pcmp'
+                  if (mnemonic[4] == 'e') { // 'pcmpe'
+                    if (mnemonic[5] == 'q') { // 'pcmpeq'
+                      switch (mnemonic[6]) {
+                        case 'b': { // 'pcmpeqb'
+                          mnemonic = "Pcmpeq";
+                        break;}
+                        case 'd': { // 'pcmpeqd'
+                          mnemonic = "Pcmpeq";
+                        break;}
+                        case 'w': { // 'pcmpeqw'
+                          mnemonic = "Pcmpeq";
+                        break;}
+                        default: break;
+                      }
+                    }
+                  }
+                }
+              }
+            break;}
+            case 's': { // 'ps'
+              if (mnemonic[2] == 'u') { // 'psu'
+                if (mnemonic[3] == 'b') { // 'psub'
+                  if (mnemonic[4] == 'u') { // 'psubu'
+                    if (mnemonic[5] == 's') { // 'psubus'
+                      switch (mnemonic[6]) {
+                        case 'b': { // 'psubusb'
+                          mnemonic = "Psubus";
+                        break;}
+                        case 'w': { // 'psubusw'
+                          mnemonic = "Psubus";
+                        break;}
+                        default: break;
+                      }
+                    }
+                  }
+                }
+              }
+            break;}
+            default: break;
+          }
+        break;}
+        case 's': { // 's'
+          if (mnemonic[1] == 't') { // 'st'
+            if (mnemonic[2] == 'm') { // 'stm'
+              if (mnemonic[3] == 'x') { // 'stmx'
+                if (mnemonic[4] == 'c') { // 'stmxc'
+                  if (mnemonic[5] == 's') { // 'stmxcs'
+                    if (mnemonic[6] == 'r') { // 'stmxcsr'
+                      mnemonic = "Stmxcsr";
+                    }
+                  }
+                }
+              }
+            }
+          }
+        break;}
+        case 'u': { // 'u'
+          if (mnemonic[1] == 'c') { // 'uc'
+            if (mnemonic[2] == 'o') { // 'uco'
+              if (mnemonic[3] == 'm') { // 'ucom'
+                if (mnemonic[4] == 'i') { // 'ucomi'
+                  if (mnemonic[5] == 's') { // 'ucomis'
+                    switch (mnemonic[6]) {
+                      case 'd': { // 'ucomisd'
+                        mnemonic = "Ucomisd";
+                      break;}
+                      case 's': { // 'ucomiss'
+                        mnemonic = "Ucomiss";
+                      break;}
+                      default: break;
+                    }
+                  }
+                }
+              }
+            }
+          }
+        break;}
+        default: break;
+      }
+    break;
+    case 9:
+      if (mnemonic[0] == 'c') { // 'c'
+        if (mnemonic[1] == 'm') { // 'cm'
+          if (mnemonic[2] == 'p') { // 'cmp'
+            if (mnemonic[3] == 'x') { // 'cmpx'
+              if (mnemonic[4] == 'c') { // 'cmpxc'
+                if (mnemonic[5] == 'h') { // 'cmpxch'
+                  if (mnemonic[6] == 'g') { // 'cmpxchg'
+                    if (mnemonic[7] == '8') { // 'cmpxchg8'
+                      if (mnemonic[8] == 'b') { // 'cmpxchg8b'
+                        mnemonic = "Cmpxchg8b";
+                      }
+                    }
+                  }
+                }
+              }
+            }
+          }
+        }
+      }
+    break;
+    default: break;
+  }
+}
 SgAsmArmInstruction* createArmInstruction(uint64_t address, const std::string& mnemonic) {
   SgAsmArmInstruction* insn = new SgAsmArmInstruction(address, mnemonic, arm_unknown_instruction);
   switch (mnemonic.size()) {
@@ -2826,3 +5402,246 @@
   }
   return insn;
 }
+void normalizeArmMnemonic(std::string& mnemonic) {
+  switch (mnemonic.size()) {
+    case 1:
+      if (mnemonic[0] == 'b') { // 'b'
+        mnemonic = "B";
+      }
+    break;
+    case 2:
+      if (mnemonic[0] == 'b') { // 'b'
+        switch (mnemonic[1]) {
+          case 'l': { // 'bl'
+            mnemonic = "Bl";
+          break;}
+          case 'x': { // 'bx'
+            mnemonic = "Bx";
+          break;}
+          default: break;
+        }
+      }
+    break;
+    case 3:
+      switch (mnemonic[0]) {
+        case 'a': { // 'a'
+          switch (mnemonic[1]) {
+            case 'd': { // 'ad'
+              switch (mnemonic[2]) {
+                case 'c': { // 'adc'
+                  mnemonic = "Adc";
+                break;}
+                case 'd': { // 'add'
+                  mnemonic = "Add";
+                break;}
+                default: break;
+              }
+            break;}
+            case 'n': { // 'an'
+              if (mnemonic[2] == 'd') { // 'and'
+                mnemonic = "And";
+              }
+            break;}
+            default: break;
+          }
+        break;}
+        case 'b': { // 'b'
+          if (mnemonic[1] == 'i') { // 'bi'
+            if (mnemonic[2] == 'c') { // 'bic'
+              mnemonic = "Bic";
+            }
+          }
+        break;}
+        case 'c': { // 'c'
+          if (mnemonic[1] == 'm') { // 'cm'
+            switch (mnemonic[2]) {
+              case 'n': { // 'cmn'
+                mnemonic = "Cmn";
+              break;}
+              case 'p': { // 'cmp'
+                mnemonic = "Cmp";
+              break;}
+              default: break;
+            }
+          }
+        break;}
+        case 'e': { // 'e'
+          if (mnemonic[1] == 'o') { // 'eo'
+            if (mnemonic[2] == 'r') { // 'eor'
+              mnemonic = "Eor";
+            }
+          }
+        break;}
+        case 'l': { // 'l'
+          if (mnemonic[1] == 'd') { // 'ld'
+            switch (mnemonic[2]) {
+              case 'm': { // 'ldm'
+                mnemonic = "Ldm";
+              break;}
+              case 'r': { // 'ldr'
+                mnemonic = "Ldr";
+              break;}
+              default: break;
+            }
+          }
+        break;}
+        case 'm': { // 'm'
+          switch (mnemonic[1]) {
+            case 'l': { // 'ml'
+              if (mnemonic[2] == 'a') { // 'mla'
+                mnemonic = "Mla";
+              }
+            break;}
+            case 'o': { // 'mo'
+              if (mnemonic[2] == 'v') { // 'mov'
+                mnemonic = "Mov";
+              }
+            break;}
+            case 'r': { // 'mr'
+              if (mnemonic[2] == 's') { // 'mrs'
+                mnemonic = "Mrs";
+              }
+            break;}
+            case 's': { // 'ms'
+              if (mnemonic[2] == 'r') { // 'msr'
+                mnemonic = "Msr";
+              }
+            break;}
+            case 'u': { // 'mu'
+              if (mnemonic[2] == 'l') { // 'mul'
+                mnemonic = "Mul";
+              }
+            break;}
+            case 'v': { // 'mv'
+              if (mnemonic[2] == 'n') { // 'mvn'
+                mnemonic = "Mvn";
+              }
+            break;}
+            default: break;
+          }
+        break;}
+        case 'o': { // 'o'
+          if (mnemonic[1] == 'r') { // 'or'
+            if (mnemonic[2] == 'r') { // 'orr'
+              mnemonic = "Orr";
+            }
+          }
+        break;}
+        case 'r': { // 'r'
+          if (mnemonic[1] == 's') { // 'rs'
+            switch (mnemonic[2]) {
+              case 'b': { // 'rsb'
+                mnemonic = "Rsb";
+              break;}
+              case 'c': { // 'rsc'
+                mnemonic = "Rsc";
+              break;}
+              default: break;
+            }
+          }
+        break;}
+        case 's': { // 's'
+          switch (mnemonic[1]) {
+            case 'b': { // 'sb'
+              if (mnemonic[2] == 'c') { // 'sbc'
+                mnemonic = "Sbc";
+              }
+            break;}
+            case 't': { // 'st'
+              switch (mnemonic[2]) {
+                case 'm': { // 'stm'
+                  mnemonic = "Stm";
+                break;}
+                case 'r': { // 'str'
+                  mnemonic = "Str";
+                break;}
+                default: break;
+              }
+            break;}
+            case 'u': { // 'su'
+              if (mnemonic[2] == 'b') { // 'sub'
+                mnemonic = "Sub";
+              }
+            break;}
+            case 'w': { // 'sw'
+              switch (mnemonic[2]) {
+                case 'i': { // 'swi'
+                  mnemonic = "Swi";
+                break;}
+                case 'p': { // 'swp'
+                  mnemonic = "Swp";
+                break;}
+                default: break;
+              }
+            break;}
+            default: break;
+          }
+        break;}
+        case 't': { // 't'
+          switch (mnemonic[1]) {
+            case 'e': { // 'te'
+              if (mnemonic[2] == 'q') { // 'teq'
+                mnemonic = "Teq";
+              }
+            break;}
+            case 's': { // 'ts'
+              if (mnemonic[2] == 't') { // 'tst'
+                mnemonic = "Tst";
+              }
+            break;}
+            default: break;
+          }
+        break;}
+        default: break;
+      }
+    break;
+    case 5:
+      switch (mnemonic[0]) {
+        case 's': { // 's'
+          if (mnemonic[1] == 'm') { // 'sm'
+            switch (mnemonic[2]) {
+              case 'l': { // 'sml'
+                if (mnemonic[3] == 'a') { // 'smla'
+                  if (mnemonic[4] == 'l') { // 'smlal'
+                    mnemonic = "Smlal";
+                  }
+                }
+              break;}
+              case 'u': { // 'smu'
+                if (mnemonic[3] == 'l') { // 'smul'
+                  if (mnemonic[4] == 'l') { // 'smull'
+                    mnemonic = "Smull";
+                  }
+                }
+              break;}
+              default: break;
+            }
+          }
+        break;}
+        case 'u': { // 'u'
+          if (mnemonic[1] == 'm') { // 'um'
+            switch (mnemonic[2]) {
+              case 'l': { // 'uml'
+                if (mnemonic[3] == 'a') { // 'umla'
+                  if (mnemonic[4] == 'l') { // 'umlal'
+                    mnemonic = "Umlal";
+                  }
+                }
+              break;}
+              case 'u': { // 'umu'
+                if (mnemonic[3] == 'l') { // 'umul'
+                  if (mnemonic[4] == 'l') { // 'umull'
+                    mnemonic = "Umull";
+                  }
+                }
+              break;}
+              default: break;
+            }
+          }
+        break;}
+        default: break;
+      }
+    break;
+    default: break;
+  }
+}

Modified: trunk/src/frontend/BinaryDisassembly/make-decision-tree.tcl
===================================================================
--- trunk/src/frontend/BinaryDisassembly/make-decision-tree.tcl	2008-11-04 21:05:45 UTC (rev 115)
+++ trunk/src/frontend/BinaryDisassembly/make-decision-tree.tcl	2008-11-05 21:05:34 UTC (rev 116)
@@ -71,6 +71,85 @@
   puts $outFile "}"
 }
 
+
+##BEGIN SUPPORT FOR STRING MNEMONIC NORMALIZATION
+##AS(10/04/08) This is necessary for the work where we compare 
+##the output of ROSE with the output of IDA Pro. 
+
+proc doLeafNormalize {insn platform} {
+  global astNode$platform
+  if {[info exists astNode${platform}($insn)]} {
+    return [format "mnemonic = \"[set astNode${platform}($insn)]\";"]
+  } else {
+    return [format ";"]
+  }
+}
+
+proc makeSwitchNormalize {len prefix platform outFile indent} {
+  global astNode$platform
+  set offset [string length $prefix]
+  if {$offset == $len} {puts $outFile "${indent}[doLeafNormalize $prefix $platform]"; return}
+  foreach str [array names astNode$platform] {
+    if {[string range $str 0 [expr {$offset - 1}]] != $prefix} {continue}
+    if {[string length $str] != $len} {continue}
+    set c [string index $str $offset]
+    if {$c == ""} {continue}
+    lappend firstChar($c) $str
+  }
+  if {[array size firstChar] == 0} {
+    error "Bad prefix '$prefix' for length $len"
+  } elseif {[array size firstChar] == 1} {
+    puts $outFile "${indent}if (mnemonic\[$offset\] == '$c') { // '$prefix$c'"
+    makeSwitchNormalize $len "$prefix$c" $platform $outFile "${indent}  "
+    puts $outFile "${indent}}"
+  } else {
+    puts $outFile "${indent}switch (mnemonic\[$offset\]) {"
+    foreach c [lsort [array names firstChar]] {
+      puts $outFile "${indent}  case '$c': { // '$prefix$c'"
+      makeSwitchNormalize $len "$prefix$c" $platform $outFile "${indent}    "
+      puts $outFile "${indent}  break;}"
+    }
+    puts $outFile "${indent}  default: break;"
+    puts $outFile "${indent}}"
+  }
+}
+
+
+proc makeSwitchForLanguageNormalizeToString {platform outFile} {
+  global astNode$platform
+  set instructionTable [open "RoseBin_instruction_table_[string tolower $platform]" r]
+  while {1} {
+    set line [split [gets $instructionTable] " "]
+    if {[eof $instructionTable]} {break}
+    if {[lindex $line end-1] != "->"} {error "Incorrect line format: should be mnemonic ... -> AstNodeName" line}
+    foreach mnemonic [lrange $line 0 end-2] {
+      set astNode${platform}($mnemonic) [lindex $line end]
+    }
+  }
+  close $instructionTable
+
+  foreach mnemonic [array names astNode$platform] {
+    set byLength([string length $mnemonic]) x
+  }
+
+  puts $outFile "void normalize${platform}Mnemonic(std::string& mnemonic) {"
+  #puts $outFile "  std::string returnMnemonic = \"unknown_instruction\";"
+  puts $outFile "  switch (mnemonic.size()) {"
+  foreach len [lsort -integer [array names byLength]] {
+    puts $outFile "    case $len:"
+    makeSwitchNormalize $len "" $platform $outFile "      "
+    puts $outFile "    break;"
+  }
+  puts $outFile "    default: break;"
+  puts $outFile "  }"
+  #puts $outFile "  return returnMnemonic;"
+  puts $outFile "}"
+}
+
+## END CODE FOR SUPPORTING NORMALIZATION OF MNEMONICS
+
+
+
 set outFile [open "instructionDispatch.cpp" w]
 puts $outFile "#include \"rose.h\""
 puts $outFile "#include <stdint.h>"
@@ -79,5 +158,10 @@
 puts $outFile "// ************************************"
 foreach platform {x86 Arm} {
   makeSwitchForLanguage $platform $outFile
+
+  ##Call code for generation the function to normalize mnemnoic strings
+  ##necessary for work which compares ROSE disassembler with IDA Pro.
+  makeSwitchForLanguageNormalizeToString $platform $outFile
+
 }
 close $outFile

Modified: trunk/src/frontend/CxxFrontend/Makefile.am
===================================================================
--- trunk/src/frontend/CxxFrontend/Makefile.am	2008-11-04 21:05:45 UTC (rev 115)
+++ trunk/src/frontend/CxxFrontend/Makefile.am	2008-11-05 21:05:34 UTC (rev 116)
@@ -20,4 +20,4 @@
 clean-local:
 	-rm -rf .libs/
 
-EXTRA_DIST = roseBinaryEDG-i686-apple-darwin9.5.0-a5c62cade59e5dde06c3a52de198435b.tar.gz roseBinaryEDG-i686-pc-linux-gnu-a5c62cade59e5dde06c3a52de198435b.tar.gz roseBinaryEDG-x86_64-pc-linux-gnu-a5c62cade59e5dde06c3a52de198435b.tar.gz
+EXTRA_DIST = roseBinaryEDG-i686-apple-darwin9.5.0-b0847234cb4f3e1afaefa965207df2c0.tar.gz roseBinaryEDG-i686-pc-linux-gnu-b0847234cb4f3e1afaefa965207df2c0.tar.gz roseBinaryEDG-x86_64-pc-linux-gnu-b0847234cb4f3e1afaefa965207df2c0.tar.gz

Deleted: trunk/src/frontend/CxxFrontend/roseBinaryEDG-i686-apple-darwin9.5.0-a5c62cade59e5dde06c3a52de198435b.tar.gz
===================================================================
(Binary files differ)

Added: trunk/src/frontend/CxxFrontend/roseBinaryEDG-i686-apple-darwin9.5.0-b0847234cb4f3e1afaefa965207df2c0.tar.gz
===================================================================
(Binary files differ)


Property changes on: trunk/src/frontend/CxxFrontend/roseBinaryEDG-i686-apple-darwin9.5.0-b0847234cb4f3e1afaefa965207df2c0.tar.gz
___________________________________________________________________
Name: svn:mime-type
   + application/x-gzip

Deleted: trunk/src/frontend/CxxFrontend/roseBinaryEDG-i686-pc-linux-gnu-a5c62cade59e5dde06c3a52de198435b.tar.gz
===================================================================
(Binary files differ)

Added: trunk/src/frontend/CxxFrontend/roseBinaryEDG-i686-pc-linux-gnu-b0847234cb4f3e1afaefa965207df2c0.tar.gz
===================================================================
(Binary files differ)


Property changes on: trunk/src/frontend/CxxFrontend/roseBinaryEDG-i686-pc-linux-gnu-b0847234cb4f3e1afaefa965207df2c0.tar.gz
___________________________________________________________________
Name: svn:mime-type
   + application/x-gzip

Deleted: trunk/src/frontend/CxxFrontend/roseBinaryEDG-x86_64-pc-linux-gnu-a5c62cade59e5dde06c3a52de198435b.tar.gz
===================================================================
(Binary files differ)

Added: trunk/src/frontend/CxxFrontend/roseBinaryEDG-x86_64-pc-linux-gnu-b0847234cb4f3e1afaefa965207df2c0.tar.gz
===================================================================
(Binary files differ)


Property changes on: trunk/src/frontend/CxxFrontend/roseBinaryEDG-x86_64-pc-linux-gnu-b0847234cb4f3e1afaefa965207df2c0.tar.gz
___________________________________________________________________
Name: svn:mime-type
   + application/x-gzip

Modified: trunk/src/frontend/OpenFortranParser_SAGE_Connection/FortranModuleInfo.C
===================================================================
--- trunk/src/frontend/OpenFortranParser_SAGE_Connection/FortranModuleInfo.C	2008-11-04 21:05:45 UTC (rev 115)
+++ trunk/src/frontend/OpenFortranParser_SAGE_Connection/FortranModuleInfo.C	2008-11-05 21:05:34 UTC (rev 116)
@@ -70,7 +70,8 @@
      nestedSgFile++;
      SgProject*  project = getCurrentProject();
 
-     SgSourceFile* newFile = new SgSourceFile (argv, errorCode, 0, project);
+     SgSourceFile* newFile = isSgSourceFile(determineFileType(argv,errorCode,project));
+       // SgSourceFile* newFile =  new SgSourceFile (argv, errorCode, 0, project);
 
      ROSE_ASSERT (newFile != NULL);
      ROSE_ASSERT (newFile->get_startOfConstruct() != NULL);

Modified: trunk/src/frontend/SageIII/astMerge/merge.C
===================================================================
--- trunk/src/frontend/SageIII/astMerge/merge.C	2008-11-04 21:05:45 UTC (rev 115)
+++ trunk/src/frontend/SageIII/astMerge/merge.C	2008-11-05 21:05:34 UTC (rev 116)
@@ -630,7 +630,7 @@
                     int nextErrorCode = 0;
 #if 1
                     int fileIndex = 0;
-                    SgFile* newFile = new SgFile ( argc, argv, nextErrorCode, fileIndex, project );
+                    SgFile* newFile = determineFileType( vector<string>(argv, argv+argc), nextErrorCode,  project );
                     ROSE_ASSERT (newFile != NULL);
 
                     newFile->set_parent(project);

Modified: trunk/src/frontend/SageIII/sageInterface/sageBuilder.C
===================================================================
--- trunk/src/frontend/SageIII/sageInterface/sageBuilder.C	2008-11-04 21:05:45 UTC (rev 115)
+++ trunk/src/frontend/SageIII/sageInterface/sageBuilder.C	2008-11-05 21:05:34 UTC (rev 116)
@@ -1993,8 +1993,12 @@
 
    // DQ (9/3/2008): Added support for SgSourceFile IR node
    // SgFile* result = new SgFile (arglist, nextErrorCode, 0, project);
-      SgSourceFile* result = new SgSourceFile (arglist, nextErrorCode, 0, project);
-
+      //AS(10/04/08) Because of refactoring we require the determineFileType function to be called 
+      //to construct the node. 
+      //SgSourceFile* result = new SgSourceFile (arglist, nextErrorCode, 0, project);
+      SgSourceFile* result = isSgSourceFile(determineFileType(arglist, nextErrorCode, project));
+      
+      
       ROSE_ASSERT(result!=NULL);
       result->set_parent(project);
       project->set_file(*result); 

Modified: trunk/src/frontend/SageIII/sageInterface/sageInterface.h
===================================================================
--- trunk/src/frontend/SageIII/sageInterface/sageInterface.h	2008-11-04 21:05:45 UTC (rev 115)
+++ trunk/src/frontend/SageIII/sageInterface/sageInterface.h	2008-11-05 21:05:34 UTC (rev 116)
@@ -1,7 +1,10 @@
 #ifndef ROSE_SAGE_INTERFACE
 #define ROSE_SAGE_INTERFACE
 
+
 #include "sage3.h"
+SgFile*                         determineFileType ( std::vector<std::string> argv, int nextErrorCode, SgProject* project );
+
 #include "rewrite.h"
 
 // DQ (7/20/2008): Added support for unparsing abitrary strings in the unparser.
@@ -1046,7 +1049,6 @@
 //! Get the constant value from a constant integer expression; abort on
 //! everything else.  Note that signed long longs are converted to unsigned.
 unsigned long long getIntegerConstantValue(SgValueExp* expr);
-
 //@}
 
 

Modified: trunk/src/frontend/SageIII/sageSupport.C
===================================================================
--- trunk/src/frontend/SageIII/sageSupport.C	2008-11-04 21:05:45 UTC (rev 115)
+++ trunk/src/frontend/SageIII/sageSupport.C	2008-11-05 21:05:34 UTC (rev 116)
@@ -1757,48 +1757,11 @@
       return returnValue;
     }
 
- 
-void
-SgFile::generateBinaryExecutableFileInformation ( string sourceFilename, SgAsmFile* asmFile )
-   {
-  // Need a mechanism to select what kind of binary we will process.
 
-#if 1
-  // printf ("Calling SgAsmExecutableFileFormat::parseBinaryFormat() \n");
-
-     SgAsmExecutableFileFormat::parseBinaryFormat(sourceFilename,asmFile);
-
-#else
-  // JJW (7/23/2008): We are using Robb's code for this, and it crashes on PE files
-  // printf ("Calling generateBinaryExecutableFileInformation_ELF() \n");
-     bool handled = false;
-
-  // DQ (13/8/2008): Skip the use of the older binary file format support (from before Robb's work).
-  // if (!handled) handled = generateBinaryExecutableFileInformation_ELF( sourceFilename, asmFile );
-  // if (!handled) {} // generateBinaryExecutableFileInformation_Windows ( sourceFilename, asmFile );
-
-     if (!handled) {
-
-    // DQ (13/8/2008): This is one of the few remaining data member in a SgAsmFile IR node.
-       asmFile->set_name(sourceFilename);
-
-    // Hard wire this for the moment while I work on getting Robb's work into place...
-    // DQ (13/8/2008): Removed this data member (such information is now in the SgAsmGenericHeader).
-    // asmFile->set_machine_architecture(SgAsmFile::e_machine_architecture_Intel_80386);
-
-       handled = true;
-     }
-     ROSE_ASSERT (handled);
-#endif
-   }
-
-
-
-
-
-void
-SgFile::setupSourceFilename ( const vector<string>& argv )
+SgFile* 
+determineFileType ( vector<string> argv, int nextErrorCode, SgProject* project )
    {
+     SgFile* file = NULL;
   // DQ (4/21/2006): New version of source file name handling (set the source file name early)
      Rose_STL_Container<string> fileList = CommandlineProcessing::generateSourceFilenames(argv);
 
@@ -1821,10 +1784,6 @@
 
        // printf ("After conversion to absolute path: sourceFilename = %s \n",sourceFilename.c_str());
 
-          p_sourceFileNameWithPath = sourceFilename;
-
-       // printf ("In SgFile::setupSourceFilename(const vector<string>& argv): p_sourceFileNameWithPath = %s \n",p_sourceFileNameWithPath.c_str());
-
        // This should be an absolute path
           string targetSubstring = "/";
        // if (sourceFilename.substr(0,targetSubstring.size()) != targetSubstring)
@@ -1846,69 +1805,71 @@
        // ROSE_ASSERT(false);
 
        // DQ (5/18/2008): Set this to true (redundant, since the default already specified as true)
-          set_requires_C_preprocessor(true);
+          //file->set_requires_C_preprocessor(true);
 
        // DQ (11/17/2007): Mark this as a file using a Fortran file extension (else this turns off options down stream).
           if (CommandlineProcessing::isFortranFileNameSuffix(filenameExtension) == true)
              {
-            // printf ("Calling set_sourceFileUsesFortranFileExtension(true) \n");
-               set_sourceFileUsesFortranFileExtension(true);
+               file = new SgSourceFile ( argv,  project );
 
+            // printf ("Calling file->set_sourceFileUsesFortranFileExtension(true) \n");
+               file->set_sourceFileUsesFortranFileExtension(true);
+
             // Use the filename suffix as a default means to set this value
-               set_outputLanguage(SgFile::e_Fortran_output_language);
+               file->set_outputLanguage(SgFile::e_Fortran_output_language);
 
-               set_Fortran_only(true);
+               file->set_Fortran_only(true);
 
             // DQ (5/18/2008): Set this to true (redundant, since the default already specified as true)
-               set_requires_C_preprocessor(CommandlineProcessing::isFortranFileNameSuffixRequiringCPP(filenameExtension));
+               file->set_requires_C_preprocessor(CommandlineProcessing::isFortranFileNameSuffixRequiringCPP(filenameExtension));
 
             // Now set the specific types of Fortran file extensions
                if (CommandlineProcessing::isFortran77FileNameSuffix(filenameExtension) == true)
                   {
-                 // printf ("Calling set_sourceFileUsesFortran77FileExtension(true) \n");
-                    set_sourceFileUsesFortran77FileExtension(true);
+                 // printf ("Calling file->set_sourceFileUsesFortran77FileExtension(true) \n");
+                    file->set_sourceFileUsesFortran77FileExtension(true);
 
                  // Use the filename suffix as a default means to set this value
-                    set_outputFormat(SgFile::e_fixed_form_output_format);
-                    set_backendCompileFormat(SgFile::e_fixed_form_output_format);
+                    file->set_outputFormat(SgFile::e_fixed_form_output_format);
+                    file->set_backendCompileFormat(SgFile::e_fixed_form_output_format);
 
-                    set_F77_only(true);
+                    file->set_F77_only(true);
                   }
 
                if (CommandlineProcessing::isFortran90FileNameSuffix(filenameExtension) == true)
                   {
-                 // printf ("Calling set_sourceFileUsesFortran90FileExtension(true) \n");
-                    set_sourceFileUsesFortran90FileExtension(true);
+                 // printf ("Calling file->set_sourceFileUsesFortran90FileExtension(true) \n");
+                    file->set_sourceFileUsesFortran90FileExtension(true);
 
                  // Use the filename suffix as a default means to set this value
-                    set_outputFormat(SgFile::e_free_form_output_format);
-                    set_backendCompileFormat(SgFile::e_free_form_output_format);
+                    file->set_outputFormat(SgFile::e_free_form_output_format);
+                    file->set_backendCompileFormat(SgFile::e_free_form_output_format);
 
-                    set_F90_only(true);
+                    file->set_F90_only(true);
                   }
 
                if (CommandlineProcessing::isFortran95FileNameSuffix(filenameExtension) == true)
                   {
-                 // printf ("Calling set_sourceFileUsesFortran95FileExtension(true) \n");
-                    set_sourceFileUsesFortran95FileExtension(true);
+                 // printf ("Calling file->set_sourceFileUsesFortran95FileExtension(true) \n");
+                    file->set_sourceFileUsesFortran95FileExtension(true);
 
                  // Use the filename suffix as a default means to set this value
-                    set_outputFormat(SgFile::e_free_form_output_format);
-                    set_backendCompileFormat(SgFile::e_free_form_output_format);
+                    file->set_outputFormat(SgFile::e_free_form_output_format);
+                    file->set_backendCompileFormat(SgFile::e_free_form_output_format);
 
-                    set_F95_only(true);
+                    file->set_F95_only(true);
                   }
 
                if (CommandlineProcessing::isFortran2003FileNameSuffix(filenameExtension) == true)
                   {
-                 // printf ("Calling set_sourceFileUsesFortran2003FileExtension(true) \n");
-                    set_sourceFileUsesFortran2003FileExtension(true);
+                 // printf ("Calling file->set_sourceFileUsesFortran2003FileExtension(true) \n");
+                    file->set_sourceFileUsesFortran2003FileExtension(true);
 
                  // Use the filename suffix as a default means to set this value
-                    set_outputFormat(SgFile::e_free_form_output_format);
-                    set_backendCompileFormat(SgFile::e_free_form_output_format);
+                    file->set_outputFormat(SgFile::e_free_form_output_format);
+                    file->set_backendCompileFormat(SgFile::e_free_form_output_format);
 
-                    set_F2003_only(true);
+                    file->set_F2003_only(true);
                   }
 
                if (CommandlineProcessing::isFortran2008FileNameSuffix(filenameExtension) == true)
@@ -1917,55 +1878,64 @@
                     ROSE_ASSERT(false);
 
                  // This is not yet supported.
-                 // set_sourceFileUsesFortran2008FileExtension(true);
+                 // file->set_sourceFileUsesFortran2008FileExtension(true);
 
                  // Use the filename suffix as a default means to set this value
-                    set_outputFormat(SgFile::e_free_form_output_format);
-                    set_backendCompileFormat(SgFile::e_free_form_output_format);
+                    file->set_outputFormat(SgFile::e_free_form_output_format);
+                    file->set_backendCompileFormat(SgFile::e_free_form_output_format);
                   }
              }
             else if (CommandlineProcessing::isPHPFileNameSuffix(filenameExtension) == true)
              {
-                    set_sourceFileUsesPHPFileExtension(true);
 
-                    set_outputLanguage(SgFile::e_PHP_output_language);
+                    file = new SgSourceFile ( argv,  project );
 
-                    set_PHP_only(true);
+                    file->set_sourceFileUsesPHPFileExtension(true);
+
+                    file->set_outputLanguage(SgFile::e_PHP_output_language);
+
+                    file->set_PHP_only(true);
               }
             else
              {
-            // printf ("Calling set_sourceFileUsesFortranFileExtension(false) \n");
-               set_sourceFileUsesFortranFileExtension(false);
-
+            // printf ("Calling file->set_sourceFileUsesFortranFileExtension(false) \n");
+               
             // if (StringUtility::isCppFileNameSuffix(filenameExtension) == true)
                if (CommandlineProcessing::isCppFileNameSuffix(filenameExtension) == true)
                   {
+                    file = new SgSourceFile ( argv,  project );
+
                  // This is a C++ file (so define __cplusplus, just like GNU gcc would)
-                 // set_requires_cplusplus_macro(true);
-                    set_sourceFileUsesCppFileExtension(true);
+                 // file->set_requires_cplusplus_macro(true);
+                    file->set_sourceFileUsesCppFileExtension(true);
 
                  // Use the filename suffix as a default means to set this value
-                    set_outputLanguage(SgFile::e_Cxx_output_language);
+                    file->set_outputLanguage(SgFile::e_Cxx_output_language);
 
-                    set_Cxx_only(true);
+                    file->set_Cxx_only(true);
+                  
                   }
                  else
                   {
+             
                   // Liao, 6/6/2008, Assume AST with UPC will be unparsed using the C unparser
                     if ( ( CommandlineProcessing::isCFileNameSuffix(filenameExtension)   == true ) ||
                          ( CommandlineProcessing::isUPCFileNameSuffix(filenameExtension) == true ) )
                        {
+
+                         file = new SgSourceFile ( argv,  project );
+
                       // This a not a C++ file (assume it is a C file and don't define the __cplusplus macro, just like GNU gcc would)
-                         set_sourceFileUsesCppFileExtension(false);
+                         file->set_sourceFileUsesCppFileExtension(false);
 
                       // Use the filename suffix as a default means to set this value
-                         set_outputLanguage(SgFile::e_C_output_language);
+                         file->set_outputLanguage(SgFile::e_C_output_language);
 
-                         set_C_only(true);
+                         file->set_C_only(true);
                          // Liao 6/6/2008  Set the newly introduced p_UPC_only flag.
                          //
                          if (CommandlineProcessing::isUPCFileNameSuffix(filenameExtension) == true) 
-                           set_UPC_only(true);
+                           file->set_UPC_only(true);
                        }
                       else
                        {
@@ -1976,41 +1946,105 @@
 
                          if (isBinaryExecutable == true)
                             {
-                              set_sourceFileUsesBinaryFileExtension(true);
-                              set_binary_only(true);
 
+                              file = new SgBinaryFile ( argv,  project );
+
+                              file->set_sourceFileUsesBinaryFileExtension(true);
+                              file->set_binary_only(true);
+
                            // DQ (5/18/2008): Set this to false (since binaries are never preprocessed using the C preprocessor).
-                              set_requires_C_preprocessor(false);
+                              file->set_requires_C_preprocessor(false);
                             }
                            else
                             {
+
+                              file = new SgUnknownFile ( argv,  project );
+
                            // If all else fails, then output the type of file and exit.
-                              outputTypeOfFileAndExit(sourceFilename);
+                              file->set_sourceFileTypeIsUnknown(true);
+                              file->set_requires_C_preprocessor(false);
+                              //outputTypeOfFileAndExit(sourceFilename);
                             }
                        }
                   }
+                 file->set_sourceFileUsesFortranFileExtension(false);
+
              }
 
-          p_sourceFileNameWithoutPath = ROSE::stripPathFromFileName(p_sourceFileNameWithPath.c_str());
         }
        else
         {
+
+          //AS Is this option possible?
+          abort();
        // ROSE_ASSERT (p_numberOfSourceFileNames == 0);
-          ROSE_ASSERT (p_sourceFileNameWithPath.empty() == true);
+          ROSE_ASSERT (file->get_sourceFileNameWithPath().empty() == true);
        // If no source code file name was found then likely this is a link command
        // using the C++ compiler.  In this case skip the EDG processing.
-          set_disable_edg_backend(true);
+          file->set_disable_edg_backend(true);
        // printf ("No source file found on command line, assuming to be linker command line \n");
         }
 
+    //The frontend is called exlicitly outside the constructor since that allows for a cleaner
+    //control flow. The callFrontEnd() relies on all the "set_" flags to be already called therefore
+    //it was placed here.
+    if( isSgUnknownFile(file) == NULL && file != NULL  )
+    {
+
+      nextErrorCode =   file->callFrontEnd() ;
+      ROSE_ASSERT ( nextErrorCode <= 3);
+
+    }
+       
   // Keep the filename stored in the Sg_File_Info consistant.  Later we will want to remove this redundency
   // The reason we have the Sg_File_Info object is so that we can easily support filename matching based on
   // the integer values instead of string comparisions.
-     get_file_info()->set_filenameString(p_sourceFileNameWithPath);
-
+     
   // display("SgFile::setupSourceFilename()");
+     return file;
    }
 
+ 
+void
+SgFile::generateBinaryExecutableFileInformation ( string sourceFilename, SgAsmFile* asmFile )
+   {
+  // Need a mechanism to select what kind of binary we will process.
+
+#if 1
+  // printf ("Calling SgAsmExecutableFileFormat::parseBinaryFormat() \n");
+
+     SgAsmExecutableFileFormat::parseBinaryFormat(sourceFilename,asmFile);
+
+#else
+  // JJW (7/23/2008): We are using Robb's code for this, and it crashes on PE files
+  // printf ("Calling generateBinaryExecutableFileInformation_ELF() \n");
+     bool handled = false;
+
+  // DQ (13/8/2008): Skip the use of the older binary file format support (from before Robb's work).
+  // if (!handled) handled = generateBinaryExecutableFileInformation_ELF( sourceFilename, asmFile );
+  // if (!handled) {} // generateBinaryExecutableFileInformation_Windows ( sourceFilename, asmFile );
+
+     if (!handled) {
+
+    // DQ (13/8/2008): This is one of the few remaining data member in a SgAsmFile IR node.
+       asmFile->set_name(sourceFilename);
+
+    // Hard wire this for the moment while I work on getting Robb's work into place...
+    // DQ (13/8/2008): Removed this data member (such information is now in the SgAsmGenericHeader).
+    // asmFile->set_machine_architecture(SgAsmFile::e_machine_architecture_Intel_80386);
+
+       handled = true;
+     }
+     ROSE_ASSERT (handled);
+#endif
+   }
+
+
+
+
+
+
+
 static string makeSysIncludeList(const Rose_STL_Container<string>& dirs) {
   string includeBase = findRoseSupportPathFromBuild("include-staging", "include");
   string result;
@@ -2818,8 +2852,19 @@
    }
 
 
+SgSourceFile::SgSourceFile ( vector<string> & argv , SgProject* project )
+// : SgFile (argv,errorCode,fileNameIndex,project)
+   {
+  // printf ("In the SgSourceFile constructor \n");
 
+     set_globalScope(NULL);
 
+  // This constructor actually makes the call to EDG to build the AST (via callFrontEnd()).
+     doSetupForConstructor(argv,  project);
+
+    }
+
+#if 0
 SgSourceFile::SgSourceFile ( vector<string> & argv , int & errorCode, int fileNameIndex, SgProject* project )
 // : SgFile (argv,errorCode,fileNameIndex,project)
    {
@@ -2830,6 +2875,17 @@
   // This constructor actually makes the call to EDG to build the AST (via callFrontEnd()).
      doSetupForConstructor(argv, errorCode, fileNameIndex, project);
 
+    }
+#endif
+
+int
+SgSourceFile::callFrontEnd()
+   {
+#ifdef USE_ROSE_OPEN_FORTRAN_PARSER_SUPPORT
+     FortranParserState* currStks = new FortranParserState(); 
+#endif // USE_ROSE_OPEN_FORTRAN_PARSER_SUPPORT
+
+     int frontendErrorLevel = SgFile::callFrontEnd();
   // DQ (1/21/2008): This must be set for all languages
      ROSE_ASSERT(get_globalScope() != NULL);
      ROSE_ASSERT(get_globalScope()->get_file_info() != NULL);
@@ -2839,9 +2895,30 @@
   // DQ (8/21/2008): Added assertion.
      ROSE_ASSERT (get_globalScope()->get_startOfConstruct() != NULL);
      ROSE_ASSERT (get_globalScope()->get_endOfConstruct()   != NULL);
-    }
- 
-SgBinaryFile::SgBinaryFile ( vector<string> & argv , int & errorCode, int fileNameIndex, SgProject* project )
+
+#ifdef USE_ROSE_OPEN_FORTRAN_PARSER_SUPPORT
+     delete  currStks ;
+#endif // USE_ROSE_OPEN_FORTRAN_PARSER_SUPPORT
+
+     return frontendErrorLevel;
+   }
+
+int
+SgBinaryFile::callFrontEnd()
+   {
+     int frontendErrorLevel = SgFile::callFrontEnd();
+  // DQ (1/21/2008): This must be set for all languages
+     return frontendErrorLevel;
+   }
+
+int
+SgUnknownFile::callFrontEnd()
+   {
+     abort(); 
+     return 0;
+   }
+
+SgBinaryFile::SgBinaryFile ( vector<string> & argv ,  SgProject* project )
 // : SgFile (argv,errorCode,fileNameIndex,project)
    {
      p_binaryFile = NULL;
@@ -2850,7 +2927,7 @@
   // printf ("In the SgBinaryFile constructor \n");
 
   // This constructor actually makes the call to EDG to build the AST (via callFrontEnd()).
-     doSetupForConstructor(argv, errorCode, fileNameIndex, project);
+     doSetupForConstructor(argv,  project);
    }
 
 
@@ -2930,17 +3007,9 @@
 
             // printf ("currentFileName = %s \n",currentFileName.c_str());
 
-               if (isBinaryExecutableFile(currentFileName) == true)
-                  {
-                 // printf ("This is a binary file so building a SgBinaryFile IR node! \n");
-                    newFile = new SgBinaryFile ( argv, nextErrorCode, 0, this );
-                  }
-                 else
-                  {
-                 // printf ("This is NOT a binary file so building a SgSourceFile IR node! \n");
-                    newFile = new SgSourceFile ( argv, nextErrorCode, 0, this );
-                  }
 
+               newFile = determineFileType(argv, nextErrorCode, this);
+               
                ROSE_ASSERT (newFile != NULL);
 
             // printf ("In SgProject::parse(): newFile = %p = %s \n",newFile,newFile->class_name().c_str());
@@ -3005,6 +3074,7 @@
      return errorCode;
    }
 
+#if 0
 void
 SgFile::doSetupForConstructor(const vector<string>& argv, int& errorCode, int fileNameIndex, SgProject* project)
    {
@@ -3049,8 +3119,37 @@
      ROSE_ASSERT(get_parent() != NULL);
 
   // DQ (4/21/2006): Setup the source filename as early as possible
-     setupSourceFilename(argv);
+     //setupSourceFilename(argv);
 
+     Rose_STL_Container<string> fileList = CommandlineProcessing::generateSourceFilenames(argv);
+
+     // this->display("In SgFile::setupSourceFilename()");
+     // printf ("listToString(argv) = %s \n",StringUtility::listToString(argv).c_str());
+     // printf ("listToString(fileList) = %s \n",StringUtility::listToString(fileList).c_str());
+
+     if (fileList.empty() == false)
+     {
+
+       string sourceFilename = *(fileList.begin());
+
+       // printf ("Before conversion to absolute path: sourceFilename = %s \n",sourceFilename.c_str());
+
+       // sourceFilename = StringUtility::getAbsolutePathFromRelativePath(sourceFilename);
+       sourceFilename = StringUtility::getAbsolutePathFromRelativePath(sourceFilename, true);
+
+       set_sourceFileNameWithPath(sourceFilename);
+
+       //printf ("In SgFile::setupSourceFilename(const vector<string>& argv): p_sourceFileNameWithPath = %s \n",get_sourceFileNameWithPath().c_str());
+
+
+       set_sourceFileNameWithoutPath( ROSE::stripPathFromFileName(get_sourceFileNameWithPath().c_str()) );
+       get_file_info()->set_filenameString( get_sourceFileNameWithPath() );
+     }else{
+       //A file should never be created without a filename so this branch should be impossible
+       abort();
+     }
+
+     
 #if 1
   // DQ (9/5/2008): Handle the case that this is a SgSourceFile.  This is awkward code, and may be a temporary fix.
      const SgSourceFile* sourceFile = isSgSourceFile(this);
@@ -3066,6 +3165,8 @@
 
        // p_root->get_file_info()->set_filenameString(p_sourceFileNameWithPath);
        // ROSE_ASSERT(p_root->get_file_info()->get_filenameString().empty() == false);
+
+
           sourceFile->get_globalScope()->get_startOfConstruct()->set_filenameString(p_sourceFileNameWithPath);
           ROSE_ASSERT(sourceFile->get_globalScope()->get_startOfConstruct()->get_filenameString().empty() == false);
 
@@ -3151,15 +3252,20 @@
           get_skipfinalCompileStep() ? "true" : "false");
 #endif
 
-#if 1
+
+#if 0
+  //AS(10/04/08) Removed code because of refactoring into determineFileType(..). callFrontEnd relies on all
+  //the appropriate flags being set first.
+
   // DQ (10/16/2005): Modified to make clear that argc and argv are not modified
   // Call the EDG fron-end to generate the abstract syntax tree
   // int EDG_FrontEndErrorCode = callFrontEnd ( argc, argv, *this, fileNameIndex );
   // int EDG_FrontEndErrorCode = callFrontEnd (  local_commandLineArgumentList, *this, fileNameIndex );
   // int EDG_FrontEndErrorCode = callFrontEnd (  local_commandLineArgumentList );
   // int EDG_FrontEndErrorCode = callFrontEnd();
-     int EDG_FrontEndErrorCode = callFrontEnd();
 
+     int EDG_FrontEndErrorCode =  get_sourceFileTypeIsUnknown() == false ? callFrontEnd() : 0 ;
+
   // Warning from EDG processing are OK but not errors
      ROSE_ASSERT (EDG_FrontEndErrorCode <= 3);
 
@@ -3179,33 +3285,14 @@
   // ROSE_ASSERT (localfileInfo != NULL);
   // set_file_info(localfileInfo);
 
-#if 0
-  // DQ (9/5/2008): This was easier to move to the constructor for SgSourceFile
 
-  // DQ (10/15/2005): This has not been converted to a C++ string!
-  // DQ (5/24/2005): Now fixup the file info's file name in the global scope!
-  // printf ("In SgFile::doSetupForConstructor p_sourceFileNamesWithPath[%d] = %s \n",fileNameIndex,p_sourceFileNamesWithPath[fileNameIndex]);
-  // p_root->get_file_info()->set_filename(p_sourceFileNamesWithPath[fileNameIndex]);
 
-  // DQ (1/22/2008): This should have been set above!
-  // p_root->get_file_info()->set_filenameString(p_sourceFileNameWithPath);
-
-  // DQ (1/21/2008): This must be set for all languages
-     ROSE_ASSERT(p_root != NULL);
-     ROSE_ASSERT(p_root->get_file_info() != NULL);
-     ROSE_ASSERT(p_root->get_file_info()->get_filenameString().empty() == false);
-  // printf ("p_root->get_file_info()->get_filenameString() = %s \n",p_root->get_file_info()->get_filenameString().c_str());
-#endif
-
   // DQ (1/18/2006): Set the filename in the SgFile::p_file_info
      ROSE_ASSERT(get_file_info() != NULL);
      get_file_info()->set_filenameString(p_sourceFileNameWithPath);
 
-#if 0
-     printf ("In SgFile::doSetupForConstructor(): get_skipfinalCompileStep() = %s \n",
-          get_skipfinalCompileStep() ? "true" : "false");
-#endif
 
+
   // DQ (5/3/2007): Added assertion.
      ROSE_ASSERT (get_startOfConstruct() != NULL);
 
@@ -3219,6 +3306,140 @@
 #endif // USE_ROSE_OPEN_FORTRAN_PARSER_SUPPORT
    }
 
+
+#endif
+
+
+void
+SgSourceFile::doSetupForConstructor(const vector<string>& argv, SgProject* project)
+   {
+
+     SgFile::doSetupForConstructor(argv, project);
+     
+     // DQ (1/21/2008): Set the filename in the SgGlobal IR node so that the traversal to add CPP directives and comments will succeed.
+     ROSE_ASSERT (get_globalScope() != NULL);
+     ROSE_ASSERT(get_globalScope()->get_startOfConstruct() != NULL);
+
+     // DQ (8/21/2008): Modified to make endOfConstruct consistant (avoids warning in AST consistancy check).
+     // ROSE_ASSERT(p_root->get_endOfConstruct()   == NULL);
+     ROSE_ASSERT(get_globalScope()->get_endOfConstruct()   != NULL);
+
+     // p_root->get_file_info()->set_filenameString(p_sourceFileNameWithPath);
+     // ROSE_ASSERT(p_root->get_file_info()->get_filenameString().empty() == false);
+
+
+     get_globalScope()->get_startOfConstruct()->set_filenameString(p_sourceFileNameWithPath);
+     ROSE_ASSERT(get_globalScope()->get_startOfConstruct()->get_filenameString().empty() == false);
+
+     // DQ (8/21/2008): Uncommented to make the endOfConstruct consistant (avoids warning in AST consistancy check).
+     get_globalScope()->get_endOfConstruct()->set_filenameString(p_sourceFileNameWithPath);
+     ROSE_ASSERT(get_globalScope()->get_endOfConstruct()->get_filenameString().empty() == false);
+
+     
+   }
+
+void
+SgBinaryFile::doSetupForConstructor(const vector<string>& argv, SgProject* project)
+   {
+       SgFile::doSetupForConstructor(argv, project);
+
+   }
+
+void
+SgUnknownFile::doSetupForConstructor(const vector<string>& argv, SgProject* project)
+   {
+       SgFile::doSetupForConstructor(argv, project);
+
+   }
+
+void
+SgFile::doSetupForConstructor(const vector<string>& argv, SgProject* project)
+   {
+
+  // JJW 10-26-2007 ensure that this object is not on the stack
+     preventConstructionOnStack(this);
+
+
+  // Set the project early in the construction phase so that we can access data in 
+  // the parent if needed (useful for template handling but also makes sure the parent is
+  // set (and avoids fixup (currently done, but too late in the construction process for 
+  // the template support).
+     if (project != NULL)
+          set_parent(project);
+
+     ROSE_ASSERT (project != NULL);
+
+     ROSE_ASSERT(get_parent() != NULL);
+
+
+  // initalize all local variables to default values
+     initialization();
+
+     ROSE_ASSERT(get_parent() != NULL);
+
+  // DQ (4/21/2006): Setup the source filename as early as possible
+     //setupSourceFilename(argv);
+
+     Rose_STL_Container<string> fileList = CommandlineProcessing::generateSourceFilenames(argv);
+
+
+     if (fileList.empty() == false)
+     {
+
+       string sourceFilename = *(fileList.begin());
+
+       // printf ("Before conversion to absolute path: sourceFilename = %s \n",sourceFilename.c_str());
+
+       // sourceFilename = StringUtility::getAbsolutePathFromRelativePath(sourceFilename);
+       sourceFilename = StringUtility::getAbsolutePathFromRelativePath(sourceFilename, true);
+
+       set_sourceFileNameWithPath(sourceFilename);
+
+       //printf ("In SgFile::setupSourceFilename(const vector<string>& argv): p_sourceFileNameWithPath = %s \n",get_sourceFileNameWithPath().c_str());
+
+
+       set_sourceFileNameWithoutPath( ROSE::stripPathFromFileName(get_sourceFileNameWithPath().c_str()) );
+       get_file_info()->set_filenameString( get_sourceFileNameWithPath() );
+     }else{
+       //A file should never be created without a filename so this branch should be impossible
+       abort();
+     }
+
+     
+  // DQ (5/9/2007): Moved this call from above to where the file name is available so that we could include 
+  // the filename in the label.  This helps to identify the performance data with individual files where
+  // multiple source files are specificed on the command line.
+  // printf ("p_sourceFileNameWithPath = %s \n",p_sourceFileNameWithPath);
+     string timerLabel = "AST SgFile Constructor for " + p_sourceFileNameWithPath + ":";
+     TimingPerformance timer (timerLabel);
+
+  // Build a DEEP COPY of the input parameters!
+     vector<string> local_commandLineArgumentList = argv;
+
+  // Save the commandline as a list of strings (we made a deep copy because the "callFrontEnd()" function might change it!
+     set_originalCommandLineArgumentList( local_commandLineArgumentList );
+
+  // DQ (5/22/2005): Store the file name index in the SgFile object so that it can figure out 
+  // which file name applies to it.  This helps support functions such as "get_filename()" 
+  // used elsewhere in Sage III.  Not clear if we really need this!
+  // error checking
+     ROSE_ASSERT (argv.size() > 1);
+
+  // DQ (1/18/2006): Set the filename in the SgFile::p_file_info
+     ROSE_ASSERT(get_file_info() != NULL);
+     get_file_info()->set_filenameString(p_sourceFileNameWithPath);
+
+
+
+  // DQ (5/3/2007): Added assertion.
+     ROSE_ASSERT (get_startOfConstruct() != NULL);
+
+
+   }
+
+
+
+
 #if 1
 #define CASE_SENSITIVE_SYSTEM 1
 
@@ -3780,6 +4001,10 @@
                          frontendErrorLevel = binaryFile->buildAST(argv,inputCommandLine);
                          break;
                        }
+                    case V_SgUnknownFile:
+                       {
+                         break;
+                       }
 
                     default:
                        {

Modified: trunk/src/midend/abstractHandle/loopAdapter.cpp
===================================================================
--- trunk/src/midend/abstractHandle/loopAdapter.cpp	2008-11-04 21:05:45 UTC (rev 115)
+++ trunk/src/midend/abstractHandle/loopAdapter.cpp	2008-11-05 21:05:34 UTC (rev 116)
@@ -10,8 +10,9 @@
 using namespace std;
 using namespace AbstractHandle;
 
-// an internal map to avoid duplicated nodes for a same file
+// an internal map to avoid duplicated nodes 
 map<string, abstract_node*> file_node_map;
+map<MyLoop*, abstract_node*> loop_node_map;
 
 /* Only handle for loops
 * */
@@ -31,12 +32,20 @@
  return getNode()->sourceFileName;
 }
 
-/* Assume MyLoop only works for flat list of loops, no real parent-child relation 
- * but file node can be treated as their parent here
+/* 
  * */
 abstract_node* loopNode::getParent() const
 {
-  return getFileNode();
+  if (getNode()->parent!=NULL)
+  {
+    abstract_node* result = loop_node_map[getNode()->parent];
+    if (result == NULL)
+      return new loopNode(getNode()->parent);
+    else
+      return result;
+  }
+  else
+    return getFileNode();
 }
 
 /* 
@@ -46,7 +55,10 @@
 {
  abstract_node* filenode = file_node_map[getNode()->sourceFileName];
  if (filenode==NULL)
+ {
    filenode = new fileNode (getNode()->sourceFileName);
+   file_node_map[getNode()->sourceFileName]=filenode;
+ }
  return filenode;
 }
 
@@ -124,7 +136,8 @@
 std::string loopNode::toString() const
 {
   std::string result;
-  result= getNode()->loop_code;
+  //We ignore this for simplicity
+  //result= getNode()->loop_code;
   return result;
 }
 

Modified: trunk/src/midend/abstractHandle/myloop.h
===================================================================
--- trunk/src/midend/abstractHandle/myloop.h	2008-11-04 21:05:45 UTC (rev 115)
+++ trunk/src/midend/abstractHandle/myloop.h	2008-11-05 21:05:34 UTC (rev 116)
@@ -12,8 +12,8 @@
 public:  
   std::string sourceFileName;
   size_t line_number;
-  std::string loop_code;
   std::vector<MyLoop*> children; 
+  MyLoop* parent;
 };
 
 #endif

Modified: trunk/src/midend/abstractHandle/testMyLoop.cpp
===================================================================
--- trunk/src/midend/abstractHandle/testMyLoop.cpp	2008-11-04 21:05:45 UTC (rev 115)
+++ trunk/src/midend/abstractHandle/testMyLoop.cpp	2008-11-05 21:05:34 UTC (rev 116)
@@ -10,31 +10,30 @@
 
 int main()
 {
+  //-------------Preparing the internal loop representation---------
   // declare and initialize a list of loops using MyLoop  
+  // The loop tool should be able to generate its representation from 
+  // source code somehow. We fill it up manually here. 
   vector <MyLoop* > loops;
 
   MyLoop loop1, loop2, loop3;
-
   loop1.sourceFileName="file1.c";
   loop1.line_number = 7;
-  loop1.loop_code = "for (i=0;i<100;i++) \n ";
-
-  loop3.sourceFileName="file1.c";
-  loop3.line_number = 8;
-  loop3.loop_code = "for (j=0;j<100;j++) \n a[i][j]=0;";
-  loop1.children.push_back(&loop3);
-
+  loop1.parent = NULL;
   loop2.sourceFileName="file1.c";
-  loop2.line_number = 12;
-  loop2.loop_code = "for (i=0;i<100;i++) \n b[i]=0;";
-
+  loop2.line_number = 8;
+  loop2.parent=&loop1;
+  loop1.children.push_back(&loop2);
+  loop3.sourceFileName="file1.c";
+  loop3.line_number = 12;
+  loop3.parent=NULL;
   loops.push_back(&loop1);
-  loops.push_back(&loop2);
+  loops.push_back(&loop3);
 
+  //------------------ using abstract handles-------------
   //Generate the abstract handle  for the source file
   fileNode* filenode = new fileNode("file1.c");
   filenode->setMLoops(loops);
- 
   abstract_handle* file_handle = new abstract_handle(filenode);
   cout<<"Created a file handle:"<<endl<<file_handle->toString()<<endl;
 

Modified: trunk/src/midend/astRewriteMechanism/rewriteMidLevelInterfaceTemplatesImpl.h
===================================================================
--- trunk/src/midend/astRewriteMechanism/rewriteMidLevelInterfaceTemplatesImpl.h	2008-11-04 21:05:45 UTC (rev 115)
+++ trunk/src/midend/astRewriteMechanism/rewriteMidLevelInterfaceTemplatesImpl.h	2008-11-05 21:05:34 UTC (rev 116)
@@ -333,7 +333,11 @@
 
   // We need the lifetime to be extended beyond that of this function (to avoid purify error)
   // SgFile transformationAST (transformation_argc,transformation_argv,errorCode);
-     SgSourceFile* transformationASTPointer = new SgSourceFile (transformation_argv,errorCode, 0, project);
+     //AS(10/04/08) Because it is hard to get all the initializations correct without doing determine file type we now require the
+     //calling of the constructor directly to create the AST
+  //   SgSourceFile* transformationASTPointer = new SgSourceFile (transformation_argv,errorCode, 0, project);
+     SgSourceFile* transformationASTPointer = isSgSourceFile(determineFileType(transformation_argv, errorCode, project));
+
      ROSE_ASSERT (transformationASTPointer != NULL);
      ROSE_ASSERT (errorCode <= 2);
 
@@ -407,6 +411,7 @@
   // specification via strings.
      NodeCollectionType dataCollection = synthesizedAttribute.treeFragementListArray;
 
+
   // Error checking
      bool notAnEmptyContainer = false;
      for (unsigned int i=0; i < dataCollection.size(); i++)
@@ -414,8 +419,12 @@
           if (dataCollection[i].size() > 0)
                notAnEmptyContainer = true;
         }
-     ROSE_ASSERT (notAnEmptyContainer == true);
 
+    
+     std::cout << "AST NODE " << astNode->class_name() << std::endl;
+     
+     ROSE_ASSERT (notAnEmptyContainer == true || isSgUnknownFile(astNode) != NULL );
+
      return dataCollection;
    }
 

Modified: trunk/src/midend/astUtil/astInterface/AstInterface.C
===================================================================
--- trunk/src/midend/astUtil/astInterface/AstInterface.C	2008-11-04 21:05:45 UTC (rev 115)
+++ trunk/src/midend/astUtil/astInterface/AstInterface.C	2008-11-05 21:05:34 UTC (rev 116)
@@ -625,7 +625,10 @@
 
   // Build the AST
   // std::cerr << "generating declaration: \n";
-     SgSourceFile* addDecls = new SgSourceFile(argv, error);
+     //SgSourceFile* addDecls = new SgSourceFile(argv, error);
+     //AS (10/04/08) using factory function to determine file type. This is due to
+     //cleanup of ROSE code
+     SgSourceFile* addDecls = isSgSourceFile(determineFileType(argv,error,0));
   // std::cerr << "Finished generating declaration \n";
 
   // system( "rm _astInterface_Tmp.c");

Modified: trunk/tests/roseTests/programTransformationTests/finiteDifferencingDemo.C
===================================================================
--- trunk/tests/roseTests/programTransformationTests/finiteDifferencingDemo.C	2008-11-04 21:05:45 UTC (rev 115)
+++ trunk/tests/roseTests/programTransformationTests/finiteDifferencingDemo.C	2008-11-05 21:05:34 UTC (rev 116)
@@ -29,7 +29,7 @@
 
 vector<SgFunctionDefinition*> functions;
 
-class FindFunctionsVisitor: public AstSimpleProcessing {
+class FindFunctionsVis: public AstSimpleProcessing {
   public:
   virtual void visit(SgNode* n) {
     if (isSgFunctionDefinition(n)) {
@@ -53,7 +53,7 @@
   sageProject = isSgProject(tempProject);
   ROSE_ASSERT (sageProject);
 
-  FindFunctionsVisitor().traverse(sageProject, preorder);
+  FindFunctionsVis().traverse(sageProject, preorder);
 
   for (unsigned int x = 0; x < functions.size(); ++x) {
     SgBasicBlock* body = functions[x]->get_body();

Modified: trunk/tutorial/abstractHandle2.cpp
===================================================================
--- trunk/tutorial/abstractHandle2.cpp	2008-11-04 21:05:45 UTC (rev 115)
+++ trunk/tutorial/abstractHandle2.cpp	2008-11-05 21:05:34 UTC (rev 116)
@@ -20,19 +20,19 @@
 
   // Generate a file handle from the first file of the project
   abstract_node* file_node= new roseNode((project->get_fileList())[0]);
-  abstract_handle* handle1 = new abstract_handle(file_node);
-  cout<<"Created a file handle:\n"<<handle1->toString()<<endl<<endl;;
+  abstract_handle* handle0 = new abstract_handle(file_node);
+  cout<<"Created a file handle:\n"<<handle0->toString()<<endl<<endl;;
 
   //Create a handle to a namespace given its name and parent handle 
-  string input1("NamespaceDeclarationStatement<name,space1>");
-  abstract_handle* handle0 = new abstract_handle(handle1,input1);
-  cout<<"Created a handle:\n"<<handle0->toString()<<endl<<endl;
-  cout<<"It points to:\n"<<handle0->getNode()->toString()<<endl<<endl;
+  string input1="NamespaceDeclarationStatement<name,space1>";
+  abstract_handle* handle1 = new abstract_handle(handle0,input1);
+  cout<<"Created a handle:\n"<<handle1->toString()<<endl<<endl;
+  cout<<"It points to:\n"<<handle1->getNode()->toString()<<endl<<endl;
 
   // Create a handle within the file, given a string specifying  
   // its construct type (class declaration) and source position 
-  string input("ClassDeclaration<position,4.3-9.2>");
-  abstract_handle* handle2 = new abstract_handle(handle1,input);
+  string input="ClassDeclaration<position,4.3-9.2>";
+  abstract_handle* handle2 = new abstract_handle(handle0,input);
 
   cout<<"Created a handle:\n"<<handle2->toString()<<endl<<endl;
   cout<<"It points to:\n"<<handle2->getNode()->toString()<<endl<<endl;;



More information about the Rose-commits mailing list