Lines Matching refs:Out

94     formatted_raw_ostream &Out;
109 ModulePass(ID), Out(o), uniqueNum(0), is_inline(false), indent_level(0){}
127 formatted_raw_ostream& nl(formatted_raw_ostream &Out, int delta = 0);
166 formatted_raw_ostream &CppWriter::nl(formatted_raw_ostream &Out, int delta) {
167 Out << '\n';
170 Out.indent(indent_level);
171 return Out;
221 Out << "ConstantFP::get(mod->getContext(), ";
222 Out << "APFloat(";
231 Out << "BitsToDouble(" << Buffer << ")";
233 Out << "BitsToFloat((float)" << Buffer << ")";
234 Out << ")";
249 Out << StrVal;
251 Out << StrVal << "f";
253 Out << "BitsToDouble(0x"
257 Out << "BitsToFloat(0x"
261 Out << ")";
265 Out << ")";
271 case CallingConv::C: Out << "CallingConv::C"; break;
272 case CallingConv::Fast: Out << "CallingConv::Fast"; break;
273 case CallingConv::Cold: Out << "CallingConv::Cold"; break;
274 case CallingConv::FirstTargetCC: Out << "CallingConv::FirstTargetCC"; break;
275 default: Out << cc; break;
282 Out << "GlobalValue::InternalLinkage"; break;
284 Out << "GlobalValue::PrivateLinkage"; break;
286 Out << "GlobalValue::LinkerPrivateLinkage"; break;
288 Out << "GlobalValue::LinkerPrivateWeakLinkage"; break;
290 Out << "GlobalValue::AvailableExternallyLinkage "; break;
292 Out << "GlobalValue::LinkOnceAnyLinkage "; break;
294 Out << "GlobalValue::LinkOnceODRLinkage "; break;
296 Out << "GlobalValue::WeakAnyLinkage"; break;
298 Out << "GlobalValue::WeakODRLinkage"; break;
300 Out << "GlobalValue::AppendingLinkage"; break;
302 Out << "GlobalValue::ExternalLinkage"; break;
304 Out << "GlobalValue::DLLImportLinkage"; break;
306 Out << "GlobalValue::DLLExportLinkage"; break;
308 Out << "GlobalValue::ExternalWeakLinkage"; break;
310 Out << "GlobalValue::CommonLinkage"; break;
317 Out << "GlobalValue::DefaultVisibility";
320 Out << "GlobalValue::HiddenVisibility";
323 Out << "GlobalValue::ProtectedVisibility";
331 Out << "GlobalVariable::NotThreadLocal";
334 Out << "GlobalVariable::GeneralDynamicTLSModel";
337 Out << "GlobalVariable::LocalDynamicTLSModel";
340 Out << "GlobalVariable::InitialExecTLSModel";
343 Out << "GlobalVariable::LocalExecTLSModel";
354 Out << C;
356 Out << "\\x"
468 Out << "AttributeSet " << name << "_PAL;";
469 nl(Out);
471 Out << '{'; in(); nl(Out);
472 Out << "SmallVector<AttributeSet, 4> Attrs;"; nl(Out);
473 Out << "AttributeSet PAS;"; in(); nl(Out);
477 Out << "{"; in(); nl(Out);
478 Out << "AttrBuilder B;"; nl(Out);
482 Out << "B.addAttribute(Attribute::" #X ");"; nl(Out); \
516 Out << "B.addStackAlignmentAttr(" << attrs.getStackAlignment()<<')';
517 nl(Out);
521 Out << "PAS = AttributeSet::get(mod->getContext(), ";
523 Out << "~0U,";
525 Out << index << "U,";
526 Out << " B);"; out(); nl(Out);
527 Out << "}"; out(); nl(Out);
528 nl(Out);
529 Out << "Attrs.push_back(PAS);"; nl(Out);
531 Out << name << "_PAL = AttributeSet::get(mod->getContext(), Attrs);";
532 nl(Out);
533 out(); nl(Out);
534 Out << '}'; nl(Out);
554 Out << "std::vector<Type*>" << typeName << "_args;";
555 nl(Out);
562 Out << typeName << "_args.push_back(" << argName;
563 Out << ");";
564 nl(Out);
568 Out << "FunctionType* " << typeName << " = FunctionType::get(";
569 in(); nl(Out) << "/*Result=*/" << retTypeName;
570 Out << ",";
571 nl(Out) << "/*Params=*/" << typeName << "_args,";
572 nl(Out) << "/*isVarArg=*/" << (FT->isVarArg() ? "true" : "false") << ");";
574 nl(Out);
580 Out << "StructType *" << typeName << " = mod->getTypeByName(\"";
582 Out << "\");";
583 nl(Out);
584 Out << "if (!" << typeName << ") {";
585 nl(Out);
586 Out << typeName << " = ";
587 Out << "StructType::create(mod->getContext(), \"";
589 Out << "\");";
590 nl(Out);
591 Out << "}";
592 nl(Out);
597 Out << "std::vector<Type*>" << typeName << "_fields;";
598 nl(Out);
605 Out << typeName << "_fields.push_back(" << fieldName;
606 Out << ");";
607 nl(Out);
611 Out << "StructType *" << typeName << " = ";
612 Out << "StructType::get(" << "mod->getContext(), ";
614 Out << "if (" << typeName << "->isOpaque()) {";
615 nl(Out);
616 Out << typeName << "->setBody(";
619 Out << typeName << "_fields, /*isPacked=*/"
621 nl(Out);
623 Out << "}";
624 nl(Out);
634 Out << "ArrayType* " << typeName << " = ArrayType::get("
637 nl(Out);
647 Out << "PointerType* " << typeName << " = PointerType::get("
650 nl(Out);
660 Out << "VectorType* " << typeName << " = VectorType::get("
663 nl(Out);
675 nl(Out);
726 Out << "ConstantInt* " << constName
731 Out << "ConstantAggregateZero* " << constName
734 Out << "ConstantPointerNull* " << constName
737 Out << "ConstantFP* " << constName << " = ";
739 Out << ";";
741 Out << "std::vector<Constant*> " << constName << "_elems;";
742 nl(Out);
746 Out << constName << "_elems.push_back("
748 nl(Out);
750 Out << "Constant* " << constName << " = ConstantArray::get("
753 Out << "std::vector<Constant*> " << constName << "_fields;";
754 nl(Out);
758 Out << constName << "_fields.push_back("
760 nl(Out);
762 Out << "Constant* " << constName << " = ConstantStruct::get("
765 Out << "std::vector<Constant*> " << constName << "_elems;";
766 nl(Out);
770 Out << constName << "_elems.push_back("
772 nl(Out);
774 Out << "Constant* " << constName << " = ConstantVector::get("
777 Out << "UndefValue* " << constName << " = UndefValue::get("
782 Out << "Constant *" << constName <<
793 Out << "\", true);";
795 Out << "\", false);";// No null terminator
798 Out << "std::vector<Constant*> " << constName << "_elems;";
799 nl(Out);
803 Out << constName << "_elems.push_back(" << getCppName(Elt) << ");";
804 nl(Out);
806 Out << "Constant* " << constName;
809 Out << " = ConstantArray::get(";
811 Out << " = ConstantVector::get(";
812 Out << typeName << ", " << constName << "_elems);";
816 Out << "std::vector<Constant*> " << constName << "_indices;";
817 nl(Out);
821 Out << constName << "_indices.push_back("
823 nl(Out);
825 Out << "Constant* " << constName
831 Out << "Constant* " << constName << " = ConstantExpr::getCast(";
834 case Instruction::Trunc: Out << "Instruction::Trunc"; break;
835 case Instruction::ZExt: Out << "Instruction::ZExt"; break;
836 case Instruction::SExt: Out << "Instruction::SExt"; break;
837 case Instruction::FPTrunc: Out << "Instruction::FPTrunc"; break;
838 case Instruction::FPExt: Out << "Instruction::FPExt"; break;
839 case Instruction::FPToUI: Out << "Instruction::FPToUI"; break;
840 case Instruction::FPToSI: Out << "Instruction::FPToSI"; break;
841 case Instruction::UIToFP: Out << "Instruction::UIToFP"; break;
842 case Instruction::SIToFP: Out << "Instruction::SIToFP"; break;
843 case Instruction::PtrToInt: Out << "Instruction::PtrToInt"; break;
844 case Instruction::IntToPtr: Out << "Instruction::IntToPtr"; break;
845 case Instruction::BitCast: Out << "Instruction::BitCast"; break;
847 Out << ", " << getCppName(CE->getOperand(0)) << ", "
854 Out << "Constant* " << constName << " = ConstantExpr::";
856 case Instruction::Add: Out << "getAdd("; break;
857 case Instruction::FAdd: Out << "getFAdd("; break;
858 case Instruction::Sub: Out << "getSub("; break;
859 case Instruction::FSub: Out << "getFSub("; break;
860 case Instruction::Mul: Out << "getMul("; break;
861 case Instruction::FMul: Out << "getFMul("; break;
862 case Instruction::UDiv: Out << "getUDiv("; break;
863 case Instruction::SDiv: Out << "getSDiv("; break;
864 case Instruction::FDiv: Out << "getFDiv("; break;
865 case Instruction::URem: Out << "getURem("; break;
866 case Instruction::SRem: Out << "getSRem("; break;
867 case Instruction::FRem: Out << "getFRem("; break;
868 case Instruction::And: Out << "getAnd("; break;
869 case Instruction::Or: Out << "getOr("; break;
870 case Instruction::Xor: Out << "getXor("; break;
872 Out << "getICmp(ICmpInst::ICMP_";
874 case ICmpInst::ICMP_EQ: Out << "EQ"; break;
875 case ICmpInst::ICMP_NE: Out << "NE"; break;
876 case ICmpInst::ICMP_SLT: Out << "SLT"; break;
877 case ICmpInst::ICMP_ULT: Out << "ULT"; break;
878 case ICmpInst::ICMP_SGT: Out << "SGT"; break;
879 case ICmpInst::ICMP_UGT: Out << "UGT"; break;
880 case ICmpInst::ICMP_SLE: Out << "SLE"; break;
881 case ICmpInst::ICMP_ULE: Out << "ULE"; break;
882 case ICmpInst::ICMP_SGE: Out << "SGE"; break;
883 case ICmpInst::ICMP_UGE: Out << "UGE"; break;
888 Out << "getFCmp(FCmpInst::FCMP_";
890 case FCmpInst::FCMP_FALSE: Out << "FALSE"; break;
891 case FCmpInst::FCMP_ORD: Out << "ORD"; break;
892 case FCmpInst::FCMP_UNO: Out << "UNO"; break;
893 case FCmpInst::FCMP_OEQ: Out << "OEQ"; break;
894 case FCmpInst::FCMP_UEQ: Out << "UEQ"; break;
895 case FCmpInst::FCMP_ONE: Out << "ONE"; break;
896 case FCmpInst::FCMP_UNE: Out << "UNE"; break;
897 case FCmpInst::FCMP_OLT: Out << "OLT"; break;
898 case FCmpInst::FCMP_ULT: Out << "ULT"; break;
899 case FCmpInst::FCMP_OGT: Out << "OGT"; break;
900 case FCmpInst::FCMP_UGT: Out << "UGT"; break;
901 case FCmpInst::FCMP_OLE: Out << "OLE"; break;
902 case FCmpInst::FCMP_ULE: Out << "ULE"; break;
903 case FCmpInst::FCMP_OGE: Out << "OGE"; break;
904 case FCmpInst::FCMP_UGE: Out << "UGE"; break;
905 case FCmpInst::FCMP_TRUE: Out << "TRUE"; break;
909 case Instruction::Shl: Out << "getShl("; break;
910 case Instruction::LShr: Out << "getLShr("; break;
911 case Instruction::AShr: Out << "getAShr("; break;
912 case Instruction::Select: Out << "getSelect("; break;
913 case Instruction::ExtractElement: Out << "getExtractElement("; break;
914 case Instruction::InsertElement: Out << "getInsertElement("; break;
915 case Instruction::ShuffleVector: Out << "getShuffleVector("; break;
920 Out << getCppName(CE->getOperand(0));
922 Out << ", " << getCppName(CE->getOperand(i));
923 Out << ");";
926 Out << "Constant* " << constName << " = ";
927 Out << "BlockAddress::get(" << getOpName(BA->getBasicBlock()) << ");";
930 Out << "Constant* " << constName << " = 0; ";
932 nl(Out);
961 nl(Out) << "// Type Definitions";
962 nl(Out);
968 nl(Out)<< "/ Function Declarations"; nl(Out);
971 nl(Out) << "// Global Variable Declarations"; nl(Out);
974 nl(Out) << "// Global Variable Definitions"; nl(Out);
977 nl(Out) << "// Constant Definitions"; nl(Out);
984 nl(Out) << "GlobalVariable* " << getCppName(GV);
986 Out << " = mod->getGlobalVariable(mod->getContext(), ";
988 Out << ", " << getCppName(GV->getType()->getElementType()) << ",true)";
989 nl(Out) << "if (!" << getCppName(GV) << ") {";
990 in(); nl(Out) << getCppName(GV);
992 Out << " = new GlobalVariable(/*Module=*/*mod, ";
993 nl(Out) << "/*Type=*/";
995 Out << ",";
996 nl(Out) << "/*isConstant=*/" << (GV->isConstant()?"true":"false");
997 Out << ",";
998 nl(Out) << "/*Linkage=*/";
1000 Out << ",";
1001 nl(Out) << "/*Initializer=*/0, ";
1003 Out << "// has initializer, specified below";
1005 nl(Out) << "/*Name=*/\"";
1007 Out << "\");";
1008 nl(Out);
1012 Out << "->setSection(\"";
1014 Out << "\");";
1015 nl(Out);
1019 Out << "->setAlignment(" << utostr(GV->getAlignment()) << ");";
1020 nl(Out);
1024 Out << "->setVisibility(";
1026 Out << ");";
1027 nl(Out);
1031 Out << "->setThreadLocalMode(";
1033 Out << ");";
1034 nl(Out);
1037 out(); Out << "}"; nl(Out);
1044 Out << "->setInitializer(";
1045 Out << getCppName(GV->getInitializer()) << ");";
1046 nl(Out);
1066 Out << "Argument* " << result << " = new Argument("
1068 nl(Out);
1113 Out << "ReturnInst::Create(mod->getContext(), "
1119 Out << "BranchInst::Create(" ;
1121 Out << opNames[2] << ", "
1126 Out << opNames[0] << ", ";
1130 Out << bbname << ");";
1135 Out << "SwitchInst* " << iName << " = SwitchInst::Create("
1139 nl(Out);
1144 Out << iName << "->addCase("
1147 nl(Out);
1153 Out << "IndirectBrInst *" << iName << " = IndirectBrInst::Create("
1155 nl(Out);
1157 Out << iName << "->addDestination(" << opNames[i] << ");";
1158 nl(Out);
1163 Out << "ResumeInst::Create(" << opNames[0] << ", " << bbname << ");";
1168 Out << "std::vector<Value*> " << iName << "_params;";
1169 nl(Out);
1171 Out << iName << "_params.push_back("
1173 nl(Out);
1176 Out << "InvokeInst *" << iName << " = InvokeInst::Create("
1182 Out << "\", " << bbname << ");";
1183 nl(Out) << iName << "->setCallingConv(";
1185 Out << ");";
1187 Out << iName << "->setAttributes(" << iName << "_PAL);";
1188 nl(Out);
1192 Out << "new UnreachableInst("
1215 Out << "BinaryOperator* " << iName << " = BinaryOperator::Create(";
1217 case Instruction::Add: Out << "Instruction::Add"; break;
1218 case Instruction::FAdd: Out << "Instruction::FAdd"; break;
1219 case Instruction::Sub: Out << "Instruction::Sub"; break;
1220 case Instruction::FSub: Out << "Instruction::FSub"; break;
1221 case Instruction::Mul: Out << "Instruction::Mul"; break;
1222 case Instruction::FMul: Out << "Instruction::FMul"; break;
1223 case Instruction::UDiv:Out << "Instruction::UDiv"; break;
1224 case Instruction::SDiv:Out << "Instruction::SDiv"; break;
1225 case Instruction::FDiv:Out << "Instruction::FDiv"; break;
1226 case Instruction::URem:Out << "Instruction::URem"; break;
1227 case Instruction::SRem:Out << "Instruction::SRem"; break;
1228 case Instruction::FRem:Out << "Instruction::FRem"; break;
1229 case Instruction::And: Out << "Instruction::And"; break;
1230 case Instruction::Or: Out << "Instruction::Or"; break;
1231 case Instruction::Xor: Out << "Instruction::Xor"; break;
1232 case Instruction::Shl: Out << "Instruction::Shl"; break;
1233 case Instruction::LShr:Out << "Instruction::LShr"; break;
1234 case Instruction::AShr:Out << "Instruction::AShr"; break;
1235 default: Out << "Instruction::BadOpCode"; break;
1237 Out << ", " << opNames[0] << ", " << opNames[1] << ", \"";
1239 Out << "\", " << bbname << ");";
1243 Out << "FCmpInst* " << iName << " = new FCmpInst(*" << bbname << ", ";
1245 case FCmpInst::FCMP_FALSE: Out << "FCmpInst::FCMP_FALSE"; break;
1246 case FCmpInst::FCMP_OEQ : Out << "FCmpInst::FCMP_OEQ"; break;
1247 case FCmpInst::FCMP_OGT : Out << "FCmpInst::FCMP_OGT"; break;
1248 case FCmpInst::FCMP_OGE : Out << "FCmpInst::FCMP_OGE"; break;
1249 case FCmpInst::FCMP_OLT : Out << "FCmpInst::FCMP_OLT"; break;
1250 case FCmpInst::FCMP_OLE : Out << "FCmpInst::FCMP_OLE"; break;
1251 case FCmpInst::FCMP_ONE : Out << "FCmpInst::FCMP_ONE"; break;
1252 case FCmpInst::FCMP_ORD : Out << "FCmpInst::FCMP_ORD"; break;
1253 case FCmpInst::FCMP_UNO : Out << "FCmpInst::FCMP_UNO"; break;
1254 case FCmpInst::FCMP_UEQ : Out << "FCmpInst::FCMP_UEQ"; break;
1255 case FCmpInst::FCMP_UGT : Out << "FCmpInst::FCMP_UGT"; break;
1256 case FCmpInst::FCMP_UGE : Out << "FCmpInst::FCMP_UGE"; break;
1257 case FCmpInst::FCMP_ULT : Out << "FCmpInst::FCMP_ULT"; break;
1258 case FCmpInst::FCMP_ULE : Out << "FCmpInst::FCMP_ULE"; break;
1259 case FCmpInst::FCMP_UNE : Out << "FCmpInst::FCMP_UNE"; break;
1260 case FCmpInst::FCMP_TRUE : Out << "FCmpInst::FCMP_TRUE"; break;
1261 default: Out << "FCmpInst::BAD_ICMP_PREDICATE"; break;
1263 Out << ", " << opNames[0] << ", " << opNames[1] << ", \"";
1265 Out << "\");";
1269 Out << "ICmpInst* " << iName << " = new ICmpInst(*" << bbname << ", ";
1271 case ICmpInst::ICMP_EQ: Out << "ICmpInst::ICMP_EQ"; break;
1272 case ICmpInst::ICMP_NE: Out << "ICmpInst::ICMP_NE"; break;
1273 case ICmpInst::ICMP_ULE: Out << "ICmpInst::ICMP_ULE"; break;
1274 case ICmpInst::ICMP_SLE: Out << "ICmpInst::ICMP_SLE"; break;
1275 case ICmpInst::ICMP_UGE: Out << "ICmpInst::ICMP_UGE"; break;
1276 case ICmpInst::ICMP_SGE: Out << "ICmpInst::ICMP_SGE"; break;
1277 case ICmpInst::ICMP_ULT: Out << "ICmpInst::ICMP_ULT"; break;
1278 case ICmpInst::ICMP_SLT: Out << "ICmpInst::ICMP_SLT"; break;
1279 case ICmpInst::ICMP_UGT: Out << "ICmpInst::ICMP_UGT"; break;
1280 case ICmpInst::ICMP_SGT: Out << "ICmpInst::ICMP_SGT"; break;
1281 default: Out << "ICmpInst::BAD_ICMP_PREDICATE"; break;
1283 Out << ", " << opNames[0] << ", " << opNames[1] << ", \"";
1285 Out << "\");";
1290 Out << "AllocaInst* " << iName << " = new AllocaInst("
1293 Out << opNames[0] << ", ";
1294 Out << "\"";
1296 Out << "\", " << bbname << ");";
1298 nl(Out) << iName << "->setAlignment("
1304 Out << "LoadInst* " << iName << " = new LoadInst("
1307 Out << "\", " << (load->isVolatile() ? "true" : "false" )
1310 nl(Out) << iName << "->setAlignment("
1315 nl(Out) << iName << "->setAtomic("
1322 Out << "StoreInst* " << iName << " = new StoreInst("
1328 nl(Out) << iName << "->setAlignment("
1333 nl(Out) << iName << "->setAtomic("
1341 Out << "GetElementPtrInst* " << iName << " = GetElementPtrInst::Create("
1344 Out << ", " << opNames[1];
1346 Out << "std::vector<Value*> " << iName << "_indices;";
1347 nl(Out);
1349 Out << iName << "_indices.push_back("
1351 nl(Out);
1353 Out << "Instruction* " << iName << " = GetElementPtrInst::Create("
1356 Out << ", \"";
1358 Out << "\", " << bbname << ");";
1364 Out << "PHINode* " << iName << " = PHINode::Create("
1368 Out << "\", " << bbname << ");";
1369 nl(Out);
1371 Out << iName << "->addIncoming("
1374 nl(Out);
1391 Out << "CastInst* " << iName << " = new ";
1393 case Instruction::Trunc: Out << "TruncInst"; break;
1394 case Instruction::ZExt: Out << "ZExtInst"; break;
1395 case Instruction::SExt: Out << "SExtInst"; break;
1396 case Instruction::FPTrunc: Out << "FPTruncInst"; break;
1397 case Instruction::FPExt: Out << "FPExtInst"; break;
1398 case Instruction::FPToUI: Out << "FPToUIInst"; break;
1399 case Instruction::FPToSI: Out << "FPToSIInst"; break;
1400 case Instruction::UIToFP: Out << "UIToFPInst"; break;
1401 case Instruction::SIToFP: Out << "SIToFPInst"; break;
1402 case Instruction::PtrToInt: Out << "PtrToIntInst"; break;
1403 case Instruction::IntToPtr: Out << "IntToPtrInst"; break;
1404 case Instruction::BitCast: Out << "BitCastInst"; break;
1407 Out << "(" << opNames[0] << ", "
1410 Out << "\", " << bbname << ");";
1416 Out << "InlineAsm* " << getCppName(ila) << " = InlineAsm::get("
1421 nl(Out);
1424 Out << "std::vector<Value*> " << iName << "_params;";
1425 nl(Out);
1427 Out << iName << "_params.push_back(" << opNames[i] << ");";
1428 nl(Out);
1430 Out << "CallInst* " << iName << " = CallInst::Create("
1434 Out << "CallInst* " << iName << " = CallInst::Create("
1437 Out << "CallInst* " << iName << " = CallInst::Create("
1441 Out << "\", " << bbname << ");";
1442 nl(Out) << iName << "->setCallingConv(";
1444 Out << ");";
1445 nl(Out) << iName << "->setTailCall("
1447 Out << ");";
1448 nl(Out);
1450 Out << iName << "->setAttributes(" << iName << "_PAL);";
1451 nl(Out);
1456 Out << "SelectInst* " << getCppName(sel) << " = SelectInst::Create(";
1457 Out << opNames[0] << ", " << opNames[1] << ", " << opNames[2] << ", \"";
1459 Out << "\", " << bbname << ");";
1470 Out << "VAArgInst* " << getCppName(va) << " = new VAArgInst("
1473 Out << "\", " << bbname << ");";
1478 Out << "ExtractElementInst* " << getCppName(eei)
1482 Out << "\", " << bbname << ");";
1487 Out << "InsertElementInst* " << getCppName(iei)
1491 Out << "\", " << bbname << ");";
1496 Out << "ShuffleVectorInst* " << getCppName(svi)
1500 Out << "\", " << bbname << ");";
1505 Out << "std::vector<unsigned> " << iName << "_indices;";
1506 nl(Out);
1508 Out << iName << "_indices.push_back("
1510 nl(Out);
1512 Out << "ExtractValueInst* " << getCppName(evi)
1517 Out << "\", " << bbname << ");";
1522 Out << "std::vector<unsigned> " << iName << "_indices;";
1523 nl(Out);
1525 Out << iName << "_indices.push_back("
1527 nl(Out);
1529 Out << "InsertValueInst* " << getCppName(ivi)
1534 Out << "\", " << bbname << ");";
1541 Out << "FenceInst* " << iName
1551 Out << "AtomicCmpXchgInst* " << iName
1556 nl(Out) << iName << "->setName(\"";
1558 Out << "\");";
1580 Out << "AtomicRMWInst* " << iName
1586 nl(Out) << iName << "->setName(\"";
1588 Out << "\");";
1593 Out << "LandingPadInst* " << iName << " = LandingPadInst::Create(";
1595 Out << ", " << opNames[0] << ", " << lpi->getNumClauses() << ", \"";
1597 Out << "\", " << bbname << ");";
1598 nl(Out) << iName << "->setCleanup("
1602 nl(Out) << iName << "->addClause(" << opNames[i+1] << ");";
1607 nl(Out);
1613 nl(Out) << "// Type Definitions"; nl(Out);
1671 nl(Out) << "// Function Declarations"; nl(Out);
1681 nl(Out) << "// Global Variable Declarations"; nl(Out);
1689 nl(Out) << "// Constant Definitions"; nl(Out);
1699 nl(Out) << "// Global Variable Definitions"; nl(Out);
1709 nl(Out) << "Function* " << getCppName(F);
1710 Out << " = mod->getFunction(\"";
1712 Out << "\");";
1713 nl(Out) << "if (!" << getCppName(F) << ") {";
1714 nl(Out) << getCppName(F);
1716 Out<< " = Function::Create(";
1717 nl(Out,1) << "/*Type=*/" << getCppName(F->getFunctionType()) << ",";
1718 nl(Out) << "/*Linkage=*/";
1720 Out << ",";
1721 nl(Out) << "/*Name=*/\"";
1723 Out << "\", mod); " << (F->isDeclaration()? "// (external, no body)" : "");
1724 nl(Out,-1);
1726 Out << "->setCallingConv(";
1728 Out << ");";
1729 nl(Out);
1732 Out << "->setSection(\"" << F->getSection() << "\");";
1733 nl(Out);
1737 Out << "->setAlignment(" << F->getAlignment() << ");";
1738 nl(Out);
1742 Out << "->setVisibility(";
1744 Out << ");";
1745 nl(Out);
1749 Out << "->setGC(\"" << F->getGC() << "\");";
1750 nl(Out);
1752 Out << "}";
1753 nl(Out);
1756 Out << "->setAttributes(" << getCppName(F) << "_PAL);";
1757 nl(Out);
1772 Out << "Function::arg_iterator args = " << getCppName(F)
1774 nl(Out);
1778 Out << "Value* " << getCppName(AI) << " = args++;";
1779 nl(Out);
1781 Out << getCppName(AI) << "->setName(\"";
1783 Out << "\");";
1784 nl(Out);
1790 nl(Out);
1794 Out << "BasicBlock* " << bbname <<
1798 Out << "\"," << getCppName(BI->getParent()) << ",0);";
1799 nl(Out);
1806 nl(Out) << "// Block " << BI->getName() << " (" << bbname << ")";
1807 nl(Out);
1819 nl(Out) << "// Resolve Forward References";
1820 nl(Out);
1825 Out << I->second << "->replaceAllUsesWith("
1827 nl(Out);
1843 nl(Out) << "BasicBlock* " << fname << "(Module* mod, Function *"
1848 Out << ", Value* arg_" << arg_count++;
1850 Out << ") {";
1851 nl(Out);
1856 Out << "return " << getCppName(F->begin()) << ";";
1857 nl(Out) << "}";
1858 nl(Out);
1863 nl(Out) << "// Type Definitions"; nl(Out);
1868 nl(Out) << "// Function Declarations"; nl(Out);
1875 nl(Out) << "// Global Variable Declarations\n"; nl(Out);
1884 nl(Out) << "// Constant Definitions"; nl(Out);
1890 nl(Out) << "// Global Variable Definitions"; nl(Out);
1897 nl(Out) << "// Function Definitions"; nl(Out);
1901 nl(Out) << "// Function: " << I->getName() << " (" << getCppName(I)
1903 nl(Out) << "{";
1904 nl(Out,1);
1906 nl(Out,-1) << "}";
1907 nl(Out);
1914 Out << "#include <llvm/Pass.h>\n";
1915 Out << "#include <llvm/PassManager.h>\n";
1917 Out << "#include <llvm/ADT/SmallVector.h>\n";
1918 Out << "#include <llvm/Analysis/Verifier.h>\n";
1919 Out << "#include <llvm/Assembly/PrintModulePass.h>\n";
1920 Out << "#include <llvm/IR/BasicBlock.h>\n";
1921 Out << "#include <llvm/IR/CallingConv.h>\n";
1922 Out << "#include <llvm/IR/Constants.h>\n";
1923 Out << "#include <llvm/IR/DerivedTypes.h>\n";
1924 Out << "#include <llvm/IR/Function.h>\n";
1925 Out << "#include <llvm/IR/GlobalVariable.h>\n";
1926 Out << "#include <llvm/IR/InlineAsm.h>\n";
1927 Out << "#include <llvm/IR/Instructions.h>\n";
1928 Out << "#include <llvm/IR/LLVMContext.h>\n";
1929 Out << "#include <llvm/IR/Module.h>\n";
1930 Out << "#include <llvm/Support/FormattedStream.h>\n";
1931 Out << "#include <llvm/Support/MathExtras.h>\n";
1932 Out << "#include <algorithm>\n";
1933 Out << "using namespace llvm;\n\n";
1934 Out << "Module* " << fname << "();\n\n";
1935 Out << "int main(int argc, char**argv) {\n";
1936 Out << " Module* Mod = " << fname << "();\n";
1937 Out << " verifyModule(*Mod, PrintMessageAction);\n";
1938 Out << " PassManager PM;\n";
1939 Out << " PM.add(createPrintModulePass(&outs()));\n";
1940 Out << " PM.run(*Mod);\n";
1941 Out << " return 0;\n";
1942 Out << "}\n\n";
1948 nl(Out) << "Module* " << fname << "() {";
1949 nl(Out,1) << "// Module Construction";
1950 nl(Out) << "Module* mod = new Module(\"";
1952 Out << "\", getGlobalContext());";
1954 nl(Out) << "mod->setDataLayout(\"" << TheModule->getDataLayout() << "\");";
1957 nl(Out) << "mod->setTargetTriple(\"" << TheModule->getTargetTriple()
1962 nl(Out) << "mod->setModuleInlineAsm(\"";
1964 Out << "\");";
1966 nl(Out);
1969 nl(Out) << "return mod;";
1970 nl(Out,-1) << "}";
1971 nl(Out);
1976 Out << "\nModule* " << fname << "(Module *mod) {\n";
1977 Out << "\nmod->setModuleIdentifier(\"";
1979 Out << "\");\n";
1981 Out << "\nreturn mod;\n";
1982 Out << "\n}\n";
1992 Out << "\nFunction* " << fname << "(Module *mod) {\n";
1996 Out << "return " << getCppName(F) << ";\n";
1997 Out << "}\n";
2023 Out << "\nGlobalVariable* " << fname << "(Module *mod) {\n";
2027 Out << "return " << getCppName(GV) << ";\n";
2028 Out << "}\n";
2038 Out << "\nType* " << fname << "(Module *mod) {\n";
2040 Out << "return " << getCppName(Ty) << ";\n";
2041 Out << "}\n";
2048 Out << "// Generated by llvm2cpp - DO NOT MODIFY!\n\n";