[cfe-dev] Target-specific AST rewriting (clang)

Krzysztof Parzyszek via cfe-dev cfe-dev at lists.llvm.org
Mon Mar 9 12:56:56 PDT 2020


Hi,

There are some type casts that should be replaced with intrinsics (this is Hexagon-specific). Those only occur in calls to Hexagon builtins, and right now this replacement happens as a part of clang's codegen.
However, this replacement is only triggered by types in the AST and the corresponding types in the LLVM IR, and is not dependent on the details (semantics) of any particular builtin, so I'd like to make it orthogonal to the cgbuiltin code that deals with specific intrinsics. I'd like the replacement to transform AST->AST, so the result can be easily composed with any code that does AST->LLVM IR.

Is there a precedent for something like this?  I could do this right at the beginning of EmitHexagonBuiltinExpr, but I was wondering if there was a better way.

--
Krzysztof Parzyszek  kparzysz at quicinc.com   AI tools development



More information about the cfe-dev mailing list