Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bring aarch64/codec.txt and aarch64/codec.c in order. #3067

Merged
merged 8 commits into from
Jun 27, 2018

Conversation

fhahn
Copy link
Contributor

@fhahn fhahn commented Jun 25, 2018

This is a cleanup patch order the operands in codec.txt and codec.c by
bit-patterns, as originally intended.

It also adds a script to check the order, using perl, sort and diff,
which is run as part of the encoder/decoder generation.

fhahn added 5 commits June 20, 2018 20:28
This patch adds support for the instructions in the Armv8-a
'Floating-point data-processing' encoding groups with 1 source.

Issue #2626

Change-Id: I5b4538490a161fd550396627db3f0478e95b1841
This patch adds support for the instructions in the Armv8-a
'Floating-point data-processing' encoding groups with 2 sources.

Issue #2626

Change-Id: If1dd5b3f15daabb0bea405be210da9c71904ec85
This patch adds support for the instructions in the Armv8-a
'Floating-point data-processing' encoding groups with 3 sources.

Issue #2626

Change-Id: I58112fee6bdfa7227b29cee09fc96eb7138284a7
This is a cleanup patch order the operands in codec.txt and codec.c by
bit-patterns, as originally intended.

It also adds a script to check the order, using perl, sort and diff,
which is run as part of the encoder/decoder generation.

Change-Id: Iaf0b2a38040ef7684c48e6be687eb28bcb27097e
Change-Id: Ia436ef33008aee12724bcaa1170a0612ff41075f
@fhahn fhahn requested review from egrimley and derekbruening June 26, 2018 14:59
Copy link
Contributor

@derekbruening derekbruening left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not excited about adding dependencies on UNIX utilities after we removed them all but I can live with it if it's well-labeled to avoid any new contributor copying it.


set(CODEC_TXT "${PROJECT_SOURCE_DIR}/core/arch/${ARCH_NAME}/codec.txt")

execute_process(COMMAND "${PROJECT_SOURCE_DIR}/make/aarch64_check_codec_order.sh" ${PROJECT_SOURCE_DIR}/core/arch/aarch64 ${PROJECT_BINARY_DIR}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can't rely on bash being available on Windows -- but I guess this will never be run on Windows. I think a if (WIN32) message(FATAL_ERROR... would make this clear.

OUTPUT_VARIABLE CHECK_MSG)

if (CHECK_RC)
message(FATAL_ERROR "Wrong order in codec.txt or codec.c: ${CHECK_MSG}")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style: 2-space indent

1ff789e4 : fnmsub h4, h15, h23, h2 : fnmsub %h15 %h23 %h2 -> %h4
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What changed on this line?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I used Github's editor to do a merge, which seems to have messed up the line ending of the last line here.

# Usage: ./aarch64_codec_codec_order.sh <path to core/arch/aarch64/> <path to build dir>

# Check if operand patterns are ordered by pattern.
cat $1/codec.txt | \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, when we moved to CMake we wanted to avoid any dependencies on UNIX tools. We got rid of all the uses of sed, awk, grep, cat, cut, head, tail, wc, bash, etc., replacing them with CMake. That made everything cross-platform. (We wanted to get rid of perl too but never finished that: #68). So in that sense this seems like a step backward. I know it is a pain to write file and regex utilities in cmake, and you probably don't want to do that. Please at least include a comment at the top of this file acknowledging that this is not cross-platform, that this file should not be taken as a model for how to write new build utilities for DR, and list the assumptions it makes on all these utility apps being available.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Normally CMake would search for and validate utility apps, rather than a blind attempt to execute them.)

@fhahn
Copy link
Contributor Author

fhahn commented Jun 26, 2018

Thanks Derek. I know the script is not ideal. I'll add a note to the script and I could also add some cmake checks to only run the script if all required binaries are available. What do you think?

@derekbruening
Copy link
Contributor

I know the script is not ideal. I'll add a note to the script and I could also add some cmake checks to only run the script if all required binaries are available. What do you think?

Sure, sounds like a plan.

@fhahn
Copy link
Contributor Author

fhahn commented Jun 27, 2018

I've replaced the bash script with a simple python script, which I think is also more readable.

@@ -0,0 +1,88 @@
# **********************************************************
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps a #! line would be useful, in case someone's running it from the command line. But I'm not sure what it should be:

$ head -n 1 `find -name '*.py'`
==> ./make/upload.py <==
#!/usr/bin/env python

==> ./core/arch/aarch64/codec.py <==
#!/usr/bin/python

==> ./tools/libdynamorio.so-gdb.py <==
#!/usr/bin/env python

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think #!/usr/bin/env python has the advantage that it will pick the right Python interpreter if you are in a virtualenv. I'll add it (and also make the file executable)

Change-Id: If4766cdf6da7a7205b12147d9b057dd47f161c1d
@fhahn fhahn merged commit 229c9e8 into master Jun 27, 2018
@fhahn fhahn deleted the i2626-bring-in-order branch June 27, 2018 12:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants