This is an archive of the discontinued LLVM Phabricator instance.

[AVR] Allow specifying the CPU on the command line
ClosedPublic

Authored by dylanmckay on Jan 5 2017, 12:06 AM.

Details

Summary

This tells clang about all of the different AVR microcontrollers.

It also adds code to define the correct preprocessor macros for each
device.

Diff Detail

Repository
rL LLVM

Event Timeline

dylanmckay updated this revision to Diff 83198.Jan 5 2017, 12:06 AM
dylanmckay retitled this revision from to [AVR] Allow specifying the CPU on the command line.
dylanmckay updated this object.
dylanmckay added a reviewer: jroelofs.
dylanmckay added a subscriber: cfe-commits.
jroelofs edited edge metadata.Jan 5 2017, 6:28 AM

Testcase?

dylanmckay updated this revision to Diff 83496.Jan 6 2017, 8:24 PM
dylanmckay edited edge metadata.

Add tests

This also defines the '__AVR' and 'AVR' values for all devices, to match what AVR-GCC does.

asl added a subscriber: asl.Feb 4 2017, 1:13 PM
asl added inline comments.
test/CodeGen/avr/target-cpu-defines/atmega328p.c
1 ↗(On Diff #83496)

This looks wrong. How you're using FileCheck? Consider dumping pre-built defines and checking the output.

test/CodeGen/avr/target-cpu-defines/attiny104.c
1 ↗(On Diff #83496)

Same issue here and in all the tests.

dylanmckay updated this revision to Diff 87172.Feb 5 2017, 3:34 PM

Clean up the tests

  • Dump all defines and search for specific ones
  • Remove some unrelated tests. I will commit them separately, as they don't actually test any behaviour modified in this change.
dylanmckay marked 2 inline comments as done.Feb 5 2017, 3:35 PM
dylanmckay added inline comments.
test/CodeGen/avr/target-cpu-defines/atmega328p.c
1 ↗(On Diff #83496)

That's a much better idea, fixed

dylanmckay marked 2 inline comments as done.Feb 5 2017, 3:35 PM
dylanmckay added a reviewer: asl.
asl accepted this revision.Feb 6 2017, 12:55 AM

LGTM with minor style nit

lib/Basic/Targets.cpp
8733 ↗(On Diff #87172)

Minor style nit: I'd prefer end() to be on prev. line (like below)

This revision is now accepted and ready to land.Feb 6 2017, 12:55 AM
This revision was automatically updated to reflect the committed changes.
dylanmckay marked an inline comment as done.