Clean Up

If you are compiling to binary, the compiler will take care of removing unused variables, and the names of functions will no longer be relevant. If, however, you want to distribute obfuscated source (useful, for example, for simple reverse engineering exercises given to students), you may want to clean up the code prior to distributing it.

This transformations should always be the last one to be invoked.

OptionArgumentsDescription
--Transform CleanUp Transformation to run last, to clean up the generated code.
--CleanUpKinds names, annotations, constants, randomize, compress, noExterns, noMain, removeUnusedFunctions, * Specify types of cleanup to perform Default=names,annotations,constants,randomize.
  • names = Replace identifiers with less obvious ones
  • annotations = Remove annotations that Tigress uses internally. Tigress should not be called again on a file that has had annotations removed
  • constants = Fold constant expressions
  • randomize = Randomly reorder functions in the output file
  • compress = Compress the output file by removing blank lines and extra spaces
  • noExterns = Do not output any extern declarations. Instead, you must insert the corresponding #inlude files.
  • noMain = Do not outout the main() function. This can be useful if you are transforming a library, and inserted a dummy main() that should be removed.
  • removeUnusedFunctions = Remove functions not reachable from main(). Use --CleanUpRoots for functions not reachable from main, but which are still invoked spontaneously.
  • * = Same as names,annotations,constants
--CleanUpRenameKinds short, english, exebench, english2, exebench2, englishAbbr, exebenchAbbr Specify types of identifier naming to perform Default=short.
  • short = Replace identifiers with short names
  • english = Replace identifiers with English words
  • exebench = Replace identifiers with identifiers taken from the Exebench benchmark suite
  • english2 = Replace identifiers with two English words in camel case
  • exebench2 = Replace identifiers with two Exebench words in camel case
  • englishAbbr = Replace identifiers with an English word followed by a programming abbreviation in camel case
  • exebenchAbbr = Replace identifiers with an Exebench word followed by a programming abbreviation in camel case
--CleanUpDoNotRename String,String,... Do not rename these identifiers. Default=NONE.
--CleanUpDumpCallGraph BOOLSPEC Print the call graph computed during unused function removal as a .dot file. Default=False.
--CleanUpDoNotRemove String,String,... Comma-separated list of function names which should not be removed by the removeUnusedFunctions transformation. Default=NONE.
--CleanUpRoots String,String,... For the removeUnusedFunctions transformation, you can provide a comma-separated list of function names which are spontaneously called. Normally, this is just 'main', but if you have functions which are run spontaneously as threads, for example, and not directly reachable from main, include them here. Similarly for functions whose address are taken but which are never invoked directly. Default=main.