Search code examples
c++compiler-constructionllvm

What do the X(), Y() and Z() macros do in LLVM?


I found this code in Sparc LLVM backend:

extern "C" void LLVMInitializeSparcTargetInfo() {
  RegisterTarget<Triple::sparc, /*HasJIT=*/true> X(TheSparcTarget, "sparc",
                                                   "Sparc");
  RegisterTarget<Triple::sparcv9, /*HasJIT=*/true> Y(TheSparcV9Target,
                                                     "sparcv9", "Sparc V9");
  RegisterTarget<Triple::sparcel, /*HasJIT=*/true> Z(TheSparcelTarget,
                                                     "sparcel", "Sparc LE");
}

I don't understand what these X, Y, Z macros do and I cannot find any definition or documentation for them.


Solution

  • What makes you think that these are macros?

    To me, X, Y and Z look like throwaway names for instantiation of registration objects.

    You should instead be looking for the documentation of RegisterTarget.