mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2026-04-24 13:18:17 +00:00
[SDAG] When performing post-legalize DAG combining, run the legalizer
over each node in the worklist prior to combining. This allows the combiner to produce new nodes which need to go back through legalization. This is particularly useful when generating operands to target specific nodes in a post-legalize DAG combine where the operands are significantly easier to express as pre-legalized operations. My immediate use case will be PSHUFB formation where we need to build a constant shuffle mask with a build_vector node. This also refactors the relevant functionality in the legalizer to support this, and updates relevant tests. I've spoken to the R600 folks and these changes look like improvements to them. The avx512 change needs to be investigated, I suspect there is a disagreement between the legalizer and the DAG combiner there, but it seems a minor issue so leaving it to be re-evaluated after this patch. Differential Revision: http://reviews.llvm.org/D4564 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@214020 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -16,6 +16,7 @@
|
||||
#define LLVM_CODEGEN_SELECTIONDAG_H
|
||||
|
||||
#include "llvm/ADT/DenseSet.h"
|
||||
#include "llvm/ADT/SetVector.h"
|
||||
#include "llvm/ADT/StringMap.h"
|
||||
#include "llvm/ADT/ilist.h"
|
||||
#include "llvm/CodeGen/DAGCombine.h"
|
||||
@@ -364,6 +365,27 @@ public:
|
||||
/// the graph.
|
||||
void Legalize();
|
||||
|
||||
/// \brief Transforms a SelectionDAG node and any operands to it into a node
|
||||
/// that is compatible with the target instruction selector, as indicated by
|
||||
/// the TargetLowering object.
|
||||
///
|
||||
/// \returns true if \c N is a valid, legal node after calling this.
|
||||
///
|
||||
/// This essentially runs a single recursive walk of the \c Legalize process
|
||||
/// over the given node (and its operands). This can be used to incrementally
|
||||
/// legalize the DAG. All of the nodes which are directly replaced,
|
||||
/// potentially including N, are added to the output parameter \c
|
||||
/// UpdatedNodes so that the delta to the DAG can be understood by the
|
||||
/// caller.
|
||||
///
|
||||
/// When this returns false, N has been legalized in a way that make the
|
||||
/// pointer passed in no longer valid. It may have even been deleted from the
|
||||
/// DAG, and so it shouldn't be used further. When this returns true, the
|
||||
/// N passed in is a legal node, and can be immediately processed as such.
|
||||
/// This may still have done some work on the DAG, and will still populate
|
||||
/// UpdatedNodes with any new nodes replacing those originally in the DAG.
|
||||
bool LegalizeOp(SDNode *N, SmallSetVector<SDNode *, 16> &UpdatedNodes);
|
||||
|
||||
/// LegalizeVectors - This transforms the SelectionDAG into a SelectionDAG
|
||||
/// that only uses vector math operations supported by the target. This is
|
||||
/// necessary as a separate step from Legalize because unrolling a vector
|
||||
|
||||
Reference in New Issue
Block a user