[PATCH] D38427: Graph builder implementation.
Mitch Phillips via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Oct 9 12:29:42 PDT 2017
hctim added inline comments.
================
Comment at: tools/llvm-cfi-verify/GraphBuilder.h:76
+ uint64_t BaseInstructionAddress;
+ std::vector<ConditionalBranchNode *> BranchNodes;
+ std::vector<ControlFlowNode *> OrphanedNodes;
----------------
vlad.tsyrklevich wrote:
> hctim wrote:
> > vlad.tsyrklevich wrote:
> > > Why are these pointers?
> > Don't want to mix storage (stack/heap) of nodes. Intermediate nodes cannot be stored on stack, as they are neither a branch node or an orphaned node. Consider the following:
> >
> > ```
> > [0x0: jmp 2]
> > \
> > [0x2: jmpq %rax]
> > ```
> >
> > `0x2` is neither a branch node, nor an orphaned node. The only reference to it is via `0x0`, which is a branch node.
> >
> > Having all these nodes be heap-allocated makes the clean up much easier.
> Would it make sense to just place ConditionalBranchNodes in a vector without dynamically allocating them so they don't have to be manually freed?
Yep, done :)
https://reviews.llvm.org/D38427
More information about the llvm-commits
mailing list