Lines Matching refs:Out

93     formatted_raw_ostream &Out;
108 ModulePass(ID), Out(o), uniqueNum(0), is_inline(false), indent_level(0){}
126 formatted_raw_ostream& nl(formatted_raw_ostream &Out, int delta = 0);
165 formatted_raw_ostream &CppWriter::nl(formatted_raw_ostream &Out, int delta) {
166 Out << '\n';
169 Out.indent(indent_level);
170 return Out;
220 Out << "ConstantFP::get(mod->getContext(), ";
221 Out << "APFloat(";
230 Out << "BitsToDouble(" << Buffer << ")";
232 Out << "BitsToFloat((float)" << Buffer << ")";
233 Out << ")";
248 Out << StrVal;
250 Out << StrVal << "f";
252 Out << "BitsToDouble(0x"
256 Out << "BitsToFloat(0x"
260 Out << ")";
264 Out << ")";
270 case CallingConv::C: Out << "CallingConv::C"; break;
271 case CallingConv::Fast: Out << "CallingConv::Fast"; break;
272 case CallingConv::Cold: Out << "CallingConv::Cold"; break;
273 case CallingConv::FirstTargetCC: Out << "CallingConv::FirstTargetCC"; break;
274 default: Out << cc; break;
281 Out << "GlobalValue::InternalLinkage"; break;
283 Out << "GlobalValue::PrivateLinkage"; break;
285 Out << "GlobalValue::LinkerPrivateLinkage"; break;
287 Out << "GlobalValue::LinkerPrivateWeakLinkage"; break;
289 Out << "GlobalValue::AvailableExternallyLinkage "; break;
291 Out << "GlobalValue::LinkOnceAnyLinkage "; break;
293 Out << "GlobalValue::LinkOnceODRLinkage "; break;
295 Out << "GlobalValue::LinkOnceODRAutoHideLinkage"; break;
297 Out << "GlobalValue::WeakAnyLinkage"; break;
299 Out << "GlobalValue::WeakODRLinkage"; break;
301 Out << "GlobalValue::AppendingLinkage"; break;
303 Out << "GlobalValue::ExternalLinkage"; break;
305 Out << "GlobalValue::DLLImportLinkage"; break;
307 Out << "GlobalValue::DLLExportLinkage"; break;
309 Out << "GlobalValue::ExternalWeakLinkage"; break;
311 Out << "GlobalValue::CommonLinkage"; break;
318 Out << "GlobalValue::DefaultVisibility";
321 Out << "GlobalValue::HiddenVisibility";
324 Out << "GlobalValue::ProtectedVisibility";
332 Out << "GlobalVariable::NotThreadLocal";
335 Out << "GlobalVariable::GeneralDynamicTLSModel";
338 Out << "GlobalVariable::LocalDynamicTLSModel";
341 Out << "GlobalVariable::InitialExecTLSModel";
344 Out << "GlobalVariable::LocalExecTLSModel";
355 Out << C;
357 Out << "\\x"
469 Out << "AttrListPtr " << name << "_PAL;";
470 nl(Out);
472 Out << '{'; in(); nl(Out);
473 Out << "SmallVector<AttributeWithIndex, 4> Attrs;"; nl(Out);
474 Out << "AttributeWithIndex PAWI;"; nl(Out);
478 Out << "PAWI.Index = " << index << "U; PAWI.Attrs = Attribute::None ";
481 Out << " | Attribute::" #X; \
510 Out << " | Attribute::constructStackAlignmentFromInt("
515 Out << ";";
516 nl(Out);
517 Out << "Attrs.push_back(PAWI);";
518 nl(Out);
520 Out << name << "_PAL = AttrListPtr::get(Attrs);";
521 nl(Out);
522 out(); nl(Out);
523 Out << '}'; nl(Out);
543 Out << "std::vector<Type*>" << typeName << "_args;";
544 nl(Out);
551 Out << typeName << "_args.push_back(" << argName;
552 Out << ");";
553 nl(Out);
557 Out << "FunctionType* " << typeName << " = FunctionType::get(";
558 in(); nl(Out) << "/*Result=*/" << retTypeName;
559 Out << ",";
560 nl(Out) << "/*Params=*/" << typeName << "_args,";
561 nl(Out) << "/*isVarArg=*/" << (FT->isVarArg() ? "true" : "false") << ");";
563 nl(Out);
569 Out << "StructType *" << typeName << " = mod->getTypeByName(\"";
571 Out << "\");";
572 nl(Out);
573 Out << "if (!" << typeName << ") {";
574 nl(Out);
575 Out << typeName << " = ";
576 Out << "StructType::create(mod->getContext(), \"";
578 Out << "\");";
579 nl(Out);
580 Out << "}";
581 nl(Out);
586 Out << "std::vector<Type*>" << typeName << "_fields;";
587 nl(Out);
594 Out << typeName << "_fields.push_back(" << fieldName;
595 Out << ");";
596 nl(Out);
600 Out << "StructType *" << typeName << " = ";
601 Out << "StructType::get(" << "mod->getContext(), ";
603 Out << "if (" << typeName << "->isOpaque()) {";
604 nl(Out);
605 Out << typeName << "->setBody(";
608 Out << typeName << "_fields, /*isPacked=*/"
610 nl(Out);
612 Out << "}";
613 nl(Out);
623 Out << "ArrayType* " << typeName << " = ArrayType::get("
626 nl(Out);
636 Out << "PointerType* " << typeName << " = PointerType::get("
639 nl(Out);
649 Out << "VectorType* " << typeName << " = VectorType::get("
652 nl(Out);
664 nl(Out);
715 Out << "ConstantInt* " << constName
720 Out << "ConstantAggregateZero* " << constName
723 Out << "ConstantPointerNull* " << constName
726 Out << "ConstantFP* " << constName << " = ";
728 Out << ";";
730 Out << "std::vector<Constant*> " << constName << "_elems;";
731 nl(Out);
735 Out << constName << "_elems.push_back("
737 nl(Out);
739 Out << "Constant* " << constName << " = ConstantArray::get("
742 Out << "std::vector<Constant*> " << constName << "_fields;";
743 nl(Out);
747 Out << constName << "_fields.push_back("
749 nl(Out);
751 Out << "Constant* " << constName << " = ConstantStruct::get("
754 Out << "std::vector<Constant*> " << constName << "_elems;";
755 nl(Out);
759 Out << constName << "_elems.push_back("
761 nl(Out);
763 Out << "Constant* " << constName << " = ConstantVector::get("
766 Out << "UndefValue* " << constName << " = UndefValue::get("
771 Out << "Constant *" << constName <<
782 Out << "\", true);";
784 Out << "\", false);";// No null terminator
787 Out << "std::vector<Constant*> " << constName << "_elems;";
788 nl(Out);
792 Out << constName << "_elems.push_back(" << getCppName(Elt) << ");";
793 nl(Out);
795 Out << "Constant* " << constName;
798 Out << " = ConstantArray::get(";
800 Out << " = ConstantVector::get(";
801 Out << typeName << ", " << constName << "_elems);";
805 Out << "std::vector<Constant*> " << constName << "_indices;";
806 nl(Out);
810 Out << constName << "_indices.push_back("
812 nl(Out);
814 Out << "Constant* " << constName
820 Out << "Constant* " << constName << " = ConstantExpr::getCast(";
823 case Instruction::Trunc: Out << "Instruction::Trunc"; break;
824 case Instruction::ZExt: Out << "Instruction::ZExt"; break;
825 case Instruction::SExt: Out << "Instruction::SExt"; break;
826 case Instruction::FPTrunc: Out << "Instruction::FPTrunc"; break;
827 case Instruction::FPExt: Out << "Instruction::FPExt"; break;
828 case Instruction::FPToUI: Out << "Instruction::FPToUI"; break;
829 case Instruction::FPToSI: Out << "Instruction::FPToSI"; break;
830 case Instruction::UIToFP: Out << "Instruction::UIToFP"; break;
831 case Instruction::SIToFP: Out << "Instruction::SIToFP"; break;
832 case Instruction::PtrToInt: Out << "Instruction::PtrToInt"; break;
833 case Instruction::IntToPtr: Out << "Instruction::IntToPtr"; break;
834 case Instruction::BitCast: Out << "Instruction::BitCast"; break;
836 Out << ", " << getCppName(CE->getOperand(0)) << ", "
843 Out << "Constant* " << constName << " = ConstantExpr::";
845 case Instruction::Add: Out << "getAdd("; break;
846 case Instruction::FAdd: Out << "getFAdd("; break;
847 case Instruction::Sub: Out << "getSub("; break;
848 case Instruction::FSub: Out << "getFSub("; break;
849 case Instruction::Mul: Out << "getMul("; break;
850 case Instruction::FMul: Out << "getFMul("; break;
851 case Instruction::UDiv: Out << "getUDiv("; break;
852 case Instruction::SDiv: Out << "getSDiv("; break;
853 case Instruction::FDiv: Out << "getFDiv("; break;
854 case Instruction::URem: Out << "getURem("; break;
855 case Instruction::SRem: Out << "getSRem("; break;
856 case Instruction::FRem: Out << "getFRem("; break;
857 case Instruction::And: Out << "getAnd("; break;
858 case Instruction::Or: Out << "getOr("; break;
859 case Instruction::Xor: Out << "getXor("; break;
861 Out << "getICmp(ICmpInst::ICMP_";
863 case ICmpInst::ICMP_EQ: Out << "EQ"; break;
864 case ICmpInst::ICMP_NE: Out << "NE"; break;
865 case ICmpInst::ICMP_SLT: Out << "SLT"; break;
866 case ICmpInst::ICMP_ULT: Out << "ULT"; break;
867 case ICmpInst::ICMP_SGT: Out << "SGT"; break;
868 case ICmpInst::ICMP_UGT: Out << "UGT"; break;
869 case ICmpInst::ICMP_SLE: Out << "SLE"; break;
870 case ICmpInst::ICMP_ULE: Out << "ULE"; break;
871 case ICmpInst::ICMP_SGE: Out << "SGE"; break;
872 case ICmpInst::ICMP_UGE: Out << "UGE"; break;
877 Out << "getFCmp(FCmpInst::FCMP_";
879 case FCmpInst::FCMP_FALSE: Out << "FALSE"; break;
880 case FCmpInst::FCMP_ORD: Out << "ORD"; break;
881 case FCmpInst::FCMP_UNO: Out << "UNO"; break;
882 case FCmpInst::FCMP_OEQ: Out << "OEQ"; break;
883 case FCmpInst::FCMP_UEQ: Out << "UEQ"; break;
884 case FCmpInst::FCMP_ONE: Out << "ONE"; break;
885 case FCmpInst::FCMP_UNE: Out << "UNE"; break;
886 case FCmpInst::FCMP_OLT: Out << "OLT"; break;
887 case FCmpInst::FCMP_ULT: Out << "ULT"; break;
888 case FCmpInst::FCMP_OGT: Out << "OGT"; break;
889 case FCmpInst::FCMP_UGT: Out << "UGT"; break;
890 case FCmpInst::FCMP_OLE: Out << "OLE"; break;
891 case FCmpInst::FCMP_ULE: Out << "ULE"; break;
892 case FCmpInst::FCMP_OGE: Out << "OGE"; break;
893 case FCmpInst::FCMP_UGE: Out << "UGE"; break;
894 case FCmpInst::FCMP_TRUE: Out << "TRUE"; break;
898 case Instruction::Shl: Out << "getShl("; break;
899 case Instruction::LShr: Out << "getLShr("; break;
900 case Instruction::AShr: Out << "getAShr("; break;
901 case Instruction::Select: Out << "getSelect("; break;
902 case Instruction::ExtractElement: Out << "getExtractElement("; break;
903 case Instruction::InsertElement: Out << "getInsertElement("; break;
904 case Instruction::ShuffleVector: Out << "getShuffleVector("; break;
909 Out << getCppName(CE->getOperand(0));
911 Out << ", " << getCppName(CE->getOperand(i));
912 Out << ");";
915 Out << "Constant* " << constName << " = ";
916 Out << "BlockAddress::get(" << getOpName(BA->getBasicBlock()) << ");";
919 Out << "Constant* " << constName << " = 0; ";
921 nl(Out);
950 nl(Out) << "// Type Definitions";
951 nl(Out);
957 nl(Out)<< "/ Function Declarations"; nl(Out);
960 nl(Out) << "// Global Variable Declarations"; nl(Out);
963 nl(Out) << "// Global Variable Definitions"; nl(Out);
966 nl(Out) << "// Constant Definitions"; nl(Out);
973 nl(Out) << "GlobalVariable* " << getCppName(GV);
975 Out << " = mod->getGlobalVariable(mod->getContext(), ";
977 Out << ", " << getCppName(GV->getType()->getElementType()) << ",true)";
978 nl(Out) << "if (!" << getCppName(GV) << ") {";
979 in(); nl(Out) << getCppName(GV);
981 Out << " = new GlobalVariable(/*Module=*/*mod, ";
982 nl(Out) << "/*Type=*/";
984 Out << ",";
985 nl(Out) << "/*isConstant=*/" << (GV->isConstant()?"true":"false");
986 Out << ",";
987 nl(Out) << "/*Linkage=*/";
989 Out << ",";
990 nl(Out) << "/*Initializer=*/0, ";
992 Out << "// has initializer, specified below";
994 nl(Out) << "/*Name=*/\"";
996 Out << "\");";
997 nl(Out);
1001 Out << "->setSection(\"";
1003 Out << "\");";
1004 nl(Out);
1008 Out << "->setAlignment(" << utostr(GV->getAlignment()) << ");";
1009 nl(Out);
1013 Out << "->setVisibility(";
1015 Out << ");";
1016 nl(Out);
1020 Out << "->setThreadLocalMode(";
1022 Out << ");";
1023 nl(Out);
1026 out(); Out << "}"; nl(Out);
1033 Out << "->setInitializer(";
1034 Out << getCppName(GV->getInitializer()) << ");";
1035 nl(Out);
1055 Out << "Argument* " << result << " = new Argument("
1057 nl(Out);
1102 Out << "ReturnInst::Create(mod->getContext(), "
1108 Out << "BranchInst::Create(" ;
1110 Out << opNames[2] << ", "
1115 Out << opNames[0] << ", ";
1119 Out << bbname << ");";
1124 Out << "SwitchInst* " << iName << " = SwitchInst::Create("
1128 nl(Out);
1133 Out << iName << "->addCase("
1136 nl(Out);
1142 Out << "IndirectBrInst *" << iName << " = IndirectBrInst::Create("
1144 nl(Out);
1146 Out << iName << "->addDestination(" << opNames[i] << ");";
1147 nl(Out);
1152 Out << "ResumeInst::Create(mod->getContext(), " << opNames[0]
1158 Out << "std::vector<Value*> " << iName << "_params;";
1159 nl(Out);
1161 Out << iName << "_params.push_back("
1163 nl(Out);
1166 Out << "InvokeInst *" << iName << " = InvokeInst::Create("
1172 Out << "\", " << bbname << ");";
1173 nl(Out) << iName << "->setCallingConv(";
1175 Out << ");";
1177 Out << iName << "->setAttributes(" << iName << "_PAL);";
1178 nl(Out);
1182 Out << "new UnreachableInst("
1205 Out << "BinaryOperator* " << iName << " = BinaryOperator::Create(";
1207 case Instruction::Add: Out << "Instruction::Add"; break;
1208 case Instruction::FAdd: Out << "Instruction::FAdd"; break;
1209 case Instruction::Sub: Out << "Instruction::Sub"; break;
1210 case Instruction::FSub: Out << "Instruction::FSub"; break;
1211 case Instruction::Mul: Out << "Instruction::Mul"; break;
1212 case Instruction::FMul: Out << "Instruction::FMul"; break;
1213 case Instruction::UDiv:Out << "Instruction::UDiv"; break;
1214 case Instruction::SDiv:Out << "Instruction::SDiv"; break;
1215 case Instruction::FDiv:Out << "Instruction::FDiv"; break;
1216 case Instruction::URem:Out << "Instruction::URem"; break;
1217 case Instruction::SRem:Out << "Instruction::SRem"; break;
1218 case Instruction::FRem:Out << "Instruction::FRem"; break;
1219 case Instruction::And: Out << "Instruction::And"; break;
1220 case Instruction::Or: Out << "Instruction::Or"; break;
1221 case Instruction::Xor: Out << "Instruction::Xor"; break;
1222 case Instruction::Shl: Out << "Instruction::Shl"; break;
1223 case Instruction::LShr:Out << "Instruction::LShr"; break;
1224 case Instruction::AShr:Out << "Instruction::AShr"; break;
1225 default: Out << "Instruction::BadOpCode"; break;
1227 Out << ", " << opNames[0] << ", " << opNames[1] << ", \"";
1229 Out << "\", " << bbname << ");";
1233 Out << "FCmpInst* " << iName << " = new FCmpInst(*" << bbname << ", ";
1235 case FCmpInst::FCMP_FALSE: Out << "FCmpInst::FCMP_FALSE"; break;
1236 case FCmpInst::FCMP_OEQ : Out << "FCmpInst::FCMP_OEQ"; break;
1237 case FCmpInst::FCMP_OGT : Out << "FCmpInst::FCMP_OGT"; break;
1238 case FCmpInst::FCMP_OGE : Out << "FCmpInst::FCMP_OGE"; break;
1239 case FCmpInst::FCMP_OLT : Out << "FCmpInst::FCMP_OLT"; break;
1240 case FCmpInst::FCMP_OLE : Out << "FCmpInst::FCMP_OLE"; break;
1241 case FCmpInst::FCMP_ONE : Out << "FCmpInst::FCMP_ONE"; break;
1242 case FCmpInst::FCMP_ORD : Out << "FCmpInst::FCMP_ORD"; break;
1243 case FCmpInst::FCMP_UNO : Out << "FCmpInst::FCMP_UNO"; break;
1244 case FCmpInst::FCMP_UEQ : Out << "FCmpInst::FCMP_UEQ"; break;
1245 case FCmpInst::FCMP_UGT : Out << "FCmpInst::FCMP_UGT"; break;
1246 case FCmpInst::FCMP_UGE : Out << "FCmpInst::FCMP_UGE"; break;
1247 case FCmpInst::FCMP_ULT : Out << "FCmpInst::FCMP_ULT"; break;
1248 case FCmpInst::FCMP_ULE : Out << "FCmpInst::FCMP_ULE"; break;
1249 case FCmpInst::FCMP_UNE : Out << "FCmpInst::FCMP_UNE"; break;
1250 case FCmpInst::FCMP_TRUE : Out << "FCmpInst::FCMP_TRUE"; break;
1251 default: Out << "FCmpInst::BAD_ICMP_PREDICATE"; break;
1253 Out << ", " << opNames[0] << ", " << opNames[1] << ", \"";
1255 Out << "\");";
1259 Out << "ICmpInst* " << iName << " = new ICmpInst(*" << bbname << ", ";
1261 case ICmpInst::ICMP_EQ: Out << "ICmpInst::ICMP_EQ"; break;
1262 case ICmpInst::ICMP_NE: Out << "ICmpInst::ICMP_NE"; break;
1263 case ICmpInst::ICMP_ULE: Out << "ICmpInst::ICMP_ULE"; break;
1264 case ICmpInst::ICMP_SLE: Out << "ICmpInst::ICMP_SLE"; break;
1265 case ICmpInst::ICMP_UGE: Out << "ICmpInst::ICMP_UGE"; break;
1266 case ICmpInst::ICMP_SGE: Out << "ICmpInst::ICMP_SGE"; break;
1267 case ICmpInst::ICMP_ULT: Out << "ICmpInst::ICMP_ULT"; break;
1268 case ICmpInst::ICMP_SLT: Out << "ICmpInst::ICMP_SLT"; break;
1269 case ICmpInst::ICMP_UGT: Out << "ICmpInst::ICMP_UGT"; break;
1270 case ICmpInst::ICMP_SGT: Out << "ICmpInst::ICMP_SGT"; break;
1271 default: Out << "ICmpInst::BAD_ICMP_PREDICATE"; break;
1273 Out << ", " << opNames[0] << ", " << opNames[1] << ", \"";
1275 Out << "\");";
1280 Out << "AllocaInst* " << iName << " = new AllocaInst("
1283 Out << opNames[0] << ", ";
1284 Out << "\"";
1286 Out << "\", " << bbname << ");";
1288 nl(Out) << iName << "->setAlignment("
1294 Out << "LoadInst* " << iName << " = new LoadInst("
1297 Out << "\", " << (load->isVolatile() ? "true" : "false" )
1300 nl(Out) << iName << "->setAlignment("
1305 nl(Out) << iName << "->setAtomic("
1312 Out << "StoreInst* " << iName << " = new StoreInst("
1318 nl(Out) << iName << "->setAlignment("
1323 nl(Out) << iName << "->setAtomic("
1331 Out << "GetElementPtrInst* " << iName << " = GetElementPtrInst::Create("
1334 Out << ", " << opNames[1];
1336 Out << "std::vector<Value*> " << iName << "_indices;";
1337 nl(Out);
1339 Out << iName << "_indices.push_back("
1341 nl(Out);
1343 Out << "Instruction* " << iName << " = GetElementPtrInst::Create("
1346 Out << ", \"";
1348 Out << "\", " << bbname << ");";
1354 Out << "PHINode* " << iName << " = PHINode::Create("
1358 Out << "\", " << bbname << ");";
1359 nl(Out);
1361 Out << iName << "->addIncoming("
1364 nl(Out);
1381 Out << "CastInst* " << iName << " = new ";
1383 case Instruction::Trunc: Out << "TruncInst"; break;
1384 case Instruction::ZExt: Out << "ZExtInst"; break;
1385 case Instruction::SExt: Out << "SExtInst"; break;
1386 case Instruction::FPTrunc: Out << "FPTruncInst"; break;
1387 case Instruction::FPExt: Out << "FPExtInst"; break;
1388 case Instruction::FPToUI: Out << "FPToUIInst"; break;
1389 case Instruction::FPToSI: Out << "FPToSIInst"; break;
1390 case Instruction::UIToFP: Out << "UIToFPInst"; break;
1391 case Instruction::SIToFP: Out << "SIToFPInst"; break;
1392 case Instruction::PtrToInt: Out << "PtrToIntInst"; break;
1393 case Instruction::IntToPtr: Out << "IntToPtrInst"; break;
1394 case Instruction::BitCast: Out << "BitCastInst"; break;
1397 Out << "(" << opNames[0] << ", "
1400 Out << "\", " << bbname << ");";
1406 Out << "InlineAsm* " << getCppName(ila) << " = InlineAsm::get("
1411 nl(Out);
1414 Out << "std::vector<Value*> " << iName << "_params;";
1415 nl(Out);
1417 Out << iName << "_params.push_back(" << opNames[i] << ");";
1418 nl(Out);
1420 Out << "CallInst* " << iName << " = CallInst::Create("
1424 Out << "CallInst* " << iName << " = CallInst::Create("
1427 Out << "CallInst* " << iName << " = CallInst::Create("
1431 Out << "\", " << bbname << ");";
1432 nl(Out) << iName << "->setCallingConv(";
1434 Out << ");";
1435 nl(Out) << iName << "->setTailCall("
1437 Out << ");";
1438 nl(Out);
1440 Out << iName << "->setAttributes(" << iName << "_PAL);";
1441 nl(Out);
1446 Out << "SelectInst* " << getCppName(sel) << " = SelectInst::Create(";
1447 Out << opNames[0] << ", " << opNames[1] << ", " << opNames[2] << ", \"";
1449 Out << "\", " << bbname << ");";
1460 Out << "VAArgInst* " << getCppName(va) << " = new VAArgInst("
1463 Out << "\", " << bbname << ");";
1468 Out << "ExtractElementInst* " << getCppName(eei)
1472 Out << "\", " << bbname << ");";
1477 Out << "InsertElementInst* " << getCppName(iei)
1481 Out << "\", " << bbname << ");";
1486 Out << "ShuffleVectorInst* " << getCppName(svi)
1490 Out << "\", " << bbname << ");";
1495 Out << "std::vector<unsigned> " << iName << "_indices;";
1496 nl(Out);
1498 Out << iName << "_indices.push_back("
1500 nl(Out);
1502 Out << "ExtractValueInst* " << getCppName(evi)
1507 Out << "\", " << bbname << ");";
1512 Out << "std::vector<unsigned> " << iName << "_indices;";
1513 nl(Out);
1515 Out << iName << "_indices.push_back("
1517 nl(Out);
1519 Out << "InsertValueInst* " << getCppName(ivi)
1524 Out << "\", " << bbname << ");";
1531 Out << "FenceInst* " << iName
1541 Out << "AtomicCmpXchgInst* " << iName
1546 nl(Out) << iName << "->setName(\"";
1548 Out << "\");";
1570 Out << "AtomicRMWInst* " << iName
1576 nl(Out) << iName << "->setName(\"";
1578 Out << "\");";
1583 nl(Out);
1589 nl(Out) << "// Type Definitions"; nl(Out);
1647 nl(Out) << "// Function Declarations"; nl(Out);
1657 nl(Out) << "// Global Variable Declarations"; nl(Out);
1665 nl(Out) << "// Constant Definitions"; nl(Out);
1675 nl(Out) << "// Global Variable Definitions"; nl(Out);
1685 nl(Out) << "Function* " << getCppName(F);
1686 Out << " = mod->getFunction(\"";
1688 Out << "\");";
1689 nl(Out) << "if (!" << getCppName(F) << ") {";
1690 nl(Out) << getCppName(F);
1692 Out<< " = Function::Create(";
1693 nl(Out,1) << "/*Type=*/" << getCppName(F->getFunctionType()) << ",";
1694 nl(Out) << "/*Linkage=*/";
1696 Out << ",";
1697 nl(Out) << "/*Name=*/\"";
1699 Out << "\", mod); " << (F->isDeclaration()? "// (external, no body)" : "");
1700 nl(Out,-1);
1702 Out << "->setCallingConv(";
1704 Out << ");";
1705 nl(Out);
1708 Out << "->setSection(\"" << F->getSection() << "\");";
1709 nl(Out);
1713 Out << "->setAlignment(" << F->getAlignment() << ");";
1714 nl(Out);
1718 Out << "->setVisibility(";
1720 Out << ");";
1721 nl(Out);
1725 Out << "->setGC(\"" << F->getGC() << "\");";
1726 nl(Out);
1728 Out << "}";
1729 nl(Out);
1732 Out << "->setAttributes(" << getCppName(F) << "_PAL);";
1733 nl(Out);
1748 Out << "Function::arg_iterator args = " << getCppName(F)
1750 nl(Out);
1754 Out << "Value* " << getCppName(AI) << " = args++;";
1755 nl(Out);
1757 Out << getCppName(AI) << "->setName(\"";
1759 Out << "\");";
1760 nl(Out);
1766 nl(Out);
1770 Out << "BasicBlock* " << bbname <<
1774 Out << "\"," << getCppName(BI->getParent()) << ",0);";
1775 nl(Out);
1782 nl(Out) << "// Block " << BI->getName() << " (" << bbname << ")";
1783 nl(Out);
1795 nl(Out) << "// Resolve Forward References";
1796 nl(Out);
1801 Out << I->second << "->replaceAllUsesWith("
1803 nl(Out);
1819 nl(Out) << "BasicBlock* " << fname << "(Module* mod, Function *"
1824 Out << ", Value* arg_" << arg_count;
1826 Out << ") {";
1827 nl(Out);
1832 Out << "return " << getCppName(F->begin()) << ";";
1833 nl(Out) << "}";
1834 nl(Out);
1839 nl(Out) << "// Type Definitions"; nl(Out);
1844 nl(Out) << "// Function Declarations"; nl(Out);
1851 nl(Out) << "// Global Variable Declarations\n"; nl(Out);
1860 nl(Out) << "// Constant Definitions"; nl(Out);
1866 nl(Out) << "// Global Variable Definitions"; nl(Out);
1873 nl(Out) << "// Function Definitions"; nl(Out);
1877 nl(Out) << "// Function: " << I->getName() << " (" << getCppName(I)
1879 nl(Out) << "{";
1880 nl(Out,1);
1882 nl(Out,-1) << "}";
1883 nl(Out);
1890 Out << "#include <llvm/LLVMContext.h>\n";
1891 Out << "#include <llvm/Module.h>\n";
1892 Out << "#include <llvm/DerivedTypes.h>\n";
1893 Out << "#include <llvm/Constants.h>\n";
1894 Out << "#include <llvm/GlobalVariable.h>\n";
1895 Out << "#include <llvm/Function.h>\n";
1896 Out << "#include <llvm/CallingConv.h>\n";
1897 Out << "#include <llvm/BasicBlock.h>\n";
1898 Out << "#include <llvm/Instructions.h>\n";
1899 Out << "#include <llvm/InlineAsm.h>\n";
1900 Out << "#include <llvm/Support/FormattedStream.h>\n";
1901 Out << "#include <llvm/Support/MathExtras.h>\n";
1902 Out << "#include <llvm/Pass.h>\n";
1903 Out << "#include <llvm/PassManager.h>\n";
1904 Out << "#include <llvm/ADT/SmallVector.h>\n";
1905 Out << "#include <llvm/Analysis/Verifier.h>\n";
1906 Out << "#include <llvm/Assembly/PrintModulePass.h>\n";
1907 Out << "#include <algorithm>\n";
1908 Out << "using namespace llvm;\n\n";
1909 Out << "Module* " << fname << "();\n\n";
1910 Out << "int main(int argc, char**argv) {\n";
1911 Out << " Module* Mod = " << fname << "();\n";
1912 Out << " verifyModule(*Mod, PrintMessageAction);\n";
1913 Out << " PassManager PM;\n";
1914 Out << " PM.add(createPrintModulePass(&outs()));\n";
1915 Out << " PM.run(*Mod);\n";
1916 Out << " return 0;\n";
1917 Out << "}\n\n";
1923 nl(Out) << "Module* " << fname << "() {";
1924 nl(Out,1) << "// Module Construction";
1925 nl(Out) << "Module* mod = new Module(\"";
1927 Out << "\", getGlobalContext());";
1929 nl(Out) << "mod->setDataLayout(\"" << TheModule->getDataLayout() << "\");";
1932 nl(Out) << "mod->setTargetTriple(\"" << TheModule->getTargetTriple()
1937 nl(Out) << "mod->setModuleInlineAsm(\"";
1939 Out << "\");";
1941 nl(Out);
1947 Out << "mod->addLibrary(\"" << *LI << "\");";
1948 nl(Out);
1952 nl(Out) << "return mod;";
1953 nl(Out,-1) << "}";
1954 nl(Out);
1959 Out << "\nModule* " << fname << "(Module *mod) {\n";
1960 Out << "\nmod->setModuleIdentifier(\"";
1962 Out << "\");\n";
1964 Out << "\nreturn mod;\n";
1965 Out << "\n}\n";
1975 Out << "\nFunction* " << fname << "(Module *mod) {\n";
1979 Out << "return " << getCppName(F) << ";\n";
1980 Out << "}\n";
2006 Out << "\nGlobalVariable* " << fname << "(Module *mod) {\n";
2010 Out << "return " << getCppName(GV) << ";\n";
2011 Out << "}\n";
2021 Out << "\nType* " << fname << "(Module *mod) {\n";
2023 Out << "return " << getCppName(Ty) << ";\n";
2024 Out << "}\n";
2031 Out << "// Generated by llvm2cpp - DO NOT MODIFY!\n\n";