Skip to content

Commit c575937

Browse files
authored
Merge pull request #143 from sx-aurora-dev/merge/ve-custom-dag
Merge/ve custom dag
2 parents 36e855c + 7d43b08 commit c575937

12 files changed

+145
-143
lines changed

llvm/lib/Target/VE/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@ tablegen(LLVM VEGenCallingConv.inc -gen-callingconv)
1515
add_public_tablegen_target(VECommonTableGen)
1616

1717
add_llvm_target(VECodeGen
18-
CustomDAG.cpp
1918
LVLGen.cpp
2019
MaskView.cpp
2120
ShuffleSynthesis.cpp
2221
VEAsmPrinter.cpp
22+
VECustomDAG.cpp
2323
VEFrameLowering.cpp
2424
VEISelDAGToDAG.cpp
2525
VEISelLowering.cpp

llvm/lib/Target/VE/MaskView.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#include "CustomDAG.h"
1+
#include "VECustomDAG.h"
22
#include "MaskView.h"
33

44
#define DEBUG_TYPE "ve-maskview"
@@ -98,7 +98,7 @@ struct ExtractSubvectorView : public MaskView {
9898
virtual SDNode *getNode() const override { return EVN.getNode(); }
9999
};
100100

101-
static SplitView splitBuildVector(BuildVectorSDNode &BVN, CustomDAG &CDAG) {
101+
static SplitView splitBuildVector(BuildVectorSDNode &BVN, VECustomDAG &CDAG) {
102102
std::vector<SDValue> Inputs[2];
103103

104104
for (unsigned Idx = 0; Idx < BVN.getNumOperands(); ++Idx) {
@@ -163,7 +163,7 @@ struct SynthShuffle : public MaskView {
163163
virtual unsigned getNumElements() const override { return Mask.size(); }
164164
};
165165

166-
static SplitView splitShuffleVector(ShuffleVectorSDNode &SVN, CustomDAG &CDAG) {
166+
static SplitView splitShuffleVector(ShuffleVectorSDNode &SVN, VECustomDAG &CDAG) {
167167
EVT OrigVT = SVN.getValueType(0);
168168
EVT LegalResVT = CDAG.legalizeVectorType(SDValue(&SVN, 0),
169169
VVPExpansionMode::ToNativeWidth);
@@ -231,7 +231,7 @@ static SplitView splitShuffleVector(ShuffleVectorSDNode &SVN, CustomDAG &CDAG) {
231231
return Split;
232232
}
233233

234-
SplitView requestSplitView(SDNode *N, CustomDAG &CDAG) {
234+
SplitView requestSplitView(SDNode *N, VECustomDAG &CDAG) {
235235
auto BVN = dyn_cast<BuildVectorSDNode>(N);
236236
if (BVN)
237237
return splitBuildVector(*BVN, CDAG);

llvm/lib/Target/VE/MaskView.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
namespace llvm {
88

9-
struct CustomDAG;
9+
struct VECustomDAG;
1010

1111
struct ElemSelect {
1212
SDValue V; // the value that is chosen
@@ -79,7 +79,7 @@ struct SplitView {
7979
bool isValid() const { return LoView && HiView; }
8080
};
8181

82-
SplitView requestSplitView(SDNode *N, CustomDAG &CDAG);
82+
SplitView requestSplitView(SDNode *N, VECustomDAG &CDAG);
8383

8484
MaskView *requestMaskView(SDNode *N);
8585

llvm/lib/Target/VE/ShuffleSynthesis.cpp

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class ZeroDefaultingView : public MaskView {
2121
ElemSelect ZeroInsert;
2222

2323
public:
24-
ZeroDefaultingView(MaskView &BaseMV, CustomDAG &CDAG)
24+
ZeroDefaultingView(MaskView &BaseMV, VECustomDAG &CDAG)
2525
: BaseMV(BaseMV), ConstZeroV(CDAG.getConstant(0, MVT::i32)),
2626
ZeroInsert(ConstZeroV) {}
2727
};
@@ -30,7 +30,7 @@ class ZeroDefaultingView : public MaskView {
3030
// or vector registers
3131
class VRegView final : public ZeroDefaultingView {
3232
public:
33-
VRegView(CustomDAG &CDAG, MaskView &BitMV)
33+
VRegView(VECustomDAG &CDAG, MaskView &BitMV)
3434
: ZeroDefaultingView(BitMV, CDAG) {}
3535

3636
~VRegView() {}
@@ -74,7 +74,7 @@ class VRegView final : public ZeroDefaultingView {
7474

7575
class BitMaskView final : public ZeroDefaultingView {
7676
public:
77-
BitMaskView(MaskView &BitMV, CustomDAG &CDAG)
77+
BitMaskView(MaskView &BitMV, VECustomDAG &CDAG)
7878
: ZeroDefaultingView(BitMV, CDAG) {}
7979
~BitMaskView() {}
8080

@@ -231,7 +231,7 @@ static bool AnalyzeReversal(BitMaskView &BitMV, unsigned DestPartBase,
231231

232232
// match a 64 bit segment, mapping out all source bits
233233
// FIXME this implies knowledge about the underlying object structure
234-
MaskShuffleAnalysis::MaskShuffleAnalysis(MaskView &MV, CustomDAG &CDAG)
234+
MaskShuffleAnalysis::MaskShuffleAnalysis(MaskView &MV, VECustomDAG &CDAG)
235235
: MV(MV) {
236236
// This view only reflects insertions of actual i1 bits (from other mask
237237
// registers, or MVT::i32 constants). Insertion of SX register will be masked out.
@@ -290,7 +290,7 @@ MaskShuffleAnalysis::MaskShuffleAnalysis(MaskView &MV, CustomDAG &CDAG)
290290
}
291291

292292
SDValue MaskShuffleAnalysis::synthesize(SDValue Passthru, BitSelect &BSel,
293-
SDValue SXV, CustomDAG &CDAG) const {
293+
SDValue SXV, VECustomDAG &CDAG) const {
294294
const uint64_t AllSetMask = (uint64_t)-1;
295295

296296
// match full register copies
@@ -353,7 +353,7 @@ bool MaskShuffleAnalysis::analyzeVectorSources(bool &AllTrue) const {
353353
}
354354

355355
// materialize the code to synthesize this operation
356-
SDValue MaskShuffleAnalysis::synthesize(CustomDAG &CDAG, EVT LegalMaskVT) {
356+
SDValue MaskShuffleAnalysis::synthesize(VECustomDAG &CDAG, EVT LegalMaskVT) {
357357
Packing PackFlag =
358358
isPackedType(LegalMaskVT) ? Packing::Dense : Packing::Normal;
359359

@@ -504,7 +504,7 @@ struct ScalarTransferOp final : public AbstractShuffleOp {
504504
virtual ~ScalarTransferOp() {}
505505

506506
// transfer all insert positions to their destination
507-
virtual SDValue synthesize(MaskView &MV, CustomDAG &CDAG,
507+
virtual SDValue synthesize(MaskView &MV, VECustomDAG &CDAG,
508508
SDValue PartialV) override {
509509
SDValue AccuV = PartialV;
510510

@@ -584,7 +584,7 @@ struct VMVShuffleOp final : public AbstractShuffleOp {
584584
unsigned getAVL() const { return DestStartPos + SubVectorLength; }
585585

586586
// transfer all insert positions to their destination
587-
SDValue synthesize(MaskView &MV, CustomDAG &CDAG, SDValue PartialV) override {
587+
SDValue synthesize(MaskView &MV, VECustomDAG &CDAG, SDValue PartialV) override {
588588
// noop VMV
589589
if (ShiftAmount == 0 && PartialV->isUndef())
590590
return SrcVector;
@@ -737,7 +737,7 @@ struct PatternShuffleOp final : public AbstractShuffleOp {
737737
}
738738

739739
// transfer all insert positions to their destination
740-
SDValue synthesize(MaskView &MV, CustomDAG &CDAG, SDValue PartialV) override {
740+
SDValue synthesize(MaskView &MV, VECustomDAG &CDAG, SDValue PartialV) override {
741741
EVT LegalResVT =
742742
PartialV.getValueType(); // LegalizeVectorType(Op.getValueType(),
743743
// Op, DAG, Mode);
@@ -902,7 +902,7 @@ struct BroadcastOp final : public AbstractShuffleOp {
902902

903903
~BroadcastOp() {}
904904

905-
SDValue synthesize(MaskView &MV, CustomDAG &CDAG, SDValue PartialV) override {
905+
SDValue synthesize(MaskView &MV, VECustomDAG &CDAG, SDValue PartialV) override {
906906
SDValue ScalarSrcV;
907907
if (SourceElem.isElemInsert()) {
908908
ScalarSrcV = SourceElem.V;
@@ -996,7 +996,7 @@ struct ConstantElemOp final : public AbstractShuffleOp {
996996
ConstantElemOp(Constant *VecConstant) : VecConstant(VecConstant) {}
997997
~ConstantElemOp() {}
998998

999-
SDValue synthesize(MaskView &MV, CustomDAG &CDAG, SDValue PartialV) override {
999+
SDValue synthesize(MaskView &MV, VECustomDAG &CDAG, SDValue PartialV) override {
10001000
EVT LegalResVT = PartialV.getValueType();
10011001
const EVT PtrVT = MVT::i64;
10021002
// const unsigned LegalNumElems = LegalResVT.getVectorNumElements();
@@ -1113,7 +1113,7 @@ struct GatherShuffleOp final : public AbstractShuffleOp {
11131113

11141114
~GatherShuffleOp() {}
11151115

1116-
SDValue synthesize(MaskView &MV, CustomDAG &CDAG, SDValue PartialV) override {
1116+
SDValue synthesize(MaskView &MV, VECustomDAG &CDAG, SDValue PartialV) override {
11171117
// Spill the requires elements of \p SrcVectorV to the stack
11181118
EVT LegalizedSrcVT =
11191119
CDAG.legalizeVectorType(SrcVectorV, VVPExpansionMode::ToNextWidth);
@@ -1326,7 +1326,7 @@ raw_ostream &ShuffleAnalysis::print(raw_ostream &out) const {
13261326
return out;
13271327
}
13281328

1329-
SDValue ShuffleAnalysis::synthesize(CustomDAG &CDAG, EVT LegalResultVT) {
1329+
SDValue ShuffleAnalysis::synthesize(VECustomDAG &CDAG, EVT LegalResultVT) {
13301330
LLVM_DEBUG(dbgs() << "Synthesized shuffle sequence:\n"; print(dbgs()));
13311331

13321332
SDValue AccuV = CDAG.getUndef(LegalResultVT);

llvm/lib/Target/VE/ShuffleSynthesis.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
#ifndef LLVM_LIB_TARGET_VE_SHUFFLESYNTHESIS_H
1414
#define LLVM_LIB_TARGET_VE_SHUFFLESYNTHESIS_H
1515

16-
#include "CustomDAG.h"
16+
#include "VECustomDAG.h"
1717
#include "MaskView.h"
1818
#include "VE.h"
1919
#include "llvm/CodeGen/SelectionDAGNodes.h"
@@ -116,17 +116,17 @@ struct MaskShuffleAnalysis {
116116

117117
// match a 64 bit segment, mapping out all source bits
118118
// FIXME this implies knowledge about the underlying object structure
119-
MaskShuffleAnalysis(MaskView& MV, CustomDAG &CDAG);
119+
MaskShuffleAnalysis(MaskView& MV, VECustomDAG &CDAG);
120120

121121
// Synthesize \p BitSelect, merging the result into \p Passthru
122122
SDValue synthesize(SDValue Passthru, BitSelect &BSel, SDValue SXV,
123-
CustomDAG &CDAG) const;
123+
VECustomDAG &CDAG) const;
124124

125125
// Check whether the constant background of the result consists only of `1` bits (or undef)
126126
bool analyzeVectorSources(bool & AllTrue) const;
127127

128128
// materialize the code to synthesize this operation
129-
SDValue synthesize(CustomDAG &CDAG, EVT LegalMaskVT);
129+
SDValue synthesize(VECustomDAG &CDAG, EVT LegalMaskVT);
130130
};
131131

132132
enum IterControl {
@@ -184,7 +184,7 @@ struct PartialShuffleState {
184184
struct AbstractShuffleOp {
185185
virtual ~AbstractShuffleOp() {}
186186

187-
virtual SDValue synthesize(MaskView &MV, CustomDAG &CDAG,
187+
virtual SDValue synthesize(MaskView &MV, VECustomDAG &CDAG,
188188
SDValue PartialV) = 0;
189189
virtual void print(raw_ostream &out) const = 0;
190190
};
@@ -247,7 +247,7 @@ class ShuffleAnalysis {
247247
raw_ostream &print(raw_ostream &out) const;
248248

249249
/// Synthesize the code planned in the analyze stage
250-
SDValue synthesize(CustomDAG &CDAG, EVT LegalResultVT);
250+
SDValue synthesize(VECustomDAG &CDAG, EVT LegalResultVT);
251251
};
252252

253253
} // namespace llvm

0 commit comments

Comments
 (0)