Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(Jovial) Moved SgJovialBitVal to Rosebud and regenerated code
Here's the steps for moving a Jovial AST node definition from ROSETTA to Rosebud, assuming the class is named "SgJovialFoo": 1. Create the file src/AstNodes/Jovial/SgJovialFoo.h. In this file, declare the class with the proper base class. Standard ROSE header files are included automatically, but you might need to include more. See examples in src/AstNodes/BinaryAnalysis/*.h. `class SgJovialFoo: public SgWhatever {` 2. Search for "JovialFoo" (the class name without the leading "Sg") in src/ROSETTA/src/*.C. You'll find a smattering of things scattered all over the place. Copy these things to the new SgJovialFoo.h file as follows: a. `NEW_TERMINAL_MACRO(JovialFoo, "JovialFoo", "SOME_TAG");` Remove this line. It is not needed. The "SOME_TAG" string will always be generated as "JovialFooTag". b. `JovialFoo` in the NEW_NONTERMINAL_MACRO for the base class. Replace `JovialFoo` with `*lookupTerminal(terminalList, "JovialFoo")` c. Calls to "setFunctionSource", "setFunctionPrototype", "setDataPrototype", and "editSubstitute". If the indicated text to copy is empty, delete this line. If the indicated text is for the SgJovialFoo class definition and is copied verbatim by ROSETTA (no substitutions) then move it to the new SgJovialFoo.h file. If the indicated text is for an SgJovialFoo member definition (i.e., a member function implementation) and is copied verbatim by ROSETTA, then move it to a new SgJovialFoo.C file somewhere under the $ROSE/src directory. There's no reason it needs to be copied by ROSETTA. In other cases, when ROSETTA does text substitutions during the copy, my experience has been that all this junk could have been designed using C++ directly (virtual dispatch, template metaprogramming, introspection) instead of being generated. But since that's an improvement for another day, the temporary solution is to add `#pragma rosetta ...` to the new SgJovialFoo.h file. The "..." part is everything after "JovialFoo." Example: `JovialFoo.setFunctionSource("X","Y");` will become `#pragma rosetta setFunctionSource("X","Y")`. The trailing semicolon is optional and usually omitted in pragmas. 3. Regenerate files. See $ROSE/src/generated/README.md. In short, go to $ROSE_BUILD/src/Rosebud and run $ROSE_SOURCE/src/Rosebud/generate ./rosebud 4. Build like normal. For `make` this probably means you'll need to do a `make clean` first. More modern build systems handle things automatically. If you want to do this for nodes other than Jovial or BinaryAnalysis, see the previous commit for how Jovial was set up and do something similar. RPM-395
- Loading branch information