Commit Graph

255 Commits

Author SHA1 Message Date
Pietro Fezzardi af760942e7 DLATypeSystem: add API to move edge target 2022-06-14 12:51:48 +02:00
Pietro Fezzardi 89734f6208 DLA: add pointer placeholders to model types
This commit adds placeholder pointer nodes to the DLA graph during
initialization, to point to nodes that represent model types whose size
should not altered during the Middleend.
2022-06-14 12:51:48 +02:00
Pietro Fezzardi ad81bc7020 Enable addtional compilation warnings
These warnings are not enabled by default with -Wall nor with -Wextra.
2022-06-14 12:48:54 +02:00
Alvise de Faveri 16fba5be15 DLA: Never create a new type for the stack 2022-06-13 15:20:07 +02:00
Pietro Fezzardi 6f41e625e7 DeduplicateUnionFields is now DeduplicateFields
Before this commit, the dla::Step depended on InterferingInfo, but this
was superfluous.

This commit drops the dependency and enables the Step to run before
ComputeNonInterferingComponents.

This also avoids the need to run ComputeNonInterferingComponents twice
(one before and one after DeduplicateUnionFields), so it can only run
once.
2022-06-08 14:16:51 +02:00
Pietro Fezzardi 3e53eced5d CollapseSingleChild: ignore InterferingInfo
Before this commit, CollapseSingleChild Step was thinkering around
with InterferingInfo.

Now CollapseSingleChild does not care about InterferingInfo anymore, so
the code handling it can just be dropped.
2022-06-08 14:13:01 +02:00
Pietro Fezzardi 9898c980d7 DLA: make TypeLinkTag serializable to Loggers 2022-06-08 14:11:55 +02:00
Pietro Fezzardi 5a37fe8a84 DLA: add MergePointerNodes Step
This Step merges nodes with outgoing pointer-edges pointing to the same
pointee node.
2022-06-08 10:22:35 +02:00
Pietro Fezzardi ba50eb4a55 DLA: revive and rework CollapseSingleChild Step
The step now collapse parents with their single child if they are
indistinguishable, i.e. if the parent has only that single child, at
offset zero, and their size is the same.
2022-06-08 10:21:44 +02:00
Pietro Fezzardi be999ebda8 DLAComputeNonInterferingComponents: drop assert 2022-06-08 10:21:01 +02:00
Pietro Fezzardi 5c9ae203e6 DLA: fix deps for ComputeUpperMemberAccesses 2022-06-08 10:20:13 +02:00
Pietro Fezzardi 546175cc75 Fix typo in comment 2022-06-08 10:18:40 +02:00
Pietro Fezzardi 2651b8765b DLA: drop CollapseCompatibleArrays
This pass was never implemented and we don't have plans to do it soon.
This commit just drops it to reduce the noise.
Whenever we decide to implement something similar we'll do it from
scratch.
2022-05-27 17:06:49 +02:00
Pietro Fezzardi 31419a5fd1 Remove old unused dla::Layout class
This class was introduced before having model::Type, to represent
roughly the same information.

Now it's dead code and this commit removes it.
2022-05-26 16:46:47 +02:00
Pietro Fezzardi 3e78b3c9e6 DLA: fix handling of Functions without stack args 2022-05-25 17:23:42 +02:00
Massimo Fioravanti f40cf6471d Transformed DLA in a pipeline analysis 2022-05-25 15:48:27 +02:00
Pietro Fezzardi 96148248b1 Drop old unused flag: -dla-flatc-dir 2022-05-11 12:42:38 +02:00
Alessandro Di Federico 2e434dbd7e DLA: relax handling of stack arguments
This commit improves how DLA commits its results into
`model::RawFunctionType::StackArgumentsType`.
2022-05-03 21:48:07 +02:00
Pietro Fezzardi 14d40096b7 Rearrange Liveness and MarkForSerialization
These two parts of the code needed to be separated into libraries
because they were used both by the old C backend and by
IRCanonicalization.

Now that the old C backend is dead, they have been incorporated into
IRCanonicalization.
Further changes are necessary to strip away the last leftovers of the
old C backend from MarkAnalysis.
2022-04-21 09:51:45 +02:00
Giacomo Vercesi ab125b35b0 Fix License headers
Change company name to "rev.ng Labs Srl" in all license headers
to reflect changed company name and legal status
Add missing license headers to files that didn't have one
2022-04-19 12:17:59 +02:00
Pietro Fezzardi 593cc584cb DLA: propagate type info between loads and stores 2022-04-13 12:41:17 +02:00
Pietro Fezzardi 36541ae5cd QualifiedType RawFunctionType.StackArgumentsType 2022-04-08 17:58:06 +02:00
Giacomo Vercesi da06acf29e Update to reflect removal of tags from model YAML 2022-04-08 17:57:23 +02:00
Antonio Frighetto 765219d58c Support for control-flow graph out of the model
The control-flow graph has been taken out of the model. Related changes
to `getCallSitePrototype` have been here addressed.
2022-04-06 16:25:05 +02:00
Pietro Fezzardi 0796e00d71 DLAMakeModelTypes: fix array fields 2022-03-28 09:51:01 +02:00
Alvise de Faveri ddf8adca70 DLA: drop ModelFuncHelpers and use shared ones 2022-03-22 10:55:16 +01:00
Pietro Fezzardi f69f68fe35 DLA: dump .dot for debug in dla::StepManager
Before this commit, each dla::Step handled the printing of its own .dot
files for debug.
This commit moves the logic for dumping the .dot files into the main
loop of dla::StepManager, guarding it with a single Logger.
2022-03-22 10:48:03 +01:00
Pietro Fezzardi 9f1bbc8b49 Drop deprecated \brief Doxygen directive
\brief is a stupid feature that we should stop using:
https://lists.llvm.org/pipermail/llvm-dev/2015-May/085152.html
2022-03-22 10:48:03 +01:00
Pietro Fezzardi ed5f4ac3e9 RemoveInvalidStrideEdges: handle 0-sized nodes
Before this commit, the dla::Step RemoveInvalidStrideEdges was not
taking into account that dropping edges could change the size of the
node where the edges originated from.

This commit fixes the problem, a) recomputing the size automatically
when needed, and b) adding proper dependencies in the dla middleend
pipeline, so that these changes are properly propagated updwards and
don't break any pre-conditions of following dla::Steps.
2022-03-21 17:15:27 +01:00
Pietro Fezzardi 3678e4f730 DLA: completely remove Inheritance edges 2022-03-21 17:08:46 +01:00
Pietro Fezzardi 7192cedcbb DLA: turn off Inheritance edges 2022-03-21 17:08:46 +01:00
Pietro Fezzardi 7971f0a20d Add dla::Step SimplifyInstanceAtOffset0
This step removes redundant instance-at-offset-0, collapsing the child
into the parent, whenever this operation does not induce instance-loops
on the graph.

This is intended to reduce the number of shallow wrapper structs and
unions.
2022-03-21 11:25:55 +01:00
Pietro Fezzardi 8c4784d076 DLA: split collapsing of SCC into many DLASteps
Before this commit there was a single pass removing equality SCC and
inheritance SCC.
This commit splits the removal of each kind of SCC in a separate
DLAStep, and adds handling of instance-at-offset-0 SCCs that were not
considered before.
2022-03-21 11:19:18 +01:00
Pietro Fezzardi 651ebe4cb6 Add LayoutTypeSystem::verifyInstanceAtOffset0DAG()
This new verification method is propedeutic to switching off Inheritance
nodes entirely.
2022-03-21 11:19:18 +01:00
Pietro Fezzardi e78e780a73 dla::LayoutTypeSystem: fix node style in dot 2022-03-21 10:46:25 +01:00
Pietro Fezzardi c98794d9b0 Rework DLAMakeModelTypes to fix several bugs
Before this commit, DLAMakeModelTypes was generating broken types in
several corner cases involving unions with children at offset different
than zero, and strided accesses.

This commit fixes these issues and reworks the pass to also consider
strides and model::Qualifiers in the correct order.
2022-03-21 09:48:26 +01:00
Pietro Fezzardi d6ae6fd650 Add dla::Step RemoveInvalidStrideEdges 2022-03-21 09:43:10 +01:00
Pietro Fezzardi c3cf053b58 DLAMakeLayouts: fix order of strides 2022-03-21 09:40:31 +01:00
Pietro Fezzardi 0f00d29464 DLA: assert stride nesting in FieldSizeComputation 2022-03-21 09:38:25 +01:00
Pietro Fezzardi 782a67eb9c DLA: sort strides on Instance edges.
Nested SCEVAddRecs are not guaranteed to have strides that go from
larger to smaller. Both cases are valid and can convey interesting
information to DLA. But DLA assumes that the outermost strides are
always larger than the innermost, because this is the only scenario
allowed by well-nested types.

This commit re-orders the strides (and the associated trip counts) so
that they always go from larger to smaller sizes.
2022-03-21 09:36:13 +01:00
Pietro Fezzardi 44b6fd2970 DLAPass: fix runOnModule return value.
Now the method returns true only if there have been changes.
2022-03-18 16:49:29 +01:00
Pietro Fezzardi ed4942a8b0 DLAMakeModelTypes.cpp: assert verifyPointerDAG 2022-03-18 16:49:28 +01:00
Pietro Fezzardi 6d91546816 LayoutTypeSystem: add verifyPointerDAG method 2022-03-18 12:38:25 +01:00
Pietro Fezzardi 901c6e76ca lib/DataLayoutAnalysis/Backend: drop public using 2022-03-18 12:38:25 +01:00
Alessandro Di Federico 1dcce82dfc Adopt cmake-format 2022-03-18 12:32:44 +01:00
Alessandro Di Federico 77335d036a Rename Lifted tag to Isolated 2022-03-17 14:08:05 +01:00
Pietro Fezzardi ff0a1b8eab DLADeduplicateUnionFields.cpp: fix linkOrderLess
The linkOrderLess comparison function is used for sorting the children
edges of a node.

Before this commit, it could not handle the case of comparing an edge
with itself, yielding wrong results (or assertion failure if assertions
were compiled in).

This commit fixes linkOrderLess to handle that case without asserting,
and adds an early return for it, without requiring to inspect the edges
in depth.
2022-03-10 18:00:05 +01:00
Alessandro Di Federico 5d197bff15 Adopt API changes in the model 2022-03-10 17:59:05 +01:00
Pietro Fezzardi a8da5e14ec DLA: enable union dedup w/o CollapseSingleChild
DeduplicateUnionFields does not depend on CollapseSingleChild, but can
break if CollapseSingleChild has not run.
However, we don't want to introduce an explicit dependency between the
two steps, because CollapseSingleChild could soon become obsolete on
its own, superseeded by a more powerful and costly step.

This commit changes DeduplicateUnionFields with an additional
pre-processing that runs CollapseSingleChild on each node at step one,
to ensure the step does not fail if CollapseSingleChild child is not
executed.
2022-03-10 12:21:01 +01:00
Pietro Fezzardi acef606a73 DLATypeSystem.cpp: improve error reporting 2022-03-08 17:21:24 +01:00