1 //===- DAGISelMatcherEmitter.cpp - Matcher Emitter ------------------------===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 // This file contains code to generate C++ code for a matcher.
11 //===----------------------------------------------------------------------===//
13 #include "CodeGenDAGPatterns.h"
14 #include "CodeGenInstruction.h"
15 #include "CodeGenRegisters.h"
16 #include "CodeGenTarget.h"
17 #include "DAGISelMatcher.h"
18 #include "SDNodeProperties.h"
19 #include "llvm/ADT/DenseMap.h"
20 #include "llvm/ADT/MapVector.h"
21 #include "llvm/ADT/StringMap.h"
22 #include "llvm/ADT/TinyPtrVector.h"
23 #include "llvm/Support/CommandLine.h"
24 #include "llvm/Support/Format.h"
25 #include "llvm/Support/SourceMgr.h"
26 #include "llvm/TableGen/Error.h"
27 #include "llvm/TableGen/Record.h"
33 FullIndexWidth
= IndexWidth
+ 4,
37 cl::OptionCategory
DAGISelCat("Options for -gen-dag-isel");
39 // To reduce generated source code size.
40 static cl::opt
<bool> OmitComments("omit-comments",
41 cl::desc("Do not generate comments"),
42 cl::init(false), cl::cat(DAGISelCat
));
44 static cl::opt
<bool> InstrumentCoverage(
45 "instrument-coverage",
46 cl::desc("Generates tables to help identify patterns matched"),
47 cl::init(false), cl::cat(DAGISelCat
));
50 class MatcherTableEmitter
{
51 const CodeGenDAGPatterns
&CGP
;
53 SmallVector
<unsigned, Matcher::HighestKind
+1> OpcodeCounts
;
55 DenseMap
<TreePattern
*, unsigned> NodePredicateMap
;
56 std::vector
<TreePredicateFn
> NodePredicates
;
57 std::vector
<TreePredicateFn
> NodePredicatesWithOperands
;
59 // We de-duplicate the predicates by code string, and use this map to track
60 // all the patterns with "identical" predicates.
61 StringMap
<TinyPtrVector
<TreePattern
*>> NodePredicatesByCodeToRun
;
63 StringMap
<unsigned> PatternPredicateMap
;
64 std::vector
<std::string
> PatternPredicates
;
66 DenseMap
<const ComplexPattern
*, unsigned> ComplexPatternMap
;
67 std::vector
<const ComplexPattern
*> ComplexPatterns
;
70 DenseMap
<Record
*, unsigned> NodeXFormMap
;
71 std::vector
<Record
*> NodeXForms
;
73 std::vector
<std::string
> VecIncludeStrings
;
74 MapVector
<std::string
, unsigned, StringMap
<unsigned> > VecPatterns
;
76 unsigned getPatternIdxFromTable(std::string
&&P
, std::string
&&include_loc
) {
77 const auto It
= VecPatterns
.find(P
);
78 if (It
== VecPatterns
.end()) {
79 VecPatterns
.insert(make_pair(std::move(P
), VecPatterns
.size()));
80 VecIncludeStrings
.push_back(std::move(include_loc
));
81 return VecIncludeStrings
.size() - 1;
87 MatcherTableEmitter(const CodeGenDAGPatterns
&cgp
)
88 : CGP(cgp
), OpcodeCounts(Matcher::HighestKind
+ 1, 0) {}
90 unsigned EmitMatcherList(const Matcher
*N
, const unsigned Indent
,
91 unsigned StartIdx
, raw_ostream
&OS
);
93 unsigned SizeMatcherList(Matcher
*N
, raw_ostream
&OS
);
95 void EmitPredicateFunctions(raw_ostream
&OS
);
97 void EmitHistogram(const Matcher
*N
, raw_ostream
&OS
);
99 void EmitPatternMatchTable(raw_ostream
&OS
);
102 void EmitNodePredicatesFunction(const std::vector
<TreePredicateFn
> &Preds
,
103 StringRef Decl
, raw_ostream
&OS
);
105 unsigned SizeMatcher(Matcher
*N
, raw_ostream
&OS
);
107 unsigned EmitMatcher(const Matcher
*N
, const unsigned Indent
, unsigned CurrentIdx
,
110 unsigned getNodePredicate(TreePredicateFn Pred
) {
111 TreePattern
*TP
= Pred
.getOrigPatFragRecord();
112 unsigned &Entry
= NodePredicateMap
[TP
];
114 TinyPtrVector
<TreePattern
*> &SameCodePreds
=
115 NodePredicatesByCodeToRun
[Pred
.getCodeToRunOnSDNode()];
116 if (SameCodePreds
.empty()) {
117 // We've never seen a predicate with the same code: allocate an entry.
118 if (Pred
.usesOperands()) {
119 NodePredicatesWithOperands
.push_back(Pred
);
120 Entry
= NodePredicatesWithOperands
.size();
122 NodePredicates
.push_back(Pred
);
123 Entry
= NodePredicates
.size();
126 // We did see an identical predicate: re-use it.
127 Entry
= NodePredicateMap
[SameCodePreds
.front()];
129 assert(TreePredicateFn(SameCodePreds
.front()).usesOperands() ==
130 Pred
.usesOperands() &&
131 "PatFrags with some code must have same usesOperands setting");
133 // In both cases, we've never seen this particular predicate before, so
134 // mark it in the list of predicates sharing the same code.
135 SameCodePreds
.push_back(TP
);
140 unsigned getPatternPredicate(StringRef PredName
) {
141 unsigned &Entry
= PatternPredicateMap
[PredName
];
143 PatternPredicates
.push_back(PredName
.str());
144 Entry
= PatternPredicates
.size();
148 unsigned getComplexPat(const ComplexPattern
&P
) {
149 unsigned &Entry
= ComplexPatternMap
[&P
];
151 ComplexPatterns
.push_back(&P
);
152 Entry
= ComplexPatterns
.size();
157 unsigned getNodeXFormID(Record
*Rec
) {
158 unsigned &Entry
= NodeXFormMap
[Rec
];
160 NodeXForms
.push_back(Rec
);
161 Entry
= NodeXForms
.size();
167 } // end anonymous namespace.
169 static std::string
GetPatFromTreePatternNode(const TreePatternNode
*N
) {
171 raw_string_ostream
Stream(str
);
176 static unsigned GetVBRSize(unsigned Val
) {
177 if (Val
<= 127) return 1;
179 unsigned NumBytes
= 0;
187 /// EmitVBRValue - Emit the specified value as a VBR, returning the number of
189 static unsigned EmitVBRValue(uint64_t Val
, raw_ostream
&OS
) {
195 uint64_t InVal
= Val
;
196 unsigned NumBytes
= 0;
198 OS
<< (Val
&127) << "|128,";
204 OS
<< "/*" << InVal
<< "*/";
209 /// Emit the specified signed value as a VBR. To improve compression we encode
210 /// positive numbers shifted left by 1 and negative numbers negated and shifted
211 /// left by 1 with bit 0 set.
212 static unsigned EmitSignedVBRValue(uint64_t Val
, raw_ostream
&OS
) {
213 if ((int64_t)Val
>= 0)
216 Val
= (-Val
<< 1) | 1;
218 return EmitVBRValue(Val
, OS
);
221 // This is expensive and slow.
222 static std::string
getIncludePath(const Record
*R
) {
224 raw_string_ostream
Stream(str
);
225 auto Locs
= R
->getLoc();
227 if (Locs
.size() > 1) {
228 // Get where the pattern prototype was instantiated
230 } else if (Locs
.size() == 1) {
233 unsigned CurBuf
= SrcMgr
.FindBufferContainingLoc(L
);
234 assert(CurBuf
&& "Invalid or unspecified location!");
236 Stream
<< SrcMgr
.getBufferInfo(CurBuf
).Buffer
->getBufferIdentifier() << ":"
237 << SrcMgr
.FindLineNumber(L
, CurBuf
);
241 /// This function traverses the matcher tree and sizes all the nodes
242 /// that are children of the three kinds of nodes that have them.
243 unsigned MatcherTableEmitter::
244 SizeMatcherList(Matcher
*N
, raw_ostream
&OS
) {
247 Size
+= SizeMatcher(N
, OS
);
253 /// This function sizes the children of the three kinds of nodes that
254 /// have them. It does so by using special cases for those three
255 /// nodes, but sharing the code in EmitMatcher() for the other kinds.
256 unsigned MatcherTableEmitter::
257 SizeMatcher(Matcher
*N
, raw_ostream
&OS
) {
260 ++OpcodeCounts
[N
->getKind()];
261 switch (N
->getKind()) {
262 // The Scope matcher has its kind, a series of child size + child,
263 // and a trailing zero.
264 case Matcher::Scope
: {
265 ScopeMatcher
*SM
= cast
<ScopeMatcher
>(N
);
266 assert(SM
->getNext() == nullptr && "Scope matcher should not have next");
267 unsigned Size
= 1; // Count the kind.
268 for (unsigned i
= 0, e
= SM
->getNumChildren(); i
!= e
; ++i
) {
269 const unsigned ChildSize
= SizeMatcherList(SM
->getChild(i
), OS
);
270 assert(ChildSize
!= 0 && "Matcher cannot have child of size 0");
271 SM
->getChild(i
)->setSize(ChildSize
);
272 Size
+= GetVBRSize(ChildSize
) + ChildSize
; // Count VBR and child size.
274 ++Size
; // Count the zero sentinel.
278 // SwitchOpcode and SwitchType have their kind, a series of child size +
279 // opcode/type + child, and a trailing zero.
280 case Matcher::SwitchOpcode
:
281 case Matcher::SwitchType
: {
282 unsigned Size
= 1; // Count the kind.
284 if (const SwitchOpcodeMatcher
*SOM
= dyn_cast
<SwitchOpcodeMatcher
>(N
))
285 NumCases
= SOM
->getNumCases();
287 NumCases
= cast
<SwitchTypeMatcher
>(N
)->getNumCases();
288 for (unsigned i
= 0, e
= NumCases
; i
!= e
; ++i
) {
290 if (SwitchOpcodeMatcher
*SOM
= dyn_cast
<SwitchOpcodeMatcher
>(N
)) {
291 Child
= SOM
->getCaseMatcher(i
);
292 Size
+= 2; // Count the child's opcode.
294 Child
= cast
<SwitchTypeMatcher
>(N
)->getCaseMatcher(i
);
295 ++Size
; // Count the child's type.
297 const unsigned ChildSize
= SizeMatcherList(Child
, OS
);
298 assert(ChildSize
!= 0 && "Matcher cannot have child of size 0");
299 Child
->setSize(ChildSize
);
300 Size
+= GetVBRSize(ChildSize
) + ChildSize
; // Count VBR and child size.
302 ++Size
; // Count the zero sentinel.
307 // Employ the matcher emitter to size other matchers.
308 return EmitMatcher(N
, 0, Idx
, OS
);
310 llvm_unreachable("Unreachable");
313 static void BeginEmitFunction(raw_ostream
&OS
, StringRef RetType
,
314 StringRef Decl
, bool AddOverride
) {
315 OS
<< "#ifdef GET_DAGISEL_DECL\n";
316 OS
<< RetType
<< ' ' << Decl
;
321 "#if defined(GET_DAGISEL_BODY) || DAGISEL_INLINE\n";
322 OS
<< RetType
<< " DAGISEL_CLASS_COLONCOLON " << Decl
<< "\n";
324 OS
<< "#if DAGISEL_INLINE\n"
330 static void EndEmitFunction(raw_ostream
&OS
) {
331 OS
<< "#endif // GET_DAGISEL_BODY\n\n";
334 void MatcherTableEmitter::EmitPatternMatchTable(raw_ostream
&OS
) {
336 assert(isUInt
<16>(VecPatterns
.size()) &&
337 "Using only 16 bits to encode offset into Pattern Table");
338 assert(VecPatterns
.size() == VecIncludeStrings
.size() &&
339 "The sizes of Pattern and include vectors should be the same");
341 BeginEmitFunction(OS
, "StringRef", "getPatternForIndex(unsigned Index)",
342 true/*AddOverride*/);
344 OS
<< "static const char *PATTERN_MATCH_TABLE[] = {\n";
346 for (const auto &It
: VecPatterns
) {
347 OS
<< "\"" << It
.first
<< "\",\n";
351 OS
<< "\nreturn StringRef(PATTERN_MATCH_TABLE[Index]);";
355 BeginEmitFunction(OS
, "StringRef", "getIncludePathForIndex(unsigned Index)",
356 true/*AddOverride*/);
358 OS
<< "static const char *INCLUDE_PATH_TABLE[] = {\n";
360 for (const auto &It
: VecIncludeStrings
) {
361 OS
<< "\"" << It
<< "\",\n";
365 OS
<< "\nreturn StringRef(INCLUDE_PATH_TABLE[Index]);";
370 /// EmitMatcher - Emit bytes for the specified matcher and return
371 /// the number of bytes emitted.
372 unsigned MatcherTableEmitter::
373 EmitMatcher(const Matcher
*N
, const unsigned Indent
, unsigned CurrentIdx
,
377 switch (N
->getKind()) {
378 case Matcher::Scope
: {
379 const ScopeMatcher
*SM
= cast
<ScopeMatcher
>(N
);
380 unsigned StartIdx
= CurrentIdx
;
382 // Emit all of the children.
383 for (unsigned i
= 0, e
= SM
->getNumChildren(); i
!= e
; ++i
) {
389 OS
<< "/*" << format_decimal(CurrentIdx
, IndexWidth
) << "*/";
390 OS
.indent(Indent
) << "/*Scope*/ ";
395 unsigned ChildSize
= SM
->getChild(i
)->getSize();
396 unsigned VBRSize
= EmitVBRValue(ChildSize
, OS
);
398 OS
<< "/*->" << CurrentIdx
+ VBRSize
+ ChildSize
<< "*/";
400 OS
<< " // " << SM
->getNumChildren() << " children in Scope";
404 ChildSize
= EmitMatcherList(SM
->getChild(i
), Indent
+1,
405 CurrentIdx
+ VBRSize
, OS
);
406 assert(ChildSize
== SM
->getChild(i
)->getSize() &&
407 "Emitted child size does not match calculated size");
408 CurrentIdx
+= VBRSize
+ ChildSize
;
411 // Emit a zero as a sentinel indicating end of 'Scope'.
413 OS
<< "/*" << format_decimal(CurrentIdx
, IndexWidth
) << "*/";
414 OS
.indent(Indent
) << "0, ";
416 OS
<< "/*End of Scope*/";
418 return CurrentIdx
- StartIdx
+ 1;
421 case Matcher::RecordNode
:
422 OS
<< "OPC_RecordNode,";
425 << cast
<RecordMatcher
>(N
)->getResultNo() << " = "
426 << cast
<RecordMatcher
>(N
)->getWhatFor();
430 case Matcher::RecordChild
:
431 OS
<< "OPC_RecordChild" << cast
<RecordChildMatcher
>(N
)->getChildNo()
435 << cast
<RecordChildMatcher
>(N
)->getResultNo() << " = "
436 << cast
<RecordChildMatcher
>(N
)->getWhatFor();
440 case Matcher::RecordMemRef
:
441 OS
<< "OPC_RecordMemRef,\n";
444 case Matcher::CaptureGlueInput
:
445 OS
<< "OPC_CaptureGlueInput,\n";
448 case Matcher::MoveChild
: {
449 const auto *MCM
= cast
<MoveChildMatcher
>(N
);
451 OS
<< "OPC_MoveChild";
452 // Handle the specialized forms.
453 if (MCM
->getChildNo() >= 8)
455 OS
<< MCM
->getChildNo() << ",\n";
456 return (MCM
->getChildNo() >= 8) ? 2 : 1;
459 case Matcher::MoveSibling
: {
460 const auto *MSM
= cast
<MoveSiblingMatcher
>(N
);
462 OS
<< "OPC_MoveSibling";
463 // Handle the specialized forms.
464 if (MSM
->getSiblingNo() >= 8)
466 OS
<< MSM
->getSiblingNo() << ",\n";
467 return (MSM
->getSiblingNo() >= 8) ? 2 : 1;
470 case Matcher::MoveParent
:
471 OS
<< "OPC_MoveParent,\n";
474 case Matcher::CheckSame
:
475 OS
<< "OPC_CheckSame, "
476 << cast
<CheckSameMatcher
>(N
)->getMatchNumber() << ",\n";
479 case Matcher::CheckChildSame
:
480 OS
<< "OPC_CheckChild"
481 << cast
<CheckChildSameMatcher
>(N
)->getChildNo() << "Same, "
482 << cast
<CheckChildSameMatcher
>(N
)->getMatchNumber() << ",\n";
485 case Matcher::CheckPatternPredicate
: {
486 StringRef Pred
= cast
<CheckPatternPredicateMatcher
>(N
)->getPredicate();
487 unsigned PredNo
= getPatternPredicate(Pred
);
489 OS
<< "OPC_CheckPatternPredicate2, TARGET_VAL(" << PredNo
<< "),";
491 OS
<< "OPC_CheckPatternPredicate, " << PredNo
<< ',';
493 OS
<< " // " << Pred
;
495 return 2 + (PredNo
> 255);
497 case Matcher::CheckPredicate
: {
498 TreePredicateFn Pred
= cast
<CheckPredicateMatcher
>(N
)->getPredicate();
499 unsigned OperandBytes
= 0;
501 if (Pred
.usesOperands()) {
502 unsigned NumOps
= cast
<CheckPredicateMatcher
>(N
)->getNumOperands();
503 OS
<< "OPC_CheckPredicateWithOperands, " << NumOps
<< "/*#Ops*/, ";
504 for (unsigned i
= 0; i
< NumOps
; ++i
)
505 OS
<< cast
<CheckPredicateMatcher
>(N
)->getOperandNo(i
) << ", ";
506 OperandBytes
= 1 + NumOps
;
508 OS
<< "OPC_CheckPredicate, ";
511 OS
<< getNodePredicate(Pred
) << ',';
513 OS
<< " // " << Pred
.getFnName();
515 return 2 + OperandBytes
;
518 case Matcher::CheckOpcode
:
519 OS
<< "OPC_CheckOpcode, TARGET_VAL("
520 << cast
<CheckOpcodeMatcher
>(N
)->getOpcode().getEnumName() << "),\n";
523 case Matcher::SwitchOpcode
:
524 case Matcher::SwitchType
: {
525 unsigned StartIdx
= CurrentIdx
;
528 if (const SwitchOpcodeMatcher
*SOM
= dyn_cast
<SwitchOpcodeMatcher
>(N
)) {
529 OS
<< "OPC_SwitchOpcode ";
530 NumCases
= SOM
->getNumCases();
532 OS
<< "OPC_SwitchType ";
533 NumCases
= cast
<SwitchTypeMatcher
>(N
)->getNumCases();
537 OS
<< "/*" << NumCases
<< " cases */";
541 // For each case we emit the size, then the opcode, then the matcher.
542 for (unsigned i
= 0, e
= NumCases
; i
!= e
; ++i
) {
543 const Matcher
*Child
;
545 if (const SwitchOpcodeMatcher
*SOM
= dyn_cast
<SwitchOpcodeMatcher
>(N
)) {
546 Child
= SOM
->getCaseMatcher(i
);
547 IdxSize
= 2; // size of opcode in table is 2 bytes.
549 Child
= cast
<SwitchTypeMatcher
>(N
)->getCaseMatcher(i
);
550 IdxSize
= 1; // size of type in table is 1 byte.
555 OS
<< "/*" << format_decimal(CurrentIdx
, IndexWidth
) << "*/";
558 OS
<< (isa
<SwitchOpcodeMatcher
>(N
) ?
559 "/*SwitchOpcode*/ " : "/*SwitchType*/ ");
562 unsigned ChildSize
= Child
->getSize();
563 CurrentIdx
+= EmitVBRValue(ChildSize
, OS
) + IdxSize
;
564 if (const SwitchOpcodeMatcher
*SOM
= dyn_cast
<SwitchOpcodeMatcher
>(N
))
565 OS
<< "TARGET_VAL(" << SOM
->getCaseOpcode(i
).getEnumName() << "),";
567 OS
<< getEnumName(cast
<SwitchTypeMatcher
>(N
)->getCaseType(i
)) << ',';
569 OS
<< "// ->" << CurrentIdx
+ ChildSize
;
572 ChildSize
= EmitMatcherList(Child
, Indent
+1, CurrentIdx
, OS
);
573 assert(ChildSize
== Child
->getSize() &&
574 "Emitted child size does not match calculated size");
575 CurrentIdx
+= ChildSize
;
578 // Emit the final zero to terminate the switch.
580 OS
<< "/*" << format_decimal(CurrentIdx
, IndexWidth
) << "*/";
581 OS
.indent(Indent
) << "0,";
583 OS
<< (isa
<SwitchOpcodeMatcher
>(N
) ?
584 " // EndSwitchOpcode" : " // EndSwitchType");
587 return CurrentIdx
- StartIdx
+ 1;
590 case Matcher::CheckType
:
591 if (cast
<CheckTypeMatcher
>(N
)->getResNo() == 0) {
592 MVT::SimpleValueType VT
= cast
<CheckTypeMatcher
>(N
)->getType();
596 OS
<< "OPC_CheckTypeI" << MVT(VT
).getSizeInBits() << ",\n";
599 OS
<< "OPC_CheckType, " << getEnumName(VT
) << ",\n";
603 OS
<< "OPC_CheckTypeRes, " << cast
<CheckTypeMatcher
>(N
)->getResNo() << ", "
604 << getEnumName(cast
<CheckTypeMatcher
>(N
)->getType()) << ",\n";
607 case Matcher::CheckChildType
: {
608 MVT::SimpleValueType VT
= cast
<CheckChildTypeMatcher
>(N
)->getType();
612 OS
<< "OPC_CheckChild" << cast
<CheckChildTypeMatcher
>(N
)->getChildNo()
613 << "TypeI" << MVT(VT
).getSizeInBits() << ",\n";
616 OS
<< "OPC_CheckChild" << cast
<CheckChildTypeMatcher
>(N
)->getChildNo()
617 << "Type, " << getEnumName(VT
) << ",\n";
622 case Matcher::CheckInteger
: {
623 OS
<< "OPC_CheckInteger, ";
625 1 + EmitSignedVBRValue(cast
<CheckIntegerMatcher
>(N
)->getValue(), OS
);
629 case Matcher::CheckChildInteger
: {
630 OS
<< "OPC_CheckChild" << cast
<CheckChildIntegerMatcher
>(N
)->getChildNo()
632 unsigned Bytes
= 1 + EmitSignedVBRValue(
633 cast
<CheckChildIntegerMatcher
>(N
)->getValue(), OS
);
637 case Matcher::CheckCondCode
:
638 OS
<< "OPC_CheckCondCode, ISD::"
639 << cast
<CheckCondCodeMatcher
>(N
)->getCondCodeName() << ",\n";
642 case Matcher::CheckChild2CondCode
:
643 OS
<< "OPC_CheckChild2CondCode, ISD::"
644 << cast
<CheckChild2CondCodeMatcher
>(N
)->getCondCodeName() << ",\n";
647 case Matcher::CheckValueType
:
648 OS
<< "OPC_CheckValueType, MVT::"
649 << cast
<CheckValueTypeMatcher
>(N
)->getTypeName() << ",\n";
652 case Matcher::CheckComplexPat
: {
653 const CheckComplexPatMatcher
*CCPM
= cast
<CheckComplexPatMatcher
>(N
);
654 const ComplexPattern
&Pattern
= CCPM
->getPattern();
655 OS
<< "OPC_CheckComplexPat, /*CP*/" << getComplexPat(Pattern
) << ", /*#*/"
656 << CCPM
->getMatchNumber() << ',';
659 OS
<< " // " << Pattern
.getSelectFunc();
660 OS
<< ":$" << CCPM
->getName();
661 for (unsigned i
= 0, e
= Pattern
.getNumOperands(); i
!= e
; ++i
)
662 OS
<< " #" << CCPM
->getFirstResult()+i
;
664 if (Pattern
.hasProperty(SDNPHasChain
))
665 OS
<< " + chain result";
671 case Matcher::CheckAndImm
: {
672 OS
<< "OPC_CheckAndImm, ";
673 unsigned Bytes
=1+EmitVBRValue(cast
<CheckAndImmMatcher
>(N
)->getValue(), OS
);
678 case Matcher::CheckOrImm
: {
679 OS
<< "OPC_CheckOrImm, ";
680 unsigned Bytes
= 1+EmitVBRValue(cast
<CheckOrImmMatcher
>(N
)->getValue(), OS
);
685 case Matcher::CheckFoldableChainNode
:
686 OS
<< "OPC_CheckFoldableChainNode,\n";
689 case Matcher::CheckImmAllOnesV
:
690 OS
<< "OPC_CheckImmAllOnesV,\n";
693 case Matcher::CheckImmAllZerosV
:
694 OS
<< "OPC_CheckImmAllZerosV,\n";
697 case Matcher::EmitInteger
: {
698 int64_t Val
= cast
<EmitIntegerMatcher
>(N
)->getValue();
699 MVT::SimpleValueType VT
= cast
<EmitIntegerMatcher
>(N
)->getVT();
707 OS
<< "OPC_EmitInteger" << MVT(VT
).getSizeInBits() << ", ";
711 OS
<< "OPC_EmitInteger, " << getEnumName(VT
) << ", ";
714 unsigned Bytes
= OpBytes
+ EmitSignedVBRValue(Val
, OS
);
718 case Matcher::EmitStringInteger
: {
719 const std::string
&Val
= cast
<EmitStringIntegerMatcher
>(N
)->getValue();
720 MVT::SimpleValueType VT
= cast
<EmitStringIntegerMatcher
>(N
)->getVT();
721 // These should always fit into 7 bits.
726 OS
<< "OPC_EmitStringInteger" << MVT(VT
).getSizeInBits() << ", ";
730 OS
<< "OPC_EmitStringInteger, " << getEnumName(VT
) << ", ";
737 case Matcher::EmitRegister
: {
738 const EmitRegisterMatcher
*Matcher
= cast
<EmitRegisterMatcher
>(N
);
739 const CodeGenRegister
*Reg
= Matcher
->getReg();
740 // If the enum value of the register is larger than one byte can handle,
741 // use EmitRegister2.
742 if (Reg
&& Reg
->EnumValue
> 255) {
743 OS
<< "OPC_EmitRegister2, " << getEnumName(Matcher
->getVT()) << ", ";
744 OS
<< "TARGET_VAL(" << getQualifiedName(Reg
->TheDef
) << "),\n";
747 OS
<< "OPC_EmitRegister, " << getEnumName(Matcher
->getVT()) << ", ";
749 OS
<< getQualifiedName(Reg
->TheDef
) << ",\n";
753 OS
<< "/*zero_reg*/";
760 case Matcher::EmitConvertToTarget
: {
761 unsigned Slot
= cast
<EmitConvertToTargetMatcher
>(N
)->getSlot();
763 OS
<< "OPC_EmitConvertToTarget" << Slot
<< ",\n";
766 OS
<< "OPC_EmitConvertToTarget, " << Slot
<< ",\n";
770 case Matcher::EmitMergeInputChains
: {
771 const EmitMergeInputChainsMatcher
*MN
=
772 cast
<EmitMergeInputChainsMatcher
>(N
);
774 // Handle the specialized forms OPC_EmitMergeInputChains1_0, 1_1, and 1_2.
775 if (MN
->getNumNodes() == 1 && MN
->getNode(0) < 3) {
776 OS
<< "OPC_EmitMergeInputChains1_" << MN
->getNode(0) << ",\n";
780 OS
<< "OPC_EmitMergeInputChains, " << MN
->getNumNodes() << ", ";
781 for (unsigned i
= 0, e
= MN
->getNumNodes(); i
!= e
; ++i
)
782 OS
<< MN
->getNode(i
) << ", ";
784 return 2+MN
->getNumNodes();
786 case Matcher::EmitCopyToReg
: {
787 const auto *C2RMatcher
= cast
<EmitCopyToRegMatcher
>(N
);
789 const CodeGenRegister
*Reg
= C2RMatcher
->getDestPhysReg();
790 unsigned Slot
= C2RMatcher
->getSrcSlot();
791 if (Reg
->EnumValue
> 255) {
792 assert(isUInt
<16>(Reg
->EnumValue
) && "not handled");
793 OS
<< "OPC_EmitCopyToRegTwoByte, " << Slot
<< ", "
794 << "TARGET_VAL(" << getQualifiedName(Reg
->TheDef
) << "),\n";
798 OS
<< "OPC_EmitCopyToReg" << Slot
<< ", "
799 << getQualifiedName(Reg
->TheDef
) << ",\n";
802 OS
<< "OPC_EmitCopyToReg, " << Slot
<< ", "
803 << getQualifiedName(Reg
->TheDef
) << ",\n";
808 case Matcher::EmitNodeXForm
: {
809 const EmitNodeXFormMatcher
*XF
= cast
<EmitNodeXFormMatcher
>(N
);
810 OS
<< "OPC_EmitNodeXForm, " << getNodeXFormID(XF
->getNodeXForm()) << ", "
811 << XF
->getSlot() << ',';
813 OS
<< " // "<<XF
->getNodeXForm()->getName();
818 case Matcher::EmitNode
:
819 case Matcher::MorphNodeTo
: {
820 auto NumCoveredBytes
= 0;
821 if (InstrumentCoverage
) {
822 if (const MorphNodeToMatcher
*SNT
= dyn_cast
<MorphNodeToMatcher
>(N
)) {
824 OS
<< "OPC_Coverage, ";
826 GetPatFromTreePatternNode(SNT
->getPattern().getSrcPattern());
828 GetPatFromTreePatternNode(SNT
->getPattern().getDstPattern());
829 Record
*PatRecord
= SNT
->getPattern().getSrcRecord();
830 std::string include_src
= getIncludePath(PatRecord
);
832 getPatternIdxFromTable(src
+ " -> " + dst
, std::move(include_src
));
833 OS
<< "TARGET_VAL(" << Offset
<< "),\n";
834 OS
.indent(FullIndexWidth
+ Indent
);
837 const EmitNodeMatcherCommon
*EN
= cast
<EmitNodeMatcherCommon
>(N
);
838 bool IsEmitNode
= isa
<EmitNodeMatcher
>(EN
);
839 OS
<< (IsEmitNode
? "OPC_EmitNode" : "OPC_MorphNodeTo");
840 bool CompressVTs
= EN
->getNumVTs() < 3;
841 bool CompressNodeInfo
= false;
843 OS
<< EN
->getNumVTs();
844 if (!EN
->hasChain() && !EN
->hasInGlue() && !EN
->hasOutGlue() &&
845 !EN
->hasMemRefs() && EN
->getNumFixedArityOperands() == -1) {
846 CompressNodeInfo
= true;
848 } else if (EN
->hasChain() && !EN
->hasInGlue() && !EN
->hasOutGlue() &&
849 !EN
->hasMemRefs() && EN
->getNumFixedArityOperands() == -1) {
850 CompressNodeInfo
= true;
852 } else if (!IsEmitNode
&& !EN
->hasChain() && EN
->hasInGlue() &&
853 !EN
->hasOutGlue() && !EN
->hasMemRefs() &&
854 EN
->getNumFixedArityOperands() == -1) {
855 CompressNodeInfo
= true;
857 } else if (!IsEmitNode
&& !EN
->hasChain() && !EN
->hasInGlue() &&
858 EN
->hasOutGlue() && !EN
->hasMemRefs() &&
859 EN
->getNumFixedArityOperands() == -1) {
860 CompressNodeInfo
= true;
865 const CodeGenInstruction
&CGI
= EN
->getInstruction();
866 OS
<< ", TARGET_VAL(" << CGI
.Namespace
<< "::" << CGI
.TheDef
->getName()
869 if (!CompressNodeInfo
) {
874 OS
<< "|OPFL_GlueInput";
875 if (EN
->hasOutGlue())
876 OS
<< "|OPFL_GlueOutput";
877 if (EN
->hasMemRefs())
878 OS
<< "|OPFL_MemRefs";
879 if (EN
->getNumFixedArityOperands() != -1)
880 OS
<< "|OPFL_Variadic" << EN
->getNumFixedArityOperands();
884 OS
.indent(FullIndexWidth
+ Indent
+4);
886 OS
<< EN
->getNumVTs();
891 for (unsigned i
= 0, e
= EN
->getNumVTs(); i
!= e
; ++i
)
892 OS
<< getEnumName(EN
->getVT(i
)) << ", ";
894 OS
<< EN
->getNumOperands();
898 unsigned NumOperandBytes
= 0;
899 for (unsigned i
= 0, e
= EN
->getNumOperands(); i
!= e
; ++i
)
900 NumOperandBytes
+= EmitVBRValue(EN
->getOperand(i
), OS
);
903 // Print the result #'s for EmitNode.
904 if (const EmitNodeMatcher
*E
= dyn_cast
<EmitNodeMatcher
>(EN
)) {
905 if (unsigned NumResults
= EN
->getNumVTs()) {
906 OS
<< " // Results =";
907 unsigned First
= E
->getFirstResultSlot();
908 for (unsigned i
= 0; i
!= NumResults
; ++i
)
909 OS
<< " #" << First
+i
;
914 if (const MorphNodeToMatcher
*SNT
= dyn_cast
<MorphNodeToMatcher
>(N
)) {
915 OS
.indent(FullIndexWidth
+ Indent
) << "// Src: "
916 << *SNT
->getPattern().getSrcPattern() << " - Complexity = "
917 << SNT
->getPattern().getPatternComplexity(CGP
) << '\n';
918 OS
.indent(FullIndexWidth
+ Indent
) << "// Dst: "
919 << *SNT
->getPattern().getDstPattern() << '\n';
924 return 4 + !CompressVTs
+ !CompressNodeInfo
+ EN
->getNumVTs() +
925 NumOperandBytes
+ NumCoveredBytes
;
927 case Matcher::CompleteMatch
: {
928 const CompleteMatchMatcher
*CM
= cast
<CompleteMatchMatcher
>(N
);
929 auto NumCoveredBytes
= 0;
930 if (InstrumentCoverage
) {
932 OS
<< "OPC_Coverage, ";
934 GetPatFromTreePatternNode(CM
->getPattern().getSrcPattern());
936 GetPatFromTreePatternNode(CM
->getPattern().getDstPattern());
937 Record
*PatRecord
= CM
->getPattern().getSrcRecord();
938 std::string include_src
= getIncludePath(PatRecord
);
940 getPatternIdxFromTable(src
+ " -> " + dst
, std::move(include_src
));
941 OS
<< "TARGET_VAL(" << Offset
<< "),\n";
942 OS
.indent(FullIndexWidth
+ Indent
);
944 OS
<< "OPC_CompleteMatch, " << CM
->getNumResults() << ", ";
945 unsigned NumResultBytes
= 0;
946 for (unsigned i
= 0, e
= CM
->getNumResults(); i
!= e
; ++i
)
947 NumResultBytes
+= EmitVBRValue(CM
->getResult(i
), OS
);
950 OS
.indent(FullIndexWidth
+ Indent
) << " // Src: "
951 << *CM
->getPattern().getSrcPattern() << " - Complexity = "
952 << CM
->getPattern().getPatternComplexity(CGP
) << '\n';
953 OS
.indent(FullIndexWidth
+ Indent
) << " // Dst: "
954 << *CM
->getPattern().getDstPattern();
957 return 2 + NumResultBytes
+ NumCoveredBytes
;
960 llvm_unreachable("Unreachable");
963 /// This function traverses the matcher tree and emits all the nodes.
964 /// The nodes have already been sized.
965 unsigned MatcherTableEmitter::
966 EmitMatcherList(const Matcher
*N
, const unsigned Indent
, unsigned CurrentIdx
,
971 OS
<< "/*" << format_decimal(CurrentIdx
, IndexWidth
) << "*/";
972 unsigned MatcherSize
= EmitMatcher(N
, Indent
, CurrentIdx
, OS
);
974 CurrentIdx
+= MatcherSize
;
976 // If there are other nodes in this list, iterate to them, otherwise we're
983 void MatcherTableEmitter::EmitNodePredicatesFunction(
984 const std::vector
<TreePredicateFn
> &Preds
, StringRef Decl
,
989 BeginEmitFunction(OS
, "bool", Decl
, true/*AddOverride*/);
991 OS
<< " switch (PredNo) {\n";
992 OS
<< " default: llvm_unreachable(\"Invalid predicate in table?\");\n";
993 for (unsigned i
= 0, e
= Preds
.size(); i
!= e
; ++i
) {
994 // Emit the predicate code corresponding to this pattern.
995 const TreePredicateFn PredFn
= Preds
[i
];
996 assert(!PredFn
.isAlwaysTrue() && "No code in this predicate");
997 std::string PredFnCodeStr
= PredFn
.getCodeToRunOnSDNode();
999 OS
<< " case " << i
<< ": {\n";
1000 for (auto *SimilarPred
: NodePredicatesByCodeToRun
[PredFnCodeStr
])
1001 OS
<< " // " << TreePredicateFn(SimilarPred
).getFnName() << '\n';
1002 OS
<< PredFnCodeStr
<< "\n }\n";
1006 EndEmitFunction(OS
);
1009 void MatcherTableEmitter::EmitPredicateFunctions(raw_ostream
&OS
) {
1010 // Emit pattern predicates.
1011 if (!PatternPredicates
.empty()) {
1012 BeginEmitFunction(OS
, "bool",
1013 "CheckPatternPredicate(unsigned PredNo) const", true/*AddOverride*/);
1015 OS
<< " switch (PredNo) {\n";
1016 OS
<< " default: llvm_unreachable(\"Invalid predicate in table?\");\n";
1017 for (unsigned i
= 0, e
= PatternPredicates
.size(); i
!= e
; ++i
)
1018 OS
<< " case " << i
<< ": return " << PatternPredicates
[i
] << ";\n";
1021 EndEmitFunction(OS
);
1024 // Emit Node predicates.
1025 EmitNodePredicatesFunction(
1026 NodePredicates
, "CheckNodePredicate(SDNode *Node, unsigned PredNo) const",
1028 EmitNodePredicatesFunction(
1029 NodePredicatesWithOperands
,
1030 "CheckNodePredicateWithOperands(SDNode *Node, unsigned PredNo, "
1031 "const SmallVectorImpl<SDValue> &Operands) const",
1034 // Emit CompletePattern matchers.
1035 // FIXME: This should be const.
1036 if (!ComplexPatterns
.empty()) {
1037 BeginEmitFunction(OS
, "bool",
1038 "CheckComplexPattern(SDNode *Root, SDNode *Parent,\n"
1039 " SDValue N, unsigned PatternNo,\n"
1040 " SmallVectorImpl<std::pair<SDValue, SDNode *>> &Result)",
1041 true/*AddOverride*/);
1043 OS
<< " unsigned NextRes = Result.size();\n";
1044 OS
<< " switch (PatternNo) {\n";
1045 OS
<< " default: llvm_unreachable(\"Invalid pattern # in table?\");\n";
1046 for (unsigned i
= 0, e
= ComplexPatterns
.size(); i
!= e
; ++i
) {
1047 const ComplexPattern
&P
= *ComplexPatterns
[i
];
1048 unsigned NumOps
= P
.getNumOperands();
1050 if (P
.hasProperty(SDNPHasChain
))
1051 ++NumOps
; // Get the chained node too.
1053 OS
<< " case " << i
<< ":\n";
1054 if (InstrumentCoverage
)
1056 OS
<< " Result.resize(NextRes+" << NumOps
<< ");\n";
1057 if (InstrumentCoverage
)
1058 OS
<< " bool Succeeded = " << P
.getSelectFunc();
1060 OS
<< " return " << P
.getSelectFunc();
1063 // If the complex pattern wants the root of the match, pass it in as the
1065 if (P
.hasProperty(SDNPWantRoot
))
1068 // If the complex pattern wants the parent of the operand being matched,
1069 // pass it in as the next argument.
1070 if (P
.hasProperty(SDNPWantParent
))
1074 for (unsigned i
= 0; i
!= NumOps
; ++i
)
1075 OS
<< ", Result[NextRes+" << i
<< "].first";
1077 if (InstrumentCoverage
) {
1078 OS
<< " if (Succeeded)\n";
1079 OS
<< " dbgs() << \"\\nCOMPLEX_PATTERN: " << P
.getSelectFunc()
1081 OS
<< " return Succeeded;\n";
1087 EndEmitFunction(OS
);
1091 // Emit SDNodeXForm handlers.
1092 // FIXME: This should be const.
1093 if (!NodeXForms
.empty()) {
1094 BeginEmitFunction(OS
, "SDValue",
1095 "RunSDNodeXForm(SDValue V, unsigned XFormNo)", true/*AddOverride*/);
1097 OS
<< " switch (XFormNo) {\n";
1098 OS
<< " default: llvm_unreachable(\"Invalid xform # in table?\");\n";
1100 // FIXME: The node xform could take SDValue's instead of SDNode*'s.
1101 for (unsigned i
= 0, e
= NodeXForms
.size(); i
!= e
; ++i
) {
1102 const CodeGenDAGPatterns::NodeXForm
&Entry
=
1103 CGP
.getSDNodeTransform(NodeXForms
[i
]);
1105 Record
*SDNode
= Entry
.first
;
1106 const std::string
&Code
= Entry
.second
;
1108 OS
<< " case " << i
<< ": { ";
1110 OS
<< "// " << NodeXForms
[i
]->getName();
1113 std::string ClassName
=
1114 std::string(CGP
.getSDNodeInfo(SDNode
).getSDClassName());
1115 if (ClassName
== "SDNode")
1116 OS
<< " SDNode *N = V.getNode();\n";
1118 OS
<< " " << ClassName
<< " *N = cast<" << ClassName
1119 << ">(V.getNode());\n";
1120 OS
<< Code
<< "\n }\n";
1124 EndEmitFunction(OS
);
1128 static StringRef
getOpcodeString(Matcher::KindTy Kind
) {
1130 case Matcher::Scope
:
1132 case Matcher::RecordNode
:
1133 return "OPC_RecordNode";
1134 case Matcher::RecordChild
:
1135 return "OPC_RecordChild";
1136 case Matcher::RecordMemRef
:
1137 return "OPC_RecordMemRef";
1138 case Matcher::CaptureGlueInput
:
1139 return "OPC_CaptureGlueInput";
1140 case Matcher::MoveChild
:
1141 return "OPC_MoveChild";
1142 case Matcher::MoveSibling
:
1143 return "OPC_MoveSibling";
1144 case Matcher::MoveParent
:
1145 return "OPC_MoveParent";
1146 case Matcher::CheckSame
:
1147 return "OPC_CheckSame";
1148 case Matcher::CheckChildSame
:
1149 return "OPC_CheckChildSame";
1150 case Matcher::CheckPatternPredicate
:
1151 return "OPC_CheckPatternPredicate";
1152 case Matcher::CheckPredicate
:
1153 return "OPC_CheckPredicate";
1154 case Matcher::CheckOpcode
:
1155 return "OPC_CheckOpcode";
1156 case Matcher::SwitchOpcode
:
1157 return "OPC_SwitchOpcode";
1158 case Matcher::CheckType
:
1159 return "OPC_CheckType";
1160 case Matcher::SwitchType
:
1161 return "OPC_SwitchType";
1162 case Matcher::CheckChildType
:
1163 return "OPC_CheckChildType";
1164 case Matcher::CheckInteger
:
1165 return "OPC_CheckInteger";
1166 case Matcher::CheckChildInteger
:
1167 return "OPC_CheckChildInteger";
1168 case Matcher::CheckCondCode
:
1169 return "OPC_CheckCondCode";
1170 case Matcher::CheckChild2CondCode
:
1171 return "OPC_CheckChild2CondCode";
1172 case Matcher::CheckValueType
:
1173 return "OPC_CheckValueType";
1174 case Matcher::CheckComplexPat
:
1175 return "OPC_CheckComplexPat";
1176 case Matcher::CheckAndImm
:
1177 return "OPC_CheckAndImm";
1178 case Matcher::CheckOrImm
:
1179 return "OPC_CheckOrImm";
1180 case Matcher::CheckFoldableChainNode
:
1181 return "OPC_CheckFoldableChainNode";
1182 case Matcher::CheckImmAllOnesV
:
1183 return "OPC_CheckImmAllOnesV";
1184 case Matcher::CheckImmAllZerosV
:
1185 return "OPC_CheckImmAllZerosV";
1186 case Matcher::EmitInteger
:
1187 return "OPC_EmitInteger";
1188 case Matcher::EmitStringInteger
:
1189 return "OPC_EmitStringInteger";
1190 case Matcher::EmitRegister
:
1191 return "OPC_EmitRegister";
1192 case Matcher::EmitConvertToTarget
:
1193 return "OPC_EmitConvertToTarget";
1194 case Matcher::EmitMergeInputChains
:
1195 return "OPC_EmitMergeInputChains";
1196 case Matcher::EmitCopyToReg
:
1197 return "OPC_EmitCopyToReg";
1198 case Matcher::EmitNode
:
1199 return "OPC_EmitNode";
1200 case Matcher::MorphNodeTo
:
1201 return "OPC_MorphNodeTo";
1202 case Matcher::EmitNodeXForm
:
1203 return "OPC_EmitNodeXForm";
1204 case Matcher::CompleteMatch
:
1205 return "OPC_CompleteMatch";
1208 llvm_unreachable("Unhandled opcode?");
1211 void MatcherTableEmitter::EmitHistogram(const Matcher
*M
,
1216 OS
<< " // Opcode Histogram:\n";
1217 for (unsigned i
= 0, e
= OpcodeCounts
.size(); i
!= e
; ++i
) {
1219 << left_justify(getOpcodeString((Matcher::KindTy
)i
), HistOpcWidth
)
1220 << " = " << OpcodeCounts
[i
] << '\n';
1226 void llvm::EmitMatcherTable(Matcher
*TheMatcher
,
1227 const CodeGenDAGPatterns
&CGP
,
1229 OS
<< "#if defined(GET_DAGISEL_DECL) && defined(GET_DAGISEL_BODY)\n";
1230 OS
<< "#error GET_DAGISEL_DECL and GET_DAGISEL_BODY cannot be both defined, ";
1231 OS
<< "undef both for inline definitions\n";
1234 // Emit a check for omitted class name.
1235 OS
<< "#ifdef GET_DAGISEL_BODY\n";
1236 OS
<< "#define LOCAL_DAGISEL_STRINGIZE(X) LOCAL_DAGISEL_STRINGIZE_(X)\n";
1237 OS
<< "#define LOCAL_DAGISEL_STRINGIZE_(X) #X\n";
1238 OS
<< "static_assert(sizeof(LOCAL_DAGISEL_STRINGIZE(GET_DAGISEL_BODY)) > 1,"
1240 OS
<< " \"GET_DAGISEL_BODY is empty: it should be defined with the class "
1242 OS
<< "#undef LOCAL_DAGISEL_STRINGIZE_\n";
1243 OS
<< "#undef LOCAL_DAGISEL_STRINGIZE\n";
1246 OS
<< "#if !defined(GET_DAGISEL_DECL) && !defined(GET_DAGISEL_BODY)\n";
1247 OS
<< "#define DAGISEL_INLINE 1\n";
1249 OS
<< "#define DAGISEL_INLINE 0\n";
1252 OS
<< "#if !DAGISEL_INLINE\n";
1253 OS
<< "#define DAGISEL_CLASS_COLONCOLON GET_DAGISEL_BODY ::\n";
1255 OS
<< "#define DAGISEL_CLASS_COLONCOLON\n";
1258 BeginEmitFunction(OS
, "void", "SelectCode(SDNode *N)", false/*AddOverride*/);
1259 MatcherTableEmitter
MatcherEmitter(CGP
);
1261 // First we size all the children of the three kinds of matchers that have
1262 // them. This is done by sharing the code in EmitMatcher(). but we don't
1263 // want to emit anything, so we turn off comments and use a null stream.
1264 bool SaveOmitComments
= OmitComments
;
1265 OmitComments
= true;
1266 raw_null_ostream NullOS
;
1267 unsigned TotalSize
= MatcherEmitter
.SizeMatcherList(TheMatcher
, NullOS
);
1268 OmitComments
= SaveOmitComments
;
1270 // Now that the matchers are sized, we can emit the code for them to the
1273 OS
<< " // Some target values are emitted as 2 bytes, TARGET_VAL handles\n";
1274 OS
<< " // this.\n";
1275 OS
<< " #define TARGET_VAL(X) X & 255, unsigned(X) >> 8\n";
1276 OS
<< " static const unsigned char MatcherTable[] = {\n";
1277 TotalSize
= MatcherEmitter
.EmitMatcherList(TheMatcher
, 1, 0, OS
);
1278 OS
<< " 0\n }; // Total Array size is " << (TotalSize
+1) << " bytes\n\n";
1280 MatcherEmitter
.EmitHistogram(TheMatcher
, OS
);
1282 OS
<< " #undef TARGET_VAL\n";
1283 OS
<< " SelectCodeCommon(N, MatcherTable,sizeof(MatcherTable));\n";
1285 EndEmitFunction(OS
);
1287 // Next up, emit the function for node and pattern predicates:
1288 MatcherEmitter
.EmitPredicateFunctions(OS
);
1290 if (InstrumentCoverage
)
1291 MatcherEmitter
.EmitPatternMatchTable(OS
);
1293 // Clean up the preprocessor macros.
1295 OS
<< "#ifdef DAGISEL_INLINE\n";
1296 OS
<< "#undef DAGISEL_INLINE\n";
1298 OS
<< "#ifdef DAGISEL_CLASS_COLONCOLON\n";
1299 OS
<< "#undef DAGISEL_CLASS_COLONCOLON\n";
1301 OS
<< "#ifdef GET_DAGISEL_DECL\n";
1302 OS
<< "#undef GET_DAGISEL_DECL\n";
1304 OS
<< "#ifdef GET_DAGISEL_BODY\n";
1305 OS
<< "#undef GET_DAGISEL_BODY\n";