KolesnichenkoDS KolesnichenkoDS - 3 months ago 25
C++ Question

What these macros do (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
X
,
Y
,
Z
macros do and I cannot find any definition or documentation for them.

Answer

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.