Skip to content

Commit

Permalink
Remove enableMacroFusion
Browse files Browse the repository at this point in the history
  • Loading branch information
wangpc-pp committed Jan 19, 2024
1 parent 6640323 commit e74662e
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 30 deletions.
3 changes: 0 additions & 3 deletions llvm/include/llvm/CodeGen/TargetSubtargetInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -325,9 +325,6 @@ class TargetSubtargetInfo : public MCSubtargetInfo {
/// handling complex eviction chains.
virtual bool enableSpillageCopyElimination() const { return false; }

/// Enable macro fusion for this subtarget.
virtual bool enableMacroFusion() const { return false; }

/// Get the list of MacroFusion predicates.
virtual std::vector<MacroFusionPredTy> getMacroFusions() const { return {}; };
};
Expand Down
8 changes: 1 addition & 7 deletions llvm/test/TableGen/MacroFusion.td
Original file line number Diff line number Diff line change
Expand Up @@ -101,15 +101,9 @@ def TestFusion: SimpleFusion<"test-fusion", "HasTestFusion", "Test Fusion",
// Check that we have generated target subfeature.
// CHECK-SUBTARGET: { "test-fusion", "Test Fusion", Test::TestFusion

// Check that we have generated `enableMacroFusion()` and `getMacroFusions()` function.
// CHECK-SUBTARGET: bool enableMacroFusion() const override;
// Check that we have generated `getMacroFusions()` function.
// CHECK-SUBTARGET: std::vector<MacroFusionPredTy> getMacroFusions() const override;

// CHECK-SUBTARGET: bool TestGenSubtargetInfo::enableMacroFusion() const {
// CHECK-SUBTARGET-NEXT: if (hasFeature(Test::TestFusion)) return true;
// CHECK-SUBTARGET-NEXT: return false;
// CHECK-SUBTARGET-NEXT: }

// CHECK-SUBTARGET: std::vector<MacroFusionPredTy> TestGenSubtargetInfo::getMacroFusions() const {
// CHECK-SUBTARGET-NEXT: std::vector<MacroFusionPredTy> Fusions;
// CHECK-SUBTARGET-NEXT: if (hasFeature(Test::TestFusion)) Fusions.push_back(llvm::isTestFusion);
Expand Down
21 changes: 1 addition & 20 deletions llvm/utils/TableGen/SubtargetEmitter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,6 @@ class SubtargetEmitter {

void EmitSchedModel(raw_ostream &OS);
void emitGetMacroFusions(const std::string &ClassName, raw_ostream &OS);
void emitEnableMacroFusion(const std::string &ClassName, raw_ostream &OS);
void EmitHwModeCheck(const std::string &ClassName, raw_ostream &OS);
void ParseFeaturesFunction(raw_ostream &OS);

Expand Down Expand Up @@ -1788,21 +1787,6 @@ void SubtargetEmitter::EmitHwModeCheck(const std::string &ClassName,
OS << " return 0;\n}\n";
}

void SubtargetEmitter::emitEnableMacroFusion(const std::string &ClassName,
raw_ostream &OS) {
if (!TGT.hasMacroFusion())
return;

OS << "bool " << ClassName << "::enableMacroFusion() const {\n";
for (auto *Fusion : TGT.getMacroFusions())
OS.indent(2) << "if (hasFeature(" << Target
<< "::" << Fusion->getNameInitAsString()
<< ")) return true;\n";

OS.indent(2) << "return false;\n";
OS << "}\n";
}

void SubtargetEmitter::emitGetMacroFusions(const std::string &ClassName,
raw_ostream &OS) {
if (!TGT.hasMacroFusion())
Expand Down Expand Up @@ -2022,11 +2006,9 @@ void SubtargetEmitter::run(raw_ostream &OS) {
<< " const;\n";
if (TGT.getHwModes().getNumModeIds() > 1)
OS << " unsigned getHwMode() const override;\n";
if (TGT.hasMacroFusion()) {
OS << " bool enableMacroFusion() const override;\n";
if (TGT.hasMacroFusion())
OS << " std::vector<MacroFusionPredTy> getMacroFusions() const "
"override;\n";
}

STIPredicateExpander PE(Target);
PE.setByRef(false);
Expand Down Expand Up @@ -2084,7 +2066,6 @@ void SubtargetEmitter::run(raw_ostream &OS) {

EmitSchedModelHelpers(ClassName, OS);
EmitHwModeCheck(ClassName, OS);
emitEnableMacroFusion(ClassName, OS);
emitGetMacroFusions(ClassName, OS);

OS << "} // end namespace llvm\n\n";
Expand Down

0 comments on commit e74662e

Please sign in to comment.