namespace llvm {
+void PrintNote(ArrayRef<SMLoc> NoteLoc, const Twine &Msg);
+
void PrintWarning(ArrayRef<SMLoc> WarningLoc, const Twine &Msg);
void PrintWarning(const char *Loc, const Twine &Msg);
void PrintWarning(const Twine &Msg);
"instantiated from multiclass");
}
+void PrintNote(ArrayRef<SMLoc> NoteLoc, const Twine &Msg) {
+ PrintMessage(NoteLoc, SourceMgr::DK_Note, Msg);
+}
+
void PrintWarning(ArrayRef<SMLoc> WarningLoc, const Twine &Msg) {
PrintMessage(WarningLoc, SourceMgr::DK_Warning, Msg);
}
Banks.push_back(Bank);
}
+ // Warn about ambiguous MIR caused by register bank/class name clashes.
+ for (const auto &Class : Records.getAllDerivedDefinitions("RegisterClass")) {
+ for (const auto &Bank : Banks) {
+ if (Bank.getName().lower() == Class->getName().lower()) {
+ PrintWarning(Bank.getDef().getLoc(), "Register bank names should be "
+ "distinct from register classes "
+ "to avoid ambiguous MIR");
+ PrintNote(Bank.getDef().getLoc(), "RegisterBank was declared here");
+ PrintNote(Class->getLoc(), "RegisterClass was declared here");
+ }
+ }
+ }
+
emitSourceFileHeader("Register Bank Source Fragments", OS);
OS << "#ifdef GET_REGBANK_DECLARATIONS\n"
<< "#undef GET_REGBANK_DECLARATIONS\n";