This adds the AVR machine code backend (AVRAsmBackend.cpp). This will
allow us to generate machine code from assembled AVR instructions.
Details
Diff Detail
- Repository
- rL LLVM
Event Timeline
lib/Target/AVR/MCTargetDesc/AVRAsmBackend.cpp | ||
---|---|---|
38 ↗ | (On Diff #72837) | Is T ever anything other than uint64_t? Do you really need all these templates? |
250 ↗ | (On Diff #72837) | Can Ctx ever be null? You are getting it from MCAssembler that has it as a member, so it will always be there. Unless you anticipate that it won't always be available (e.g. you will call this function from another place), you could make Ctx a reference. |
lib/Target/AVR/MCTargetDesc/AVRAsmBackend.cpp | ||
---|---|---|
38 ↗ | (On Diff #72837) | I plan on moving these under a common header so that it can be shared between the AsmBackend and the LLVM linker. Seems good form to not force either user to use uint64_t, but I'm happy to remove the templates if you still think they should go. |
250 ↗ | (On Diff #72837) | We normally get the MCContext from MCAssembler but not always. When using -show-encoding with llvm-mc, fixups are adjusted but there is no accompanied MCContext, in which case we have to handle it being null. |
lib/Target/AVR/MCTargetDesc/AVRAsmBackend.cpp | ||
---|---|---|
38 ↗ | (On Diff #72837) | All of the adjustments only access the low 32 bits of the value. The target-independent MC code uses uint64_t. I don't think there is any genericity to be gained by using templates in this case. |
114 ↗ | (On Diff #72837) | Shouldn't the shift be by 18? |
Code review from Krzystof
- Fixed encoding of 'call' fixup
- Collapsed template into uint64_t
lib/Target/AVR/MCTargetDesc/AVRAsmBackend.cpp | ||
---|---|---|
114 ↗ | (On Diff #72837) | It looks like that top value was completely wrong - we were duplicating the lower 4 bits and moving it to the top. I have fixed this up so we instead grab the top 4 bits and shift it into the correct position. |