[Chapel Merge] Add llvm handling for basic macros used by LAPACK

Branch: refs/heads/main
Revision: 3df047a
Author: daviditen
Log Message:

Merge pull request #18160 from daviditen/llvm-macro-expand

Add llvm handling for basic macros used by LAPACK tests

[reviewed by @mppf]

When we encounter the LAPACK_GLOBAL macro add it and its clang::MacroInfo to
the LayeredValueTable. Then when processing the macros that call LAPACK_GLOBAL,
look it up in the LVT and compute the call's result using the arguments at
the call site. Add the mapping from the outer macro's name to the call's
computed forwarding result to the LVT.

When looking up a name in the LVT, check if it has a forwarded name and if
it does use that instead.

TODO:

  • Instead of looking for LAPACK macros specifically, add a function like
    canHandleMacroFn that checks if the macro is one we can currently handle.
  • Update handleCallMacro to call canHandleMacroFn.

Signed-off-by: David Iten daviditen@users.noreply.github.com

Modified Files:
M compiler/include/LayeredValueTable.h

M compiler/llvm/clangUtil.cpp

Compare: https://github.com/chapel-lang/chapel/compare/60571a055be9...3df047aa2870