This is an archive of the discontinued LLVM Phabricator instance.

In TargetParser, disallow duplicate CPU names. (NFC)
Needs RevisionPublic

Authored by tyomitch on Nov 17 2015, 2:41 PM.

Details

Reviewers
rengolin
Summary

Allowing the same CPU to be listed multiple times, possibly
with different architectures and features every time, and
making the table lookups depend on the order of the entries,
is a maintenance nightmare.

This patch also adds a compile-time check for duplicate or empty names.

Diff Detail

Event Timeline

tyomitch updated this revision to Diff 40438.Nov 17 2015, 2:41 PM
tyomitch retitled this revision from to In TargetParser, disallow duplicate CPU names. (NFC).
tyomitch updated this object.
tyomitch added a reviewer: rengolin.
tyomitch added a subscriber: llvm-commits.
rengolin requested changes to this revision.Nov 18 2015, 3:52 AM
rengolin edited edge metadata.
rengolin added inline comments.
lib/Support/TargetParser.cpp
106

Removing the comment without addressing the problem is not a fix.

577

I'd rather move to table-gen, which can guarantee correctness in the table-gen back-end, than adding this code.

This revision now requires changes to proceed.Nov 18 2015, 3:52 AM
tyomitch added inline comments.Nov 18 2015, 3:56 AM
lib/Support/TargetParser.cpp
106

I don't see what you mean here: I'm removing the comment which becomes false with this patch; and I'm keeping the FiXME: which remains relevant.

577

I agree that this code is a stop-gap before a table-gen implementation arrives; but I believe it's better than no consistency checks at all.

Ping?

The two changes this patch depended on were both committed last week, so hopefully we can now proceed with this one, too.

Ping?

The two changes this patch depended on were both committed last week, so hopefully we can now proceed with this one, too.

That's from three weeks ago now...

Now that both ARM and AArch64 target parsers are implemented, we can follow to a table-gen driven design.

If you still want to have that stop-gap code, move it to a unit test.