This is an archive of the discontinued LLVM Phabricator instance.

[Utils][LoongArch](5/6) Add a --bits-endian option to extract-section.py
ClosedPublic

Authored by SixWeining on Dec 21 2021, 4:02 AM.

Details

Summary

This is a split patch of D115862 which adds a --bits-endian option to
extract-section to make it possible to print bits in specified endianness.
It means that we can print instruction encoding of some targets like LoongArch
as bits[0] to bits[31] from right to left by specifing --bits-endian little.

Diff Detail

Unit TestsFailed

Event Timeline

SixWeining requested review of this revision.Dec 21 2021, 4:02 AM
SixWeining created this revision.
Herald added a project: Restricted Project. · View Herald TranscriptDec 21 2021, 4:02 AM

delete useless debugging line

SixWeining retitled this revision from [Utils][LoongArch](5/6) Add a --endian option to extract-section.py to [Utils][LoongArch](5/6) Add a --bits-endian option to extract-section.py.Dec 22 2021, 5:00 PM
xen0n added inline comments.Dec 25 2021, 4:02 AM
llvm/utils/extract-section.py
64

Fixed grammar and punctuation: Print out bits in specified endianness (little or big); defaults to big

72

This probably should be bits_endian to agree with the addition above; while looking at the surrounding it seems tool_path should be readobj_path too. I'm not entirely sure though.

88–90

While we're at it, add a space after every comma for general PEP8 cleanness?

Reply to @xen0n

llvm/utils/extract-section.py
64

No problem. I will change that. Thanks.

72

OK, I will rename endian to bits_endian. Thanks.
As to tool_path maybe it should be renamed in a seperate patch if we are entirely sure.

88–90

Good suggestion. But seems that LLVM doesn't define a coding standard for python in https://llvm.org/docs/CodingStandards.html

address comments from @xen0n

xen0n added a comment.Jan 6 2022, 5:44 AM

My comments are all addressed, but I'm not too familiar with this piece of code, so would anyone else please take a look at this too?

myhsu accepted this revision.Feb 7 2022, 4:34 PM

LGTM.
Actually you can break the dependency with other patches in this series since this one is self-contained. But it's up to you.

This revision is now accepted and ready to land.Feb 7 2022, 4:34 PM
SixWeining edited the summary of this revision. (Show Details)Feb 7 2022, 5:32 PM

LGTM.
Actually you can break the dependency with other patches in this series since this one is self-contained. But it's up to you.

Thanks @myhsu. You're right and I have removed the dependency with other patches but keep the dependency with it's child patch (D115862).

Hi @rengolin, could we land this patch now since author of the modified file has accepted the change or we should wait other patches to be accepted and land together?

BTW, I don't have commit access yet, please help to commit the change if possible.

rengolin accepted this revision.Feb 8 2022, 3:24 AM

Sure, no problems. Let's just land all patches at once, in order, after they're all approved.

Sure, no problems. Let's just land all patches at once, in order, after they're all approved.

Hi @rengolin. Now all the 6 initial patches are approved and could you help to commit them? Thanks.

This revision was landed with ongoing or failed builds.Feb 10 2022, 2:24 AM
This revision was automatically updated to reflect the committed changes.