This is an archive of the discontinued LLVM Phabricator instance.

Initial support for Hexagon target.
ClosedPublic

Authored by sidneym on Jun 5 2018, 11:05 AM.

Details

Summary

Support B22_PCREL relocation along with a simple test.

I'm also working on a llvmSupport patch that will detail the instruction set encoding. Many of Hexagon's instructions have immediates that are peppered throughout the word makeing application of fixups tedious since the same relocation fixup may need to be placed in different bits depending on the instruction. That change will be made in llvmSupport so that both lld and llvm-rtdyld can share encoding information.

Diff Detail

Repository
rLLD LLVM Linker

Event Timeline

sidneym created this revision.Jun 5 2018, 11:05 AM
ruiu added inline comments.Jun 5 2018, 11:09 AM
ELF/Arch/Hexagon.cpp
47

sizeof(uint32_t) * 8 is always 32.

78

Remove extraneous blank line. If you take a look at other files in lld, you'd notice that we normally don't add a blank line before "default:".

test/ELF/Inputs/hexagon.s
2

Remove a leading empty line.

test/ELF/hexagon.s
3

Remove extranesous space between "mc" and "-filetype"

10

Remove extraneous space characters.

sidneym updated this revision to Diff 150013.Jun 5 2018, 11:23 AM

Made the changes Rui suggested.

ruiu added inline comments.Jun 5 2018, 11:27 AM
ELF/Arch/Hexagon.cpp
48

We normally don't add const if the variable's scope is narrow.

73

We usually use much shorter variable name for a variable whose scope is very narrow. Just V would be enough for this.

75

I believe we have or32le.

sidneym updated this revision to Diff 150150.Jun 6 2018, 9:01 AM

Adopted more of Rui's suggestions.

ruiu added inline comments.Jun 6 2018, 11:27 AM
ELF/Arch/Hexagon.cpp
27

Please read other files in the same directory and follow the same naming convention. This should be named just Hexagon.

39

You don't need this assert as you are not depending on it.

51

I believe ValBit (which is bool) is promoted to int because of the usual integer promotion before << is applied, but this is perhaps a bit confusing. It is better to make their types uint32_t.

74

You don't need {} if you do not define a new variable inside {}.

sidneym updated this revision to Diff 150429.Jun 7 2018, 4:26 PM

Integrated suggested changes.

ruiu added inline comments.Jun 7 2018, 4:34 PM
ELF/Arch/Hexagon.cpp
46–47

Please do not use auto as well. As I said, if you read other code in this directory or other directories in lld, you'd notice that we normally don't use auto unless its type is obvious (i.e. to avoid a repetition like Foo *X = dyn_cast<Foo>(Y)). I'd be more careful to follow the convention by reading code first.

sidneym updated this revision to Diff 151139.Jun 13 2018, 6:10 AM

Use type instead of auto.

ruiu accepted this revision.Jun 13 2018, 10:54 AM
ruiu added inline comments.
ELF/Arch/Hexagon.cpp
42

I think it needs a comment, but I'll do that in a follow-up patch.

This revision is now accepted and ready to land.Jun 13 2018, 10:54 AM
This revision was automatically updated to reflect the committed changes.