.. java:import:: fr.inria.tapenade.representation AlignmentBoundary .. java:import:: fr.inria.tapenade.representation Block .. java:import:: fr.inria.tapenade.representation CallGraph .. java:import:: fr.inria.tapenade.representation CompositeTypeSpec .. java:import:: fr.inria.tapenade.representation FGArrow .. java:import:: fr.inria.tapenade.representation FunctionDecl .. java:import:: fr.inria.tapenade.representation FunctionTypeSpec .. java:import:: fr.inria.tapenade.representation ILUtils .. java:import:: fr.inria.tapenade.representation Instruction .. java:import:: fr.inria.tapenade.representation InterfaceDecl .. java:import:: fr.inria.tapenade.representation PointerTypeSpec .. java:import:: fr.inria.tapenade.representation PositionAndMessage .. java:import:: fr.inria.tapenade.representation SymbolDecl .. java:import:: fr.inria.tapenade.representation SymbolTable .. java:import:: fr.inria.tapenade.representation SymbolTableConstants .. java:import:: fr.inria.tapenade.representation TapEnv .. java:import:: fr.inria.tapenade.representation TapList .. java:import:: fr.inria.tapenade.representation TypeDecl .. java:import:: fr.inria.tapenade.representation TypeSpec .. java:import:: fr.inria.tapenade.representation Unit .. java:import:: fr.inria.tapenade.representation VariableDecl .. java:import:: fr.inria.tapenade.representation WrapperTypeSpec .. java:import:: fr.inria.tapenade.utils BoolVector .. java:import:: fr.inria.tapenade.utils ILLang .. java:import:: fr.inria.tapenade.utils TapPair .. java:import:: fr.inria.tapenade.utils TapTriplet .. java:import:: fr.inria.tapenade.utils ToBool .. java:import:: fr.inria.tapenade.utils Tree TreeGen ======= .. java:package:: fr.inria.tapenade.ir2tree :noindex: .. java:type:: public final class TreeGen Tree regeneration from internal representation (CallGraph, Unit). Methods ------- addHeader ^^^^^^^^^ .. java:method:: public static void addHeader(Tree tree, int language, String versionString) :outertype: TreeGen Place the comment "Generated by Tapenade" on top of tree. addSymbolDeclStructs ^^^^^^^^^^^^^^^^^^^^ .. java:method:: public static TapList addSymbolDeclStructs(SymbolDecl symbolDecl, TapList declStructs, SymbolTable publicSymbolTable, Block insertInBlock, Tree generatedTree) :outertype: TreeGen addUseDiffSizesAndUserHelp ^^^^^^^^^^^^^^^^^^^^^^^^^^ .. java:method:: public static void addUseDiffSizesAndUserHelp(Tree unitTree, TapList unitUserHelpStrings, int language) :outertype: TreeGen Inserts into unitTree the "USE" or "include" of the DIFFSIZE utility file, annotated with the hints that tell the user what to add into this file. :param unitTree: the op_blockStatement Tree that contains the code that must receive this "USE" or "include". cleanBeforeGenerate ^^^^^^^^^^^^^^^^^^^ .. java:method:: public static void cleanBeforeGenerate(CallGraph callGraph) :outertype: TreeGen Do some necessary cleanup in callGraph before regenerating a Tree for it. In particular, insert the new Blocks for the new declarations if necessary, change remaining "if"s that are indeed vectorial into "where"s, replace back Fortran style pointer notation. generate ^^^^^^^^ .. java:method:: public static Tree generate(Unit unit, boolean forwardDeclaration, boolean isInterface, boolean skipSubUnits, TapList> toFutureIncludes, TapList fileUserHelpStrings) :outertype: TreeGen Regenerates the Tree corresponding to the given Unit. :param skipSubUnits: (used only for file Units) when true, sub-Unit definitions are not generated. :param toFutureIncludes: a (hatted) list, initially empty, collecting the future contents of the future re-generated include files. :param fileUserHelpStrings: a (hatted) list of Tree, initially empty, in which generate() will collect all variables that the user is required to define in DIFFSIZES.?. The calling function is then supposed to use this list to effectively build and place the "USE" or "include" of DIFFSIZES.? If on the other hand this argument is passed null, then this generate() takes care of building and placing this "USE" or "include". :return: null or the regenerated Tree, always with head operator op_blockStatement. generateGlobalDeclarations ^^^^^^^^^^^^^^^^^^^^^^^^^^ .. java:method:: public static boolean generateGlobalDeclarations(CallGraph callGraph, TapList> toFutureIncludes, TapList fileUserHelpStrings, Tree fileTree, int lang, boolean addTranslationUnitDeclarations) :outertype: TreeGen Regenerates into fileTree all global declarations found in callGraph. //[llh 20Jun2018 maybe no more?] This includes the C-style forward declarations of procedures. :return: true if some global declarations were effectively added (not counting include's). generateInclude ^^^^^^^^^^^^^^^ .. java:method:: public static TapList> generateInclude(TapList> toFutureIncludes, String versionString) :outertype: TreeGen Reorders the collected information about instructions that must be regenerated into include files. :param toFutureIncludes: the given info about instructions that go in include files, that has been collected during TreeGen.generate() and similar :return: the list of the contents of all include files that must be generated. This is a list, for each future generated include file, of triplets (Tree "includeFileCommand", Tree "includeFileContents", int "includeLanguage"). generateMissingDeclarations ^^^^^^^^^^^^^^^^^^^^^^^^^^^ .. java:method:: protected static TapList> generateMissingDeclarations(Unit forUnit, SymbolTable symbolTable, boolean globalDecls, boolean inPublicSymbolTable, Block insertInBlock, boolean traceThisUnit) :outertype: TreeGen Regenerates a declaration for each SymbolDecl in the given "symbolTable" of "forUnit" that still has no associated declaration instruction in "forUnit". :return: the list of regenerated missing declarations, each one paired with the SymbolDecl it declares. generateReverseListOfTree ^^^^^^^^^^^^^^^^^^^^^^^^^ .. java:method:: protected static TapList generateReverseListOfTree(Block block, TapList> toFutureIncludes, TapList fileUserHelpStrings, boolean addOnlyPublicDeclForInterface) :outertype: TreeGen insertInstructionWatchingIncludes ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ .. java:method:: public static TapList insertInstructionWatchingIncludes(Instruction instruction, TapList tlNewInsts, boolean onSourceUnit, TapList>> toIncludesBeingBuilt, TapList> toFutureIncludes) :outertype: TreeGen Inserts the given instruction at the tail of the produced code. When the given instruction is not marked as belonging to an include file, instruction is added at the tail of the given tlNewInsts, and then method returns the new tail of tlNewInsts. Otherwise, when given instruction is inside an include file, adds it inside "toFutureIncludes", as the tail of the contents of the corresponding include file. Takes care of adding the intermediate include statements when instruction is in a chain of nested includes. When the same include file is encountered twice, keeps only one copy of the include file contents, and sends a message when the two copies differ. :param instruction: the given instruction to be added. Pass null to force flush of pending #include commands. :param toIncludesBeingBuilt: the hatted list of the include files currently being built, (i.e. those enclosing the given instruction), deepest include first, each one with its present contents as "being built". :return: the new tail of the instructions of the future Block.