[RenderScript] Support tracking and dumping reduction kernels

Authored by ldrumm on Sep 16 2016, 4:28 AM.


[RenderScript] Support tracking and dumping reduction kernels

Initial implementation of support for tracking
RenderScript Reductions

With this patch, language renderscript module dump properly lists reductions
that are part of loaded RenderScript modules as well the the consituent
functions and their roles, within the reduction.

This support required new tracking mechanisms for the #pragma(reduce)
mechanism, and extension of RSModuleDescriptor::ParseRSInfo to support
the metadata output by bcc. This work was also an opportunity to
refactor/improve parse code:

  • RSModuleDescriptor::ParseExportReduceCount now has a complete implementation and the debugger can correctly track reductions on receipt of a module hook.
  • RSModuleDescriptor::Dump now dumps Reductions as well as ForEach kernels. Also, fixed indentation of the output, and made indentation groupings in the source clearer.
  • RSModuleDescriptor::ParseRSInfo now returns true if the ".rs.info" packet has nonzero linecount, rather than rejecting RenderScripts that don't contain kernels (an unlikely situation, but possibly valid). This was changed because scripts that only contained reductions were not being tracked in RenderScriptRuntime::LoadModule.
  • Refactor RSModuleInfo::ParseRSInfo and add reduction spec parser stub
    • Prepared ParseRSInfo to more easily be able to add new parser types
    • Use llvm::StringRef and llvm::StringMap helpers to make the parsing code cleaner
    • factor out forEachCount, globalVarCount, and pragmaCount parsing block to their own methods
    • Add ExportReduceCount Parser
    • Use llvm::StringRef in RSKernelDescriptor constructor
    • removed now superfluous MAXLINE macros as we've switched from const char * to llvm::StringRef

llvm-svn: 281717


ldrummSep 16 2016, 4:28 AM
rG49d728ad2105: [LCG] Redesign the lazy post-order iteration mechanism for the LazyCallGraph to…