This is an archive of the discontinued LLVM Phabricator instance.

MC Helpers for llvm-cfi-verify.
ClosedPublic

Authored by hctim on Sep 29 2017, 1:17 PM.

Details

Summary

Add instruction analysis and machinecode traversal helpers in preparation for control flow graph generation implementation.

Diff Detail

Repository
rL LLVM

Event Timeline

hctim created this revision.Sep 29 2017, 1:17 PM
hctim updated this revision to Diff 117216.Sep 29 2017, 2:01 PM

Added getControlFlowXRefs() to FileVerifier, including the associated unit tests.

hctim updated this revision to Diff 117219.Sep 29 2017, 2:08 PM

Implemented FileVerifier::getIndirectInstructions() and made it return a std::set.

Could this change and the follow-ons be uploaded as diffs from the previous change?

hctim updated this revision to Diff 117432.Oct 2 2017, 3:04 PM

Updated diff to only contain changes from stack.

hctim updated this revision to Diff 117449.Oct 2 2017, 4:33 PM

Fix gtest unsigned/signed comparison warnings.

tools/llvm-cfi-verify/FileVerifier.cpp
132 ↗(On Diff #117449)

getOpcode() == Instruction::Undefined? Also, what if InstrMeta.Bad?

171 ↗(On Diff #117449)

Here you don't check NextKV->second.bad but below you do, which should it be?

tools/llvm-cfi-verify/FileVerifier.h
90 ↗(On Diff #117449)

s/flow/fall/

95 ↗(On Diff #117449)

s/qua/que/

96 ↗(On Diff #117449)

s/instruction/method/

hctim updated this revision to Diff 117719.Oct 4 2017, 1:08 PM
hctim marked 5 inline comments as done.

Merged changes from previous in stack, updated for vlad.tsyrklevich's comments.

tools/llvm-cfi-verify/FileVerifier.cpp
132 ↗(On Diff #117449)

Made it more clear, this should only return true when the provided instruction is a trap used by CFI.

171 ↗(On Diff #117449)

Should be both. Updated the unit test for this.

hctim updated this revision to Diff 117727.Oct 4 2017, 1:18 PM

Merge prev in stack.

hctim updated this revision to Diff 118110.Oct 6 2017, 5:24 PM

clang format

tools/llvm-cfi-verify/FileAnalysis.cpp
149 ↗(On Diff #117727)

Make this an if{}else{} that calculates a uint64_t Target so that the identical tails can be merged?

tools/llvm-cfi-verify/FileAnalysis.h
103 ↗(On Diff #117727)

getDirectControlFlowXRefs()?

hctim updated this revision to Diff 118226.Oct 9 2017, 10:08 AM
hctim marked 2 inline comments as done.

Updated from Vlad's comments

hctim updated this revision to Diff 118254.Oct 9 2017, 12:38 PM

Backported usesRegisterOperand.

vlad.tsyrklevich accepted this revision.Oct 10 2017, 8:34 AM
This revision is now accepted and ready to land.Oct 10 2017, 8:34 AM
hctim updated this revision to Diff 118422.Oct 10 2017, 10:43 AM

Merged updates from stack.

hctim updated this revision to Diff 118681.Oct 11 2017, 1:18 PM

Merged unit test modifications up stack.

This revision was automatically updated to reflect the committed changes.