This is an archive of the discontinued LLVM Phabricator instance.

[GISel] Extend code emitter to emit #undef symbol
Needs ReviewPublic

Authored by Kai on Jan 11 2022, 1:17 PM.

Details

Summary

Code snippets produced by TableGen are protected by a macro symbol.
Usually, this symbol is undefined on the top of the snippet.
The exception is the GlobalISel emitter.
This change adds the #undef to the emitter, and remove the #undefs from the targets.

Diff Detail

Event Timeline

Kai created this revision.Jan 11 2022, 1:17 PM
Kai requested review of this revision.Jan 11 2022, 1:17 PM
Herald added a project: Restricted Project. · View Herald TranscriptJan 11 2022, 1:17 PM
arsenm added inline comments.Jan 11 2022, 1:20 PM
llvm/lib/Target/AArch64/GISel/AArch64InstructionSelector.cpp
63

The target still needs to define the macro at the include point, so it feels weird to hide this away in the generated file

Kai added a comment.Jan 11 2022, 1:56 PM

In most other cases, it is done in this way. E.g. from AArch64RegisterInfo.h:

#define GET_REGINFO_HEADER
#include "AArch64GenRegisterInfo.inc"

Only the GLobalISelEmitter and the GICombineEmitter don't emit the #undef, which I found confusing.