This is an archive of the discontinued LLVM Phabricator instance.

Extend C disassembler API to allow specifying target features
ClosedPublic

Authored by bsmith on Sep 23 2014, 9:25 AM.

Details

Reviewers
bsmith
Summary

Currently it is not possible to use the C disassembler API with a triple and arbitrary feature set, only with a triple and CPU. This patch extends that to allow subtarget features to be specified in addition to a triple/CPU.

This patch only extends the current C API and does not change the interface of existing functions.

Diff Detail

Event Timeline

bsmith updated this revision to Diff 13997.Sep 23 2014, 9:25 AM
bsmith retitled this revision from to Extend C disassembler API to allow specifying target features.
bsmith updated this object.
bsmith edited the test plan for this revision. (Show Details)
bsmith set the repository for this revision to rL LLVM.
bsmith added a subscriber: Unknown Object (MLST).

Hi Bradley,

The patch looks good, though I have some comments inline.

cheers,
--renato

test/Bindings/llvm-c/disassemble.test
14

these checks look weird

tools/llvm-c-test/disassemble.c
83

will there be any string validation further on? If yes, why do you do the NULL validation above? If not, shouldn't we add it?

bsmith added inline comments.Sep 26 2014, 2:16 AM
test/Bindings/llvm-c/disassemble.test
14

I did both the positive and negative checks here so that the test doesn't need to worry about the default subtarget features for the architecture, (for armv8 +crypto is default, so the -crypto test is actually the one checking if the feature string is used properly).

tools/llvm-c-test/disassemble.c
83

The feature string is passed straight through to createMCSubtargetInfo which I don't think accepts NULL as a value, there is certainty a lot of precedence in the codebase for using "" as an empty feature string instead of NULL.

rengolin added inline comments.Sep 26 2014, 2:21 AM
tools/llvm-c-test/disassemble.c
83

right, so who passes "NULL"? Shouldn't that be an error?

bsmith added inline comments.Sep 26 2014, 2:45 AM
tools/llvm-c-test/disassemble.c
83

The test (test/Bindings/llvm-c/disassemble.test) uses the string "NULL" to represent an empty feature set, since you can't parse the empty string from the file. I've just used it as a way to represent "" in a parsable form.

bsmith accepted this revision.Sep 30 2014, 9:44 AM
bsmith added a reviewer: bsmith.
This revision is now accepted and ready to land.Sep 30 2014, 9:44 AM
bsmith closed this revision.Sep 30 2014, 9:44 AM