From: Fangrui Song Date: Sun, 26 Apr 2020 02:55:26 +0000 (-0700) Subject: llvm-tblgen -gen-dag-isel: Reduce lib/Target/*/*GenDAGISel.inc X-Git-Tag: llvmorg-12-init~7818 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=58dbd5befdcad32f4311f3ec09d8beeb9e428ffc;p=platform%2Fupstream%2Fllvm.git llvm-tblgen -gen-dag-isel: Reduce lib/Target/*/*GenDAGISel.inc X86GenDAGISel.inc: 22597697 bytes -> 20874981 bytes --- diff --git a/llvm/utils/TableGen/DAGISelMatcherEmitter.cpp b/llvm/utils/TableGen/DAGISelMatcherEmitter.cpp index d741953..1c87acb 100644 --- a/llvm/utils/TableGen/DAGISelMatcherEmitter.cpp +++ b/llvm/utils/TableGen/DAGISelMatcherEmitter.cpp @@ -281,7 +281,7 @@ void MatcherTableEmitter::EmitPatternMatchTable(raw_ostream &OS) { unsigned MatcherTableEmitter:: EmitMatcher(const Matcher *N, unsigned Indent, unsigned CurrentIdx, raw_ostream &OS) { - OS.indent(Indent*2); + OS.indent(Indent); switch (N->getKind()) { case Matcher::Scope: { @@ -298,9 +298,9 @@ EmitMatcher(const Matcher *N, unsigned Indent, unsigned CurrentIdx, } else { if (!OmitComments) { OS << "/*" << format_decimal(CurrentIdx, IndexWidth) << "*/"; - OS.indent(Indent*2) << "/*Scope*/ "; + OS.indent(Indent) << "/*Scope*/ "; } else - OS.indent(Indent*2); + OS.indent(Indent); } // We need to encode the child and the offset of the failure code before @@ -337,7 +337,7 @@ EmitMatcher(const Matcher *N, unsigned Indent, unsigned CurrentIdx, // Emit a zero as a sentinel indicating end of 'Scope'. if (!OmitComments) OS << "/*" << format_decimal(CurrentIdx, IndexWidth) << "*/"; - OS.indent(Indent*2) << "0, "; + OS.indent(Indent) << "0, "; if (!OmitComments) OS << "/*End of Scope*/"; OS << '\n'; @@ -483,7 +483,7 @@ EmitMatcher(const Matcher *N, unsigned Indent, unsigned CurrentIdx, if (i != 0) { if (!OmitComments) OS << "/*" << format_decimal(CurrentIdx, IndexWidth) << "*/"; - OS.indent(Indent*2); + OS.indent(Indent); if (!OmitComments) OS << (isa(N) ? "/*SwitchOpcode*/ " : "/*SwitchType*/ "); @@ -509,7 +509,7 @@ EmitMatcher(const Matcher *N, unsigned Indent, unsigned CurrentIdx, // Emit the final zero to terminate the switch. if (!OmitComments) OS << "/*" << format_decimal(CurrentIdx, IndexWidth) << "*/"; - OS.indent(Indent*2) << "0,"; + OS.indent(Indent) << "0,"; if (!OmitComments) OS << (isa(N) ? " // EndSwitchOpcode" : " // EndSwitchType"); @@ -712,7 +712,7 @@ EmitMatcher(const Matcher *N, unsigned Indent, unsigned CurrentIdx, unsigned Offset = getPatternIdxFromTable(src + " -> " + dst, std::move(include_src)); OS << "TARGET_VAL(" << Offset << "),\n"; - OS.indent(FullIndexWidth + Indent * 2); + OS.indent(FullIndexWidth + Indent); } } const EmitNodeMatcherCommon *EN = cast(N); @@ -731,7 +731,7 @@ EmitMatcher(const Matcher *N, unsigned Indent, unsigned CurrentIdx, OS << "|OPFL_Variadic" << EN->getNumFixedArityOperands(); OS << ",\n"; - OS.indent(FullIndexWidth + Indent*2+4); + OS.indent(FullIndexWidth + Indent+4); if (!CompressVTs) { OS << EN->getNumVTs(); if (!OmitComments) @@ -762,10 +762,10 @@ EmitMatcher(const Matcher *N, unsigned Indent, unsigned CurrentIdx, OS << '\n'; if (const MorphNodeToMatcher *SNT = dyn_cast(N)) { - OS.indent(FullIndexWidth + Indent*2) << "// Src: " + OS.indent(FullIndexWidth + Indent) << "// Src: " << *SNT->getPattern().getSrcPattern() << " - Complexity = " << SNT->getPattern().getPatternComplexity(CGP) << '\n'; - OS.indent(FullIndexWidth + Indent*2) << "// Dst: " + OS.indent(FullIndexWidth + Indent) << "// Dst: " << *SNT->getPattern().getDstPattern() << '\n'; } } else @@ -789,7 +789,7 @@ EmitMatcher(const Matcher *N, unsigned Indent, unsigned CurrentIdx, unsigned Offset = getPatternIdxFromTable(src + " -> " + dst, std::move(include_src)); OS << "TARGET_VAL(" << Offset << "),\n"; - OS.indent(FullIndexWidth + Indent * 2); + OS.indent(FullIndexWidth + Indent); } OS << "OPC_CompleteMatch, " << CM->getNumResults() << ", "; unsigned NumResultBytes = 0; @@ -797,10 +797,10 @@ EmitMatcher(const Matcher *N, unsigned Indent, unsigned CurrentIdx, NumResultBytes += EmitVBRValue(CM->getResult(i), OS); OS << '\n'; if (!OmitComments) { - OS.indent(FullIndexWidth + Indent*2) << " // Src: " + OS.indent(FullIndexWidth + Indent) << " // Src: " << *CM->getPattern().getSrcPattern() << " - Complexity = " << CM->getPattern().getPatternComplexity(CGP) << '\n'; - OS.indent(FullIndexWidth + Indent*2) << " // Dst: " + OS.indent(FullIndexWidth + Indent) << " // Dst: " << *CM->getPattern().getDstPattern(); } OS << '\n';