This is an archive of the discontinued LLVM Phabricator instance.

[AVR] Add assembly parser
ClosedPublic

Authored by dylanmckay on May 7 2016, 12:37 AM.

Details

Summary

This patch adds the AVRAsmParser library.

Diff Detail

Repository
rL LLVM

Event Timeline

dylanmckay updated this revision to Diff 56494.May 7 2016, 12:37 AM
dylanmckay retitled this revision from to [AVR] Add assembly parser.
dylanmckay updated this object.
dylanmckay added a reviewer: arsenm.
dylanmckay added a subscriber: llvm-commits.
simoncook added inline comments.
lib/Target/AVR/AsmParser/AVRAsmParser.cpp
10 ↗(On Diff #56494)

It's not clear why this line is here, I couldn't see any use of std::stringstream, std::stringbuf, etc.?

45 ↗(On Diff #56494)

I don't see this being generated. I think you're missing the -gen-asm-matcher line from your CMakeLists.txt.

Likewise, I think you're missing the has_asmparser = 1 part of LLVMBuild.txt

251 ↗(On Diff #56494)

You might want to make these two generated by TableGen comments consistent.

403 ↗(On Diff #56494)

It's not clear why you're starting a block here?

dylanmckay set the repository for this revision to rL LLVM.
dylanmckay marked 4 inline comments as done.

Code fixups from Simon Cook

dylanmckay added inline comments.Aug 26 2016, 11:05 PM
lib/Target/AVR/AsmParser/AVRAsmParser.cpp
11 ↗(On Diff #69477)

Good catch. It'll be a leftover from when I started copying from the MIPS backend. Fixed.

46 ↗(On Diff #69477)

You're right - updated that now.

kparzysz added inline comments.
lib/Target/AVR/AsmParser/AVRAsmParser.cpp
30 ↗(On Diff #69477)

Local includes usually go first and are sorted alphabetically, if there are no reasons against it.

449 ↗(On Diff #69477)

Avoid else after return. Also, the condition could be inverted and made into an early "return true".

563 ↗(On Diff #69477)

Avoid else after continue.

dylanmckay updated this revision to Diff 72780.Sep 28 2016, 1:56 AM
dylanmckay removed rL LLVM as the repository for this revision.
dylanmckay marked 5 inline comments as done.

Update code review points from Krzysztof

kparzysz accepted this revision.Sep 28 2016, 5:29 AM
kparzysz added a reviewer: kparzysz.

LGTM with one remaining inline comment.

lib/Target/AVR/AsmParser/AVRAsmParser.cpp
564 ↗(On Diff #72780)

The recommendation from the coding standards is to avoid "else" if the "then" part of an if statement cannot fall through into the following code. So, if there is "if (...) { return; } else { ... }" then the else is not necessary because the else part can only execute is the condition was false regardless of whether the else is there or not. The same applies to continue/break/goto/etc.

Seeing that you switched the code around and indeed avoided else after continue, I realize that the intent of the comment wasn't clear.

This revision is now accepted and ready to land.Sep 28 2016, 5:29 AM
dylanmckay updated this revision to Diff 72812.Sep 28 2016, 6:09 AM
dylanmckay marked an inline comment as done.
dylanmckay edited edge metadata.

Reworked early returns after else

lib/Target/AVR/AsmParser/AVRAsmParser.cpp
564 ↗(On Diff #72780)

Have fixed that up now, thanks for the clarification :)

This revision was automatically updated to reflect the committed changes.