1 // Copyright (C) 2009 Free Software Foundation, Inc.
2 // Contributed by Jan Sjodin <jan.sjodin@amd.com>.
4 // This file is part of the Polyhedral Compilation Package Library (libpcp).
6 // Libpcp is free software; you can redistribute it and/or modify it
7 // under the terms of the GNU Lesser General Public License as published by
8 // the Free Software Foundation; either version 2.1 of the License, or
9 // (at your option) any later version.
11 // Libpcp is distributed in the hope that it will be useful, but WITHOUT ANY
12 // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
13 // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for
16 // You should have received a copy of the GNU Lesser General Public License
17 // along with libpcp; see the file COPYING.LIB. If not, write to the
18 // Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19 // MA 02110-1301, USA.
21 // As a special exception, if you link this library with other files, some
22 // of which are compiled with GCC, to produce an executable, this library
23 // does not by itself cause the resulting executable to be covered by the
24 // GNU General Public License. This exception does not however invalidate
25 // any other reasons why the executable file might be covered by the GNU
26 // General Public License.
28 #include "pcp_error.h"
29 #include "pcp_alloc.h"
30 #include "pcp_emitter.h"
34 // Set string buffer of CONTEXT to STRINGBuffer.
36 PcpEmitter::setStringBuffer(PcpStringBuffer
* stringBuffer
)
38 this->stringBuffer
= stringBuffer
;
41 // Get string buffer of CONTEXT.
43 PcpEmitter::getStringBuffer()
45 return this->stringBuffer
;
49 PcpEmitter::setTagFilterSet(PcpSet
<const char*>* tagFilterSet
)
51 this->tagFilterSet
= tagFilterSet
;
55 PcpEmitter::getTagFilterSet()
57 return this->tagFilterSet
;
61 PcpEmitter::tagIsFiltered(const char* tag
)
63 PcpSet
<const char*>* tagSet
= this->getTagFilterSet();
64 PcpIterator
<const char*>* iter
= tagSet
->getIterator();
66 for(;iter
->hasNext();iter
->next())
68 const char* memberTag
= iter
->get();
69 if(strcmp(memberTag
, tag
) == 0)
75 // Set indent level of CONTEXT to INDENT.
77 PcpEmitter::setIndent(int indent
)
79 this->indent
= indent
;
82 // Get indent level of CONTEXT.
84 PcpEmitter::getIndent()
89 // Increment indent level of CONTEXT.
91 PcpEmitter::increment()
93 this->setIndent(this->getIndent() + 1);
96 // Decrement indent level of CONTEXT.
98 PcpEmitter::decrement()
100 this->setIndent(this->getIndent() - 1);
103 // Write indent spaces.
105 PcpEmitter::writeIndent()
108 int indent
= this->getIndent();
109 for(i
= 0; i
< indent
; i
++)
110 this->getStringBuffer()->append(" ");
115 PcpEmitter::writeNewline()
117 this->getStringBuffer()->newline();
122 PcpEmitter::writeString(const char* string
)
124 this->getStringBuffer()->append(string
);
127 // Write indented STRING.
129 PcpEmitter::writeStringIndent(const char* string
)
132 this->getStringBuffer()->append(string
);
137 PcpEmitter::writeInt(int value
)
139 this->getStringBuffer()->appendInt(value
);
142 // Convert CONTEXT to string.
144 PcpEmitter::stringBufferToString()
147 this->getStringBuffer()->toString();
151 // Write OBJECT annots.
153 PcpEmitter::emitObjectAnnots(PcpObject
* object
)
156 PcpAnnotSet
* annots
= object
->getAnnots();
163 numAnnots
= annots
->getNumAnnots();
166 for(i
= 0; i
< numAnnots
; i
++)
168 PcpAnnotTerm
* annotTerm
= annots
->getAnnot(i
);
171 if(this->tagIsFiltered(annotTerm
->getTag()))
176 this->writeString(" | ");
180 this->writeString(", ");
181 this->emitAnnotTerm(annotTerm
);
187 PcpEmitter::emitAnnot(PcpAnnot
* annot
)
189 if(annot
->isAnnotInt())
190 this->emitAnnotInt(annot
->toAnnotInt());
191 else if(annot
->isAnnotString())
192 this->emitAnnotString(annot
->toAnnotString());
193 else if(annot
->isAnnotObject())
194 this->emitAnnotObject(annot
->toAnnotObject());
196 this->emitAnnotTerm(annot
->toAnnotTerm());
199 void PcpEmitter::addFilteredTag(const char* tag
)
201 this->getTagFilterSet()->insert(tag
);
205 const char* PcpEmitter::bufferToString()
207 return this->stringBufferToString();
212 PcpEmitter::emitAnnotInt(PcpAnnotInt
* annotInt
)
214 this->writeInt(annotInt
->getValue());
217 // Write ANNOTString.
219 PcpEmitter::emitAnnotString(PcpAnnotString
* annotString
)
221 this->writeString(annotString
->getString());
224 // Write ANNOTObject.
226 PcpEmitter::emitAnnotObject(PcpAnnotObject
* annotObject
)
228 PcpObject
* object
= annotObject
->getObject();
229 pcpAssert(object
->getName() != NULL
);
230 this->writeString(object
->getName());
235 PcpEmitter::emitAnnotTerm(PcpAnnotTerm
* annotTerm
)
237 int numArguments
= annotTerm
->getNumArguments();
241 this->writeString(annotTerm
->getTag());
242 this->writeString("(");
244 for(i
= 0; i
< numArguments
; i
++)
249 this->writeString(", ");
250 this->emitAnnot(annotTerm
->getArgument(i
));
253 this->writeString( ")");
258 PcpEmitter::emitArrayTypeDef(PcpArrayType
* type
)
261 int numDims
= type
->getNumDimensions();
264 this->writeString("array(");
265 for(i
= 0; i
< numDims
; i
++)
270 this->writeString(", ");
271 this->emitExpr(type
->getDimension(i
));
273 this->emitObjectAnnots(type
);
274 this->writeString(")");
279 PcpEmitter::emitArrayTypeUse(PcpArrayType
* type
)
281 const char* name
= type
->getName();
283 this->writeString(name
);
285 this->emitArrayTypeDef(type
);
290 PcpEmitter::emitExpr(PcpExpr
* expr
)
292 if(expr
->isParameter())
293 this->emitParameterUse(expr
->toParameter());
294 else if(expr
->isConstant())
295 this->emitConstantUse(expr
->toConstant());
296 else if(expr
->isIv())
297 this->emitIvUse(expr
->toIv());
298 else if(expr
->isArith())
299 this->emitArith(expr
->toArith());
305 PcpEmitter::emitGetBoolOperatorString(PcpBoolArithOperator oper
)
307 return((oper
.isBoolAnd()) ? "and"
308 :(oper
.isBoolOr()) ? "or"
313 PcpEmitter::emitObjectNameBinding(PcpObject
* object
)
315 const char* name
= object
->getName();
319 this->writeString(name
);
320 this->writeString(" <- ");
325 PcpEmitter::emitBoolArith(PcpBoolArith
* boolArith
)
327 const char* operatorString
=
328 this->emitGetBoolOperatorString(boolArith
->getOperator());
329 int numOperands
= boolArith
->getNumOperands();
333 this->emitObjectNameBinding(boolArith
);
334 this->writeString(operatorString
);
335 this->writeString("(");
336 for(i
= 0; i
< numOperands
; i
++)
341 this->writeString(", ");
342 this->emitBoolExpr(boolArith
->getOperand(i
));
344 this->writeString(")");
349 PcpEmitter::emitBoolExpr(PcpBoolExpr
* boolExpr
)
351 if(boolExpr
->isCompare())
352 this->emitCompare(boolExpr
->toCompare());
353 else if(boolExpr
->isBoolArith())
354 this->emitBoolArith(boolExpr
->toBoolArith());
360 PcpEmitter::emitCompareOperator(PcpCompareOperator oper
)
362 const char* operatorString
= NULL
;
364 operatorString
= "eq";
365 else if(oper
.isGreaterEqual())
366 operatorString
= "ge";
370 this->writeString(operatorString
);
375 PcpEmitter::emitCompare(PcpCompare
* compare
)
377 this->emitCompareOperator(compare
->getOperator());
378 this->writeString("(");
379 this->emitExpr(compare
->getLhs());
380 this->writeString(", ");
381 this->emitExpr(compare
->getRhs());
382 this->writeString(")");
386 PcpEmitter::emitObjectNameBindingIndent(PcpObject
* object
)
389 this->emitObjectNameBinding(object
);
392 // Write CONSTANT declaration.
394 PcpEmitter::emitConstantDecl(PcpConstant
* constant
)
396 const char* name
= constant
->getName();
399 this->writeString(name
);
400 this->writeString(" <- constant(");
401 this->writeInt(constant
->getValue());
402 this->emitObjectAnnots(constant
);
403 this->writeString(")");
407 // Write CONSTANT use string.
409 PcpEmitter::emitConstantUse(PcpConstant
* constant
)
411 const char* name
= constant
->getName();
413 this->writeString(name
);
415 this->writeInt(constant
->getValue());
418 // Write IV declaration.
420 PcpEmitter::emitIvDecl(PcpIv
* iv
)
422 this->writeString(iv
->getName());
423 this->writeString(" <- iv(");
424 this->emitObjectAnnots(iv
);
425 this->writeString(")");
430 PcpEmitter::emitIvUse(PcpIv
* iv
)
432 this->writeString(iv
->getName());
435 // Write VAR declaration.
437 PcpEmitter::emitVariableDecl(PcpVariable
* var
)
439 this->writeString(var
->getName());
440 this->writeString(" <- variable(");
441 this->emitArrayTypeUse(var
->getType());
442 this->emitObjectAnnots(var
);
443 this->writeString(")");
448 PcpEmitter::emitVariableUse(PcpVariable
* var
)
450 this->writeString(var
->getName());
453 // Write PARAMETER declaration.
455 PcpEmitter::emitParameterDecl(PcpParameter
* parameter
)
457 this->writeString(parameter
->getName());
458 this->writeString(" <- parameter(");
459 this->emitObjectAnnots(parameter
);
460 this->writeString(")");
464 // Write PARAMETER use.
466 PcpEmitter::emitParameterUse(PcpParameter
* parameter
)
468 this->writeString(parameter
->getName());
474 PcpEmitter::emitGetOperatorString(PcpArithOperator oper
)
476 const char* result
= NULL
;
477 if(oper
.isAdd()) result
= "+";
478 else if(oper
.isMultiply()) result
= "*";
479 else if(oper
.isMin()) result
= "min";
480 else if(oper
.isMax()) result
= "max";
481 else if(oper
.isSubtract()) result
= "-";
482 else if(oper
.isFloor()) result
= "floor";
483 else if(oper
.isCeiling()) result
= "ceil";
484 else if(oper
.isUnknown()) result
= "UNKNOWN";
485 else pcpAssert(false);
491 PcpEmitter::emitArith(PcpArith
* arith
)
493 const char* operatorString
=
494 this->emitGetOperatorString(arith
->getOperator());
495 int numOperands
= arith
->getNumOperands();
499 this->emitObjectNameBinding(arith
);
500 this->writeString(operatorString
);
501 this->writeString("(");
502 for(i
= 0; i
< numOperands
; i
++)
507 this->writeString(", ");
508 this->emitExpr(arith
->getOperand(i
));
510 this->writeString(")");
517 PcpEmitter::emitArrayAccess(PcpArrayAccess
* access
)
520 int numSubscripts
= access
->getNumSubscripts();
521 const char* oper
= access
->isUse() ? "use" :
522 access
->isDef() ? "def" :
523 access
->isMaydef() ? "maydef" : "undefinedAccess";
525 this->emitObjectNameBinding(access
);
527 this->writeString(oper
);
528 this->writeString("(");
529 this->emitVariableUse(access
->getBase());
531 for(i
= 0; i
< numSubscripts
; i
++)
533 this->writeString(", ");
534 this->emitExpr(access
->getSubscript(i
));
536 this->emitObjectAnnots(access
);
537 this->writeString(")");
542 PcpEmitter::emitCopy(PcpCopy
* copy
)
544 this->emitObjectNameBindingIndent(copy
);
545 this->writeString("copy(");
546 this->emitArrayAccess(copy
->getDest());
547 this->writeString(", ");
548 this->emitArrayAccess(copy
->getSrc());
549 this->emitObjectAnnots(copy
);
550 this->writeString(")");
555 PcpEmitter::emitUserStmt(PcpUserStmt
* userStmt
)
559 int numAccesses
= userStmt
->getNumAccesses();
560 PcpArrayAccess
* access
;
562 this->writeStringIndent(userStmt
->getName());
563 this->writeString("(");
565 for(i
= 0; i
< numAccesses
; i
++)
570 this->writeString(", ");
572 access
= userStmt
->getArrayAccess(i
);
573 this->emitArrayAccess(access
);
575 this->emitObjectAnnots(userStmt
);
576 this->writeString(")");
581 PcpEmitter::emitSequence(PcpSequence
* sequence
)
584 int numStmts
= sequence
->getNumStmts();
586 for(i
= 0; i
< numStmts
; i
++)
591 this->writeString("\n");
592 this->emitStmt(sequence
->getStmt(i
));
598 PcpEmitter::emitStmt(PcpStmt
* stmt
)
601 this->emitCopy(stmt
->toCopy());
602 else if(stmt
->isUserStmt())
603 this->emitUserStmt(stmt
->toUserStmt());
604 else if(stmt
->isSequence())
605 this->emitSequence(stmt
->toSequence());
606 else if(stmt
->isGuard())
607 this->emitGuard(stmt
->toGuard());
608 else if(stmt
->isLoop())
609 this->emitLoop(stmt
->toLoop());
616 PcpEmitter::emitGuard(PcpGuard
* guard
)
618 this->emitObjectNameBindingIndent(guard
);
619 this->writeString("guard(");
620 this->emitBoolExpr(guard
->getCondition());
621 this->emitObjectAnnots(guard
);
622 this->writeString(")");
623 this->writeNewline();
624 this->writeStringIndent("{");
625 this->writeNewline();
628 this->emitStmt(guard
->getBody());
631 this->writeNewline();
632 this->writeStringIndent("}");
637 PcpEmitter::emitLoop(PcpLoop
* loop
)
639 this->emitObjectNameBindingIndent(loop
);
640 this->writeString("loop(");
641 this->emitIvDecl(loop
->getIv());
642 this->writeString(", ");
643 this->emitExpr(loop
->getStart());
644 this->writeString(", ");
645 this->emitBoolExpr(loop
->getCondition());
646 this->writeString(", ");
647 this->emitConstantUse(loop
->getStride());
648 this->emitObjectAnnots(loop
);
649 this->writeString(")");
650 this->writeNewline();
651 this->writeStringIndent("{");
652 this->writeNewline();
655 this->emitStmt(loop
->getBody());
658 this->writeNewline();
659 this->writeStringIndent("}");
662 // Write SCOP inputs.
664 PcpEmitter::emitScopInputs(PcpScop
* scop
)
666 int numVariables
= scop
->getNumVariables();
670 this->writeString("inputs(");
671 for(i
= 0; i
< numVariables
; i
++)
673 PcpVariable
* var
= scop
->getVariable(i
);
675 if(var
->getIsInput())
680 this->writeString(", ");
682 this->emitVariableUse(var
);
685 this->writeString(")");
688 // Write SCOP outputs into context.
690 PcpEmitter::emitScopOutputs(PcpScop
* scop
)
692 int numVariables
= scop
->getNumVariables();
696 this->writeString("outputs(");
698 for(i
= 0; i
< numVariables
; i
++)
700 PcpVariable
* var
= scop
->getVariable(i
);
702 if(var
->getIsOutput())
707 this->writeString(", ");
710 this->emitVariableUse(var
);
714 this->writeString(")");
718 // Write SCOP parameters.
720 PcpEmitter::emitScopParameters(PcpScop
* scop
)
723 int numParameters
= scop
->getNumParameters();
726 this->writeString("parameters(");
729 for(i
= 0; i
< numParameters
; i
++)
734 this->writeString(", ");
736 this->emitParameterUse(scop
->getParameter(i
));
739 this->writeString(")");
743 // Write SCOP parameter declarations.
745 PcpEmitter::emitScopParametersDecl(PcpScop
* scop
)
748 int numParameters
= scop
->getNumParameters();
750 // Write parameter declarations.
751 for(i
= 0; i
< numParameters
; i
++)
753 this->emitParameterDecl(scop
->getParameter(i
));
754 this->writeNewline();
758 // Write SCOP variable declarations.
760 PcpEmitter::emitScopVariables(PcpScop
* scop
)
763 int numVariables
= scop
->getNumVariables();
765 // Write variable declarations.
766 for(i
= 0; i
< numVariables
; i
++)
768 this->emitVariableDecl(scop
->getVariable(i
));
769 this->writeNewline();
774 PcpEmitter::emitTypeDefs(PcpScop
* scop
)
777 int numVariables
= scop
->getNumVariables();
778 PcpSet
<PcpArrayType
*>* emittedTypes
= new PcpSet
<PcpArrayType
*>();
780 for(i
= 0; i
< numVariables
; i
++)
782 PcpVariable
* variable
= scop
->getVariable(i
);
783 PcpArrayType
* type
= variable
->getType();
784 if(!emittedTypes
->contains(type
) &&
785 type
->getName() != NULL
)
787 emittedTypes
->insert(type
);
788 this->emitObjectNameBindingIndent(type
);
789 this->emitArrayTypeDef(type
);
790 this->writeNewline();
797 PcpEmitter::emitScop(PcpScop
* scop
)
799 this->emitScopParametersDecl(scop
);
800 this->emitTypeDefs(scop
);
801 this->emitScopVariables(scop
);
802 this->emitObjectNameBindingIndent(scop
);
803 this->writeStringIndent("scop(");
804 this->emitScopInputs(scop
);
805 this->writeString(", ");
806 this->emitScopOutputs(scop
);
807 this->writeString(", ");
808 this->emitScopParameters(scop
);
809 this->emitObjectAnnots(scop
);
810 this->writeString(")");
811 this->writeNewline();
812 this->writeStringIndent("{");
815 this->writeNewline();
816 this->emitStmt(scop
->getBody());
817 this->writeNewline();
820 this->writeStringIndent("}");
821 this->writeNewline();
824 // Convert ANNOT to string.
827 PcpEmitter::pcpAnnotToString(PcpAnnot
* annot
)
829 PcpEmitter
* emitter
= new PcpEmitter();
830 emitter
->emitAnnot(annot
);
831 return emitter
->bufferToString();
834 // Convert ANNOTInt to string.
836 PcpEmitter::pcpAnnotIntToString(PcpAnnotInt
* annotInt
)
838 PcpEmitter
* emitter
= new PcpEmitter();
839 emitter
->emitAnnotInt(annotInt
);
840 return emitter
->bufferToString();
843 // Convert ANNOTString to string.
845 PcpEmitter::pcpAnnotStringToString(PcpAnnotString
* annotString
)
847 PcpEmitter
* emitter
= new PcpEmitter();
848 emitter
->emitAnnotString(annotString
);
849 return emitter
->bufferToString();
852 // Convert ANNOTObject to string.
854 PcpEmitter::pcpAnnotObjectToString(PcpAnnotObject
* annotObject
)
856 PcpEmitter
* emitter
= new PcpEmitter();
857 emitter
->emitAnnotObject(annotObject
);
858 return emitter
->bufferToString();
861 // Convert ANNOTTerm to string.
863 PcpEmitter::pcpAnnotTermToString(PcpAnnotTerm
* annotTerm
)
865 PcpEmitter
* emitter
= new PcpEmitter();
866 emitter
->emitAnnotTerm(annotTerm
);
867 return emitter
->bufferToString();
870 // Convert TYPE to string.
872 PcpEmitter::pcpArrayTypeToString(PcpArrayType
* type
)
874 PcpEmitter
* emitter
= new PcpEmitter();
875 emitter
->emitArrayTypeDef(type
);
876 return emitter
->bufferToString();
879 // Convert EXPR to string.
881 PcpEmitter::pcpExprToString(PcpExpr
* expr
)
883 PcpEmitter
* emitter
= new PcpEmitter();
884 emitter
->emitExpr(expr
);
885 return emitter
->bufferToString();
888 // Convert BOOLEXPR to string.
890 PcpEmitter::pcpBoolExprToString(PcpBoolExpr
* boolExpr
)
892 PcpEmitter
* emitter
= new PcpEmitter();
893 emitter
->emitBoolExpr(boolExpr
);
894 return emitter
->bufferToString();
898 PcpEmitter::pcpCompareToString(PcpCompare
* compare
)
900 PcpEmitter
* emitter
= new PcpEmitter();
901 emitter
->emitCompare(compare
);
902 return emitter
->bufferToString();
907 PcpEmitter::pcpBoolArithToString(PcpBoolArith
* boolArith
)
909 PcpEmitter
* emitter
= new PcpEmitter();
910 emitter
->emitBoolArith(boolArith
);
911 return emitter
->bufferToString();
914 // Convert CONSTANT to declaration string.
916 PcpEmitter::pcpConstantToDeclString(PcpConstant
* constant
)
918 PcpEmitter
* emitter
= new PcpEmitter();
919 emitter
->emitConstantDecl(constant
);
920 return emitter
->bufferToString();
923 // Convert CONSTANT to use string.
925 PcpEmitter::pcpConstantToUseString(PcpConstant
* constant
)
927 PcpEmitter
* emitter
= new PcpEmitter();
928 emitter
->emitConstantUse(constant
);
929 return emitter
->bufferToString();
932 // Convert IV to declaration string.
934 PcpEmitter::pcpIvToDeclString(PcpIv
* iv
)
936 PcpEmitter
* emitter
= new PcpEmitter();
937 emitter
->emitIvDecl(iv
);
938 return emitter
->bufferToString();
941 // Convert IV to use string.
943 PcpEmitter::pcpIvToUseString(PcpIv
* iv
)
945 PcpEmitter
* emitter
= new PcpEmitter();
946 emitter
->emitIvUse(iv
);
947 return emitter
->bufferToString();
950 // Convert VAR to declaration string.
952 PcpEmitter::pcpVariableToDeclString(PcpVariable
* var
)
954 PcpEmitter
* emitter
= new PcpEmitter();
955 emitter
->emitVariableDecl(var
);
956 return emitter
->bufferToString();
959 // Convert VAR to use string.
961 PcpEmitter::pcpVariableToUseString(PcpVariable
* var
)
963 PcpEmitter
* emitter
= new PcpEmitter();
964 emitter
->emitVariableUse(var
);
965 return emitter
->bufferToString();
968 // Convert PARAMETER to declaration string.
970 PcpEmitter::pcpParameterToDeclString(PcpParameter
* parameter
)
972 PcpEmitter
* emitter
= new PcpEmitter();
973 emitter
->emitParameterDecl(parameter
);
974 return emitter
->bufferToString();
977 // Convert PARAMETER to use string.
979 PcpEmitter::pcpParameterToUseString(PcpParameter
* parameter
)
981 PcpEmitter
* emitter
= new PcpEmitter();
982 emitter
->emitParameterUse(parameter
);
983 return emitter
->bufferToString();
987 PcpEmitter::pcpArithToString(PcpArith
* arith
)
989 PcpEmitter
* emitter
= new PcpEmitter();
990 emitter
->emitArith(arith
);
991 return emitter
->bufferToString();
995 // Convert ACCESS to string.
997 PcpEmitter::pcpArrayAccessToString(PcpArrayAccess
* access
)
999 PcpEmitter
* emitter
= new PcpEmitter();
1000 emitter
->emitArrayAccess(access
);
1001 return emitter
->bufferToString();
1004 // Convert COPY to string.
1006 PcpEmitter::pcpCopyToString(PcpCopy
* copy
)
1008 PcpEmitter
* emitter
= new PcpEmitter();
1009 emitter
->emitCopy(copy
);
1010 return emitter
->bufferToString();
1013 // Convert USERStmt to string.
1015 PcpEmitter::pcpUserStmtToString(PcpUserStmt
* userStmt
)
1017 PcpEmitter
* emitter
= new PcpEmitter();
1018 emitter
->emitUserStmt(userStmt
);
1019 return emitter
->bufferToString();
1022 // Convert SEQUENCE to string.
1024 PcpEmitter::pcpSequenceToString(PcpSequence
* sequence
)
1026 PcpEmitter
* emitter
= new PcpEmitter();
1027 emitter
->emitSequence(sequence
);
1028 return emitter
->bufferToString();
1032 // Convert STMT to string.
1034 PcpEmitter::pcpStmtToString(PcpStmt
* stmt
)
1036 PcpEmitter
* emitter
= new PcpEmitter();
1037 emitter
->emitStmt(stmt
);
1038 return emitter
->bufferToString();
1041 // Convert GUARD to string.
1043 PcpEmitter::pcpGuardToString(PcpGuard
* guard
)
1045 PcpEmitter
* emitter
= new PcpEmitter();
1046 emitter
->emitGuard(guard
);
1047 return emitter
->bufferToString();
1050 // Convert LOOP to string.
1052 PcpEmitter::pcpLoopToString(PcpLoop
* loop
)
1054 PcpEmitter
* emitter
= new PcpEmitter();
1055 emitter
->emitLoop(loop
);
1056 return emitter
->bufferToString();
1059 // Convert SCOP into string.
1061 PcpEmitter::pcpScopToString(PcpScop
* scop
)
1063 PcpEmitter
* emitter
= new PcpEmitter();
1064 emitter
->getTagFilterSet()->insert("lineinfo");
1065 emitter
->emitScop(scop
);
1066 return emitter
->bufferToString();
1069 PcpEmitter::PcpEmitter()
1072 this->setStringBuffer(new PcpStringBuffer());
1073 this->setTagFilterSet(new PcpSet
<const char*>());