Lines Matching refs:Out

96     formatted_raw_ostream &Out;
111 : ModulePass(ID), OutOwner(std::move(o)), Out(*OutOwner), uniqueNum(0),
130 formatted_raw_ostream& nl(formatted_raw_ostream &Out, int delta = 0);
170 formatted_raw_ostream &CppWriter::nl(formatted_raw_ostream &Out, int delta) {
171 Out << '\n';
174 Out.indent(indent_level);
175 return Out;
225 Out << "ConstantFP::get(mod->getContext(), ";
226 Out << "APFloat(";
235 Out << "BitsToDouble(" << Buffer << ")";
237 Out << "BitsToFloat((float)" << Buffer << ")";
238 Out << ")";
253 Out << StrVal;
255 Out << StrVal << "f";
257 Out << "BitsToDouble(0x"
261 Out << "BitsToFloat(0x"
265 Out << ")";
269 Out << ")";
275 case CallingConv::C: Out << "CallingConv::C"; break;
276 case CallingConv::Fast: Out << "CallingConv::Fast"; break;
277 case CallingConv::Cold: Out << "CallingConv::Cold"; break;
278 case CallingConv::FirstTargetCC: Out << "CallingConv::FirstTargetCC"; break;
279 default: Out << cc; break;
286 Out << "GlobalValue::InternalLinkage"; break;
288 Out << "GlobalValue::PrivateLinkage"; 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::ExternalWeakLinkage"; break;
306 Out << "GlobalValue::CommonLinkage"; break;
313 Out << "GlobalValue::DefaultVisibility";
316 Out << "GlobalValue::HiddenVisibility";
319 Out << "GlobalValue::ProtectedVisibility";
328 Out << "GlobalValue::DefaultStorageClass";
331 Out << "GlobalValue::DLLImportStorageClass";
334 Out << "GlobalValue::DLLExportStorageClass";
342 Out << "GlobalVariable::NotThreadLocal";
345 Out << "GlobalVariable::GeneralDynamicTLSModel";
348 Out << "GlobalVariable::LocalDynamicTLSModel";
351 Out << "GlobalVariable::InitialExecTLSModel";
354 Out << "GlobalVariable::LocalExecTLSModel";
365 Out << C;
367 Out << "\\x"
479 Out << "AttributeSet " << name << "_PAL;";
480 nl(Out);
482 Out << '{'; in(); nl(Out);
483 Out << "SmallVector<AttributeSet, 4> Attrs;"; nl(Out);
484 Out << "AttributeSet PAS;"; in(); nl(Out);
488 Out << "{"; in(); nl(Out);
489 Out << "AttrBuilder B;"; nl(Out);
493 Out << "B.addAttribute(Attribute::" #X ");"; nl(Out); \
529 Out << "B.addStackAlignmentAttr(" << attrs.getStackAlignment()<<')';
530 nl(Out);
534 Out << "PAS = AttributeSet::get(mod->getContext(), ";
536 Out << "~0U,";
538 Out << index << "U,";
539 Out << " B);"; out(); nl(Out);
540 Out << "}"; out(); nl(Out);
541 nl(Out);
542 Out << "Attrs.push_back(PAS);"; nl(Out);
544 Out << name << "_PAL = AttributeSet::get(mod->getContext(), Attrs);";
545 nl(Out);
546 out(); nl(Out);
547 Out << '}'; nl(Out);
569 Out << "std::vector<Type*>" << typeName << "_args;";
570 nl(Out);
577 Out << typeName << "_args.push_back(" << argName;
578 Out << ");";
579 nl(Out);
583 Out << "FunctionType* " << typeName << " = FunctionType::get(";
584 in(); nl(Out) << "/*Result=*/" << retTypeName;
585 Out << ",";
586 nl(Out) << "/*Params=*/" << typeName << "_args,";
587 nl(Out) << "/*isVarArg=*/" << (FT->isVarArg() ? "true" : "false") << ");";
589 nl(Out);
595 Out << "StructType *" << typeName << " = mod->getTypeByName(\"";
597 Out << "\");";
598 nl(Out);
599 Out << "if (!" << typeName << ") {";
600 nl(Out);
601 Out << typeName << " = ";
602 Out << "StructType::create(mod->getContext(), \"";
604 Out << "\");";
605 nl(Out);
606 Out << "}";
607 nl(Out);
612 Out << "std::vector<Type*>" << typeName << "_fields;";
613 nl(Out);
620 Out << typeName << "_fields.push_back(" << fieldName;
621 Out << ");";
622 nl(Out);
626 Out << "StructType *" << typeName << " = ";
627 Out << "StructType::get(" << "mod->getContext(), ";
629 Out << "if (" << typeName << "->isOpaque()) {";
630 nl(Out);
631 Out << typeName << "->setBody(";
634 Out << typeName << "_fields, /*isPacked=*/"
636 nl(Out);
638 Out << "}";
639 nl(Out);
649 Out << "ArrayType* " << typeName << " = ArrayType::get("
651 nl(Out);
661 Out << "PointerType* " << typeName << " = PointerType::get("
663 nl(Out);
673 Out << "VectorType* " << typeName << " = VectorType::get("
675 nl(Out);
687 nl(Out);
738 Out << "ConstantInt* " << constName
743 Out << "ConstantAggregateZero* " << constName
746 Out << "ConstantPointerNull* " << constName
749 Out << "ConstantFP* " << constName << " = ";
751 Out << ";";
753 Out << "std::vector<Constant*> " << constName << "_elems;";
754 nl(Out);
758 Out << constName << "_elems.push_back("
760 nl(Out);
762 Out << "Constant* " << constName << " = ConstantArray::get("
765 Out << "std::vector<Constant*> " << constName << "_fields;";
766 nl(Out);
770 Out << constName << "_fields.push_back("
772 nl(Out);
774 Out << "Constant* " << constName << " = ConstantStruct::get("
777 Out << "std::vector<Constant*> " << constName << "_elems;";
778 nl(Out);
782 Out << constName << "_elems.push_back("
784 nl(Out);
786 Out << "Constant* " << constName << " = ConstantVector::get("
789 Out << "UndefValue* " << constName << " = UndefValue::get("
794 Out << "Constant *" << constName <<
805 Out << "\", true);";
807 Out << "\", false);";// No null terminator
810 Out << "std::vector<Constant*> " << constName << "_elems;";
811 nl(Out);
815 Out << constName << "_elems.push_back(" << getCppName(Elt) << ");";
816 nl(Out);
818 Out << "Constant* " << constName;
821 Out << " = ConstantArray::get(";
823 Out << " = ConstantVector::get(";
824 Out << typeName << ", " << constName << "_elems);";
828 Out << "std::vector<Constant*> " << constName << "_indices;";
829 nl(Out);
833 Out << constName << "_indices.push_back("
835 nl(Out);
837 Out << "Constant* " << constName
843 Out << "Constant* " << constName << " = ConstantExpr::getCast(";
846 case Instruction::Trunc: Out << "Instruction::Trunc"; break;
847 case Instruction::ZExt: Out << "Instruction::ZExt"; break;
848 case Instruction::SExt: Out << "Instruction::SExt"; break;
849 case Instruction::FPTrunc: Out << "Instruction::FPTrunc"; break;
850 case Instruction::FPExt: Out << "Instruction::FPExt"; break;
851 case Instruction::FPToUI: Out << "Instruction::FPToUI"; break;
852 case Instruction::FPToSI: Out << "Instruction::FPToSI"; break;
853 case Instruction::UIToFP: Out << "Instruction::UIToFP"; break;
854 case Instruction::SIToFP: Out << "Instruction::SIToFP"; break;
855 case Instruction::PtrToInt: Out << "Instruction::PtrToInt"; break;
856 case Instruction::IntToPtr: Out << "Instruction::IntToPtr"; break;
857 case Instruction::BitCast: Out << "Instruction::BitCast"; break;
859 Out << ", " << getCppName(CE->getOperand(0)) << ", "
866 Out << "Constant* " << constName << " = ConstantExpr::";
868 case Instruction::Add: Out << "getAdd("; break;
869 case Instruction::FAdd: Out << "getFAdd("; break;
870 case Instruction::Sub: Out << "getSub("; break;
871 case Instruction::FSub: Out << "getFSub("; break;
872 case Instruction::Mul: Out << "getMul("; break;
873 case Instruction::FMul: Out << "getFMul("; break;
874 case Instruction::UDiv: Out << "getUDiv("; break;
875 case Instruction::SDiv: Out << "getSDiv("; break;
876 case Instruction::FDiv: Out << "getFDiv("; break;
877 case Instruction::URem: Out << "getURem("; break;
878 case Instruction::SRem: Out << "getSRem("; break;
879 case Instruction::FRem: Out << "getFRem("; break;
880 case Instruction::And: Out << "getAnd("; break;
881 case Instruction::Or: Out << "getOr("; break;
882 case Instruction::Xor: Out << "getXor("; break;
884 Out << "getICmp(ICmpInst::ICMP_";
886 case ICmpInst::ICMP_EQ: Out << "EQ"; break;
887 case ICmpInst::ICMP_NE: Out << "NE"; break;
888 case ICmpInst::ICMP_SLT: Out << "SLT"; break;
889 case ICmpInst::ICMP_ULT: Out << "ULT"; break;
890 case ICmpInst::ICMP_SGT: Out << "SGT"; break;
891 case ICmpInst::ICMP_UGT: Out << "UGT"; break;
892 case ICmpInst::ICMP_SLE: Out << "SLE"; break;
893 case ICmpInst::ICMP_ULE: Out << "ULE"; break;
894 case ICmpInst::ICMP_SGE: Out << "SGE"; break;
895 case ICmpInst::ICMP_UGE: Out << "UGE"; break;
900 Out << "getFCmp(FCmpInst::FCMP_";
902 case FCmpInst::FCMP_FALSE: Out << "FALSE"; break;
903 case FCmpInst::FCMP_ORD: Out << "ORD"; break;
904 case FCmpInst::FCMP_UNO: Out << "UNO"; break;
905 case FCmpInst::FCMP_OEQ: Out << "OEQ"; break;
906 case FCmpInst::FCMP_UEQ: Out << "UEQ"; break;
907 case FCmpInst::FCMP_ONE: Out << "ONE"; break;
908 case FCmpInst::FCMP_UNE: Out << "UNE"; break;
909 case FCmpInst::FCMP_OLT: Out << "OLT"; break;
910 case FCmpInst::FCMP_ULT: Out << "ULT"; break;
911 case FCmpInst::FCMP_OGT: Out << "OGT"; break;
912 case FCmpInst::FCMP_UGT: Out << "UGT"; break;
913 case FCmpInst::FCMP_OLE: Out << "OLE"; break;
914 case FCmpInst::FCMP_ULE: Out << "ULE"; break;
915 case FCmpInst::FCMP_OGE: Out << "OGE"; break;
916 case FCmpInst::FCMP_UGE: Out << "UGE"; break;
917 case FCmpInst::FCMP_TRUE: Out << "TRUE"; break;
921 case Instruction::Shl: Out << "getShl("; break;
922 case Instruction::LShr: Out << "getLShr("; break;
923 case Instruction::AShr: Out << "getAShr("; break;
924 case Instruction::Select: Out << "getSelect("; break;
925 case Instruction::ExtractElement: Out << "getExtractElement("; break;
926 case Instruction::InsertElement: Out << "getInsertElement("; break;
927 case Instruction::ShuffleVector: Out << "getShuffleVector("; break;
932 Out << getCppName(CE->getOperand(0));
934 Out << ", " << getCppName(CE->getOperand(i));
935 Out << ");";
938 Out << "Constant* " << constName << " = ";
939 Out << "BlockAddress::get(" << getOpName(BA->getBasicBlock()) << ");";
942 Out << "Constant* " << constName << " = 0; ";
944 nl(Out);
973 nl(Out) << "// Type Definitions";
974 nl(Out);
980 nl(Out)<< "/ Function Declarations"; nl(Out);
983 nl(Out) << "// Global Variable Declarations"; nl(Out);
986 nl(Out) << "// Global Variable Definitions"; nl(Out);
989 nl(Out) << "// Constant Definitions"; nl(Out);
996 nl(Out) << "GlobalVariable* " << getCppName(GV);
998 Out << " = mod->getGlobalVariable(mod->getContext(), ";
1000 Out << ", " << getCppName(GV->getType()->getElementType()) << ",true)";
1001 nl(Out) << "if (!" << getCppName(GV) << ") {";
1002 in(); nl(Out) << getCppName(GV);
1004 Out << " = new GlobalVariable(/*Module=*/*mod, ";
1005 nl(Out) << "/*Type=*/";
1007 Out << ",";
1008 nl(Out) << "/*isConstant=*/" << (GV->isConstant()?"true":"false");
1009 Out << ",";
1010 nl(Out) << "/*Linkage=*/";
1012 Out << ",";
1013 nl(Out) << "/*Initializer=*/0, ";
1015 Out << "// has initializer, specified below";
1017 nl(Out) << "/*Name=*/\"";
1019 Out << "\");";
1020 nl(Out);
1024 Out << "->setSection(\"";
1026 Out << "\");";
1027 nl(Out);
1031 Out << "->setAlignment(" << GV->getAlignment() << ");";
1032 nl(Out);
1036 Out << "->setVisibility(";
1038 Out << ");";
1039 nl(Out);
1043 Out << "->setDLLStorageClass(";
1045 Out << ");";
1046 nl(Out);
1050 Out << "->setThreadLocalMode(";
1052 Out << ");";
1053 nl(Out);
1056 out(); Out << "}"; nl(Out);
1063 Out << "->setInitializer(";
1064 Out << getCppName(GV->getInitializer()) << ");";
1065 nl(Out);
1085 Out << "Argument* " << result << " = new Argument("
1087 nl(Out);
1132 Out << "ReturnInst::Create(mod->getContext(), "
1138 Out << "BranchInst::Create(" ;
1140 Out << opNames[2] << ", "
1145 Out << opNames[0] << ", ";
1149 Out << bbname << ");";
1154 Out << "SwitchInst* " << iName << " = SwitchInst::Create("
1158 nl(Out);
1163 Out << iName << "->addCase("
1166 nl(Out);
1172 Out << "IndirectBrInst *" << iName << " = IndirectBrInst::Create("
1174 nl(Out);
1176 Out << iName << "->addDestination(" << opNames[i] << ");";
1177 nl(Out);
1182 Out << "ResumeInst::Create(" << opNames[0] << ", " << bbname << ");";
1187 Out << "std::vector<Value*> " << iName << "_params;";
1188 nl(Out);
1190 Out << iName << "_params.push_back("
1192 nl(Out);
1195 Out << "InvokeInst *" << iName << " = InvokeInst::Create("
1201 Out << "\", " << bbname << ");";
1202 nl(Out) << iName << "->setCallingConv(";
1204 Out << ");";
1206 Out << iName << "->setAttributes(" << iName << "_PAL);";
1207 nl(Out);
1211 Out << "new UnreachableInst("
1234 Out << "BinaryOperator* " << iName << " = BinaryOperator::Create(";
1236 case Instruction::Add: Out << "Instruction::Add"; break;
1237 case Instruction::FAdd: Out << "Instruction::FAdd"; break;
1238 case Instruction::Sub: Out << "Instruction::Sub"; break;
1239 case Instruction::FSub: Out << "Instruction::FSub"; break;
1240 case Instruction::Mul: Out << "Instruction::Mul"; break;
1241 case Instruction::FMul: Out << "Instruction::FMul"; break;
1242 case Instruction::UDiv:Out << "Instruction::UDiv"; break;
1243 case Instruction::SDiv:Out << "Instruction::SDiv"; break;
1244 case Instruction::FDiv:Out << "Instruction::FDiv"; break;
1245 case Instruction::URem:Out << "Instruction::URem"; break;
1246 case Instruction::SRem:Out << "Instruction::SRem"; break;
1247 case Instruction::FRem:Out << "Instruction::FRem"; break;
1248 case Instruction::And: Out << "Instruction::And"; break;
1249 case Instruction::Or: Out << "Instruction::Or"; break;
1250 case Instruction::Xor: Out << "Instruction::Xor"; break;
1251 case Instruction::Shl: Out << "Instruction::Shl"; break;
1252 case Instruction::LShr:Out << "Instruction::LShr"; break;
1253 case Instruction::AShr:Out << "Instruction::AShr"; break;
1254 default: Out << "Instruction::BadOpCode"; break;
1256 Out << ", " << opNames[0] << ", " << opNames[1] << ", \"";
1258 Out << "\", " << bbname << ");";
1262 Out << "FCmpInst* " << iName << " = new FCmpInst(*" << bbname << ", ";
1264 case FCmpInst::FCMP_FALSE: Out << "FCmpInst::FCMP_FALSE"; break;
1265 case FCmpInst::FCMP_OEQ : Out << "FCmpInst::FCMP_OEQ"; break;
1266 case FCmpInst::FCMP_OGT : Out << "FCmpInst::FCMP_OGT"; break;
1267 case FCmpInst::FCMP_OGE : Out << "FCmpInst::FCMP_OGE"; break;
1268 case FCmpInst::FCMP_OLT : Out << "FCmpInst::FCMP_OLT"; break;
1269 case FCmpInst::FCMP_OLE : Out << "FCmpInst::FCMP_OLE"; break;
1270 case FCmpInst::FCMP_ONE : Out << "FCmpInst::FCMP_ONE"; break;
1271 case FCmpInst::FCMP_ORD : Out << "FCmpInst::FCMP_ORD"; break;
1272 case FCmpInst::FCMP_UNO : Out << "FCmpInst::FCMP_UNO"; break;
1273 case FCmpInst::FCMP_UEQ : Out << "FCmpInst::FCMP_UEQ"; break;
1274 case FCmpInst::FCMP_UGT : Out << "FCmpInst::FCMP_UGT"; break;
1275 case FCmpInst::FCMP_UGE : Out << "FCmpInst::FCMP_UGE"; break;
1276 case FCmpInst::FCMP_ULT : Out << "FCmpInst::FCMP_ULT"; break;
1277 case FCmpInst::FCMP_ULE : Out << "FCmpInst::FCMP_ULE"; break;
1278 case FCmpInst::FCMP_UNE : Out << "FCmpInst::FCMP_UNE"; break;
1279 case FCmpInst::FCMP_TRUE : Out << "FCmpInst::FCMP_TRUE"; break;
1280 default: Out << "FCmpInst::BAD_ICMP_PREDICATE"; break;
1282 Out << ", " << opNames[0] << ", " << opNames[1] << ", \"";
1284 Out << "\");";
1288 Out << "ICmpInst* " << iName << " = new ICmpInst(*" << bbname << ", ";
1290 case ICmpInst::ICMP_EQ: Out << "ICmpInst::ICMP_EQ"; break;
1291 case ICmpInst::ICMP_NE: Out << "ICmpInst::ICMP_NE"; break;
1292 case ICmpInst::ICMP_ULE: Out << "ICmpInst::ICMP_ULE"; break;
1293 case ICmpInst::ICMP_SLE: Out << "ICmpInst::ICMP_SLE"; break;
1294 case ICmpInst::ICMP_UGE: Out << "ICmpInst::ICMP_UGE"; break;
1295 case ICmpInst::ICMP_SGE: Out << "ICmpInst::ICMP_SGE"; break;
1296 case ICmpInst::ICMP_ULT: Out << "ICmpInst::ICMP_ULT"; break;
1297 case ICmpInst::ICMP_SLT: Out << "ICmpInst::ICMP_SLT"; break;
1298 case ICmpInst::ICMP_UGT: Out << "ICmpInst::ICMP_UGT"; break;
1299 case ICmpInst::ICMP_SGT: Out << "ICmpInst::ICMP_SGT"; break;
1300 default: Out << "ICmpInst::BAD_ICMP_PREDICATE"; break;
1302 Out << ", " << opNames[0] << ", " << opNames[1] << ", \"";
1304 Out << "\");";
1309 Out << "AllocaInst* " << iName << " = new AllocaInst("
1312 Out << opNames[0] << ", ";
1313 Out << "\"";
1315 Out << "\", " << bbname << ");";
1317 nl(Out) << iName << "->setAlignment("
1323 Out << "LoadInst* " << iName << " = new LoadInst("
1326 Out << "\", " << (load->isVolatile() ? "true" : "false" )
1329 nl(Out) << iName << "->setAlignment("
1334 nl(Out) << iName << "->setAtomic("
1341 Out << "StoreInst* " << iName << " = new StoreInst("
1347 nl(Out) << iName << "->setAlignment("
1352 nl(Out) << iName << "->setAtomic("
1359 Out << "GetElementPtrInst* " << iName << " = GetElementPtrInst::Create("
1364 Out << ", ";
1366 nl(Out);
1367 Out << opNames[i];
1370 nl(Out) << "}, \"";
1372 Out << "\", " << bbname << ");";
1378 Out << "PHINode* " << iName << " = PHINode::Create("
1382 Out << "\", " << bbname << ");";
1383 nl(Out);
1385 Out << iName << "->addIncoming("
1388 nl(Out);
1405 Out << "CastInst* " << iName << " = new ";
1407 case Instruction::Trunc: Out << "TruncInst"; break;
1408 case Instruction::ZExt: Out << "ZExtInst"; break;
1409 case Instruction::SExt: Out << "SExtInst"; break;
1410 case Instruction::FPTrunc: Out << "FPTruncInst"; break;
1411 case Instruction::FPExt: Out << "FPExtInst"; break;
1412 case Instruction::FPToUI: Out << "FPToUIInst"; break;
1413 case Instruction::FPToSI: Out << "FPToSIInst"; break;
1414 case Instruction::UIToFP: Out << "UIToFPInst"; break;
1415 case Instruction::SIToFP: Out << "SIToFPInst"; break;
1416 case Instruction::PtrToInt: Out << "PtrToIntInst"; break;
1417 case Instruction::IntToPtr: Out << "IntToPtrInst"; break;
1418 case Instruction::BitCast: Out << "BitCastInst"; break;
1421 Out << "(" << opNames[0] << ", "
1424 Out << "\", " << bbname << ");";
1430 Out << "InlineAsm* " << getCppName(ila) << " = InlineAsm::get("
1435 nl(Out);
1438 Out << "std::vector<Value*> " << iName << "_params;";
1439 nl(Out);
1441 Out << iName << "_params.push_back(" << opNames[i] << ");";
1442 nl(Out);
1444 Out << "CallInst* " << iName << " = CallInst::Create("
1448 Out << "CallInst* " << iName << " = CallInst::Create("
1451 Out << "CallInst* " << iName << " = CallInst::Create("
1455 Out << "\", " << bbname << ");";
1456 nl(Out) << iName << "->setCallingConv(";
1458 Out << ");";
1459 nl(Out) << iName << "->setTailCall("
1461 Out << ");";
1462 nl(Out);
1464 Out << iName << "->setAttributes(" << iName << "_PAL);";
1465 nl(Out);
1470 Out << "SelectInst* " << getCppName(sel) << " = SelectInst::Create(";
1471 Out << opNames[0] << ", " << opNames[1] << ", " << opNames[2] << ", \"";
1473 Out << "\", " << bbname << ");";
1484 Out << "VAArgInst* " << getCppName(va) << " = new VAArgInst("
1487 Out << "\", " << bbname << ");";
1492 Out << "ExtractElementInst* " << getCppName(eei)
1496 Out << "\", " << bbname << ");";
1501 Out << "InsertElementInst* " << getCppName(iei)
1505 Out << "\", " << bbname << ");";
1510 Out << "ShuffleVectorInst* " << getCppName(svi)
1514 Out << "\", " << bbname << ");";
1519 Out << "std::vector<unsigned> " << iName << "_indices;";
1520 nl(Out);
1522 Out << iName << "_indices.push_back("
1524 nl(Out);
1526 Out << "ExtractValueInst* " << getCppName(evi)
1531 Out << "\", " << bbname << ");";
1536 Out << "std::vector<unsigned> " << iName << "_indices;";
1537 nl(Out);
1539 Out << iName << "_indices.push_back("
1541 nl(Out);
1543 Out << "InsertValueInst* " << getCppName(ivi)
1548 Out << "\", " << bbname << ");";
1555 Out << "FenceInst* " << iName
1568 Out << "AtomicCmpXchgInst* " << iName
1574 nl(Out) << iName << "->setName(\"";
1576 Out << "\");";
1577 nl(Out) << iName << "->setVolatile("
1579 nl(Out) << iName << "->setWeak("
1602 Out << "AtomicRMWInst* " << iName
1608 nl(Out) << iName << "->setName(\"";
1610 Out << "\");";
1611 nl(Out) << iName << "->setVolatile("
1617 Out << "LandingPadInst* " << iName << " = LandingPadInst::Create(";
1619 Out << ", " << opNames[0] << ", " << lpi->getNumClauses() << ", \"";
1621 Out << "\", " << bbname << ");";
1622 nl(Out) << iName << "->setCleanup("
1626 nl(Out) << iName << "->addClause(" << opNames[i+1] << ");";
1631 nl(Out);
1637 nl(Out) << "// Type Definitions"; nl(Out);
1694 nl(Out) << "// Function Declarations"; nl(Out);
1703 nl(Out) << "// Global Variable Declarations"; nl(Out);
1710 nl(Out) << "// Constant Definitions"; nl(Out);
1719 nl(Out) << "// Global Variable Definitions"; nl(Out);
1728 nl(Out) << "Function* " << getCppName(F);
1729 Out << " = mod->getFunction(\"";
1731 Out << "\");";
1732 nl(Out) << "if (!" << getCppName(F) << ") {";
1733 nl(Out) << getCppName(F);
1735 Out<< " = Function::Create(";
1736 nl(Out,1) << "/*Type=*/" << getCppName(F->getFunctionType()) << ",";
1737 nl(Out) << "/*Linkage=*/";
1739 Out << ",";
1740 nl(Out) << "/*Name=*/\"";
1742 Out << "\", mod); " << (F->isDeclaration()? "// (external, no body)" : "");
1743 nl(Out,-1);
1745 Out << "->setCallingConv(";
1747 Out << ");";
1748 nl(Out);
1751 Out << "->setSection(\"" << F->getSection() << "\");";
1752 nl(Out);
1756 Out << "->setAlignment(" << F->getAlignment() << ");";
1757 nl(Out);
1761 Out << "->setVisibility(";
1763 Out << ");";
1764 nl(Out);
1768 Out << "->setDLLStorageClass(";
1770 Out << ");";
1771 nl(Out);
1775 Out << "->setGC(\"" << F->getGC() << "\");";
1776 nl(Out);
1778 Out << "}";
1779 nl(Out);
1782 Out << "->setAttributes(" << getCppName(F) << "_PAL);";
1783 nl(Out);
1798 Out << "Function::arg_iterator args = " << getCppName(F)
1800 nl(Out);
1803 Out << "Value* " << getCppName(&AI) << " = args++;";
1804 nl(Out);
1806 Out << getCppName(&AI) << "->setName(\"";
1808 Out << "\");";
1809 nl(Out);
1815 nl(Out);
1818 Out << "BasicBlock* " << bbname <<
1822 Out << "\"," << getCppName(BI.getParent()) << ",0);";
1823 nl(Out);
1829 nl(Out) << "// Block " << BI.getName() << " (" << bbname << ")";
1830 nl(Out);
1840 nl(Out) << "// Resolve Forward References";
1841 nl(Out);
1846 Out << I->second << "->replaceAllUsesWith("
1848 nl(Out);
1864 nl(Out) << "BasicBlock* " << fname << "(Module* mod, Function *"
1869 Out << ", Value* arg_" << arg_count++;
1871 Out << ") {";
1872 nl(Out);
1877 Out << "return " << getCppName(&F->front()) << ";";
1878 nl(Out) << "}";
1879 nl(Out);
1884 nl(Out) << "// Type Definitions"; nl(Out);
1889 nl(Out) << "// Function Declarations"; nl(Out);
1895 nl(Out) << "// Global Variable Declarations\n"; nl(Out);
1902 nl(Out) << "// Constant Definitions"; nl(Out);
1908 nl(Out) << "// Global Variable Definitions"; nl(Out);
1913 nl(Out) << "// Function Definitions"; nl(Out);
1916 nl(Out) << "// Function: " << I.getName() << " (" << getCppName(&I)
1918 nl(Out) << "{";
1919 nl(Out,1);
1921 nl(Out,-1) << "}";
1922 nl(Out);
1929 Out << "#include <llvm/Pass.h>\n";
1931 Out << "#include <llvm/ADT/SmallVector.h>\n";
1932 Out << "#include <llvm/Analysis/Verifier.h>\n";
1933 Out << "#include <llvm/IR/BasicBlock.h>\n";
1934 Out << "#include <llvm/IR/CallingConv.h>\n";
1935 Out << "#include <llvm/IR/Constants.h>\n";
1936 Out << "#include <llvm/IR/DerivedTypes.h>\n";
1937 Out << "#include <llvm/IR/Function.h>\n";
1938 Out << "#include <llvm/IR/GlobalVariable.h>\n";
1939 Out << "#include <llvm/IR/IRPrintingPasses.h>\n";
1940 Out << "#include <llvm/IR/InlineAsm.h>\n";
1941 Out << "#include <llvm/IR/Instructions.h>\n";
1942 Out << "#include <llvm/IR/LLVMContext.h>\n";
1943 Out << "#include <llvm/IR/LegacyPassManager.h>\n";
1944 Out << "#include <llvm/IR/Module.h>\n";
1945 Out << "#include <llvm/Support/FormattedStream.h>\n";
1946 Out << "#include <llvm/Support/MathExtras.h>\n";
1947 Out << "#include <algorithm>\n";
1948 Out << "using namespace llvm;\n\n";
1949 Out << "Module* " << fname << "();\n\n";
1950 Out << "int main(int argc, char**argv) {\n";
1951 Out << " Module* Mod = " << fname << "();\n";
1952 Out << " verifyModule(*Mod, PrintMessageAction);\n";
1953 Out << " PassManager PM;\n";
1954 Out << " PM.add(createPrintModulePass(&outs()));\n";
1955 Out << " PM.run(*Mod);\n";
1956 Out << " return 0;\n";
1957 Out << "}\n\n";
1963 nl(Out) << "Module* " << fname << "() {";
1964 nl(Out,1) << "// Module Construction";
1965 nl(Out) << "Module* mod = new Module(\"";
1967 Out << "\", getGlobalContext());";
1969 nl(Out) << "mod->setDataLayout(\"" << TheModule->getDataLayoutStr()
1973 nl(Out) << "mod->setTargetTriple(\"" << TheModule->getTargetTriple()
1978 nl(Out) << "mod->setModuleInlineAsm(\"";
1980 Out << "\");";
1982 nl(Out);
1985 nl(Out) << "return mod;";
1986 nl(Out,-1) << "}";
1987 nl(Out);
1992 Out << "\nModule* " << fname << "(Module *mod) {\n";
1993 Out << "\nmod->setModuleIdentifier(\"";
1995 Out << "\");\n";
1997 Out << "\nreturn mod;\n";
1998 Out << "\n}\n";
2008 Out << "\nFunction* " << fname << "(Module *mod) {\n";
2012 Out << "return " << getCppName(F) << ";\n";
2013 Out << "}\n";
2039 Out << "\nGlobalVariable* " << fname << "(Module *mod) {\n";
2043 Out << "return " << getCppName(GV) << ";\n";
2044 Out << "}\n";
2054 Out << "\nType* " << fname << "(Module *mod) {\n";
2056 Out << "return " << getCppName(Ty) << ";\n";
2057 Out << "}\n";
2064 Out << "// Generated by llvm2cpp - DO NOT MODIFY!\n\n";