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 << "AttributeSet " << name << "_PAL;";
470 nl(Out);
472 Out << '{'; in(); nl(Out);
473 Out << "SmallVector<AttributeSet, 4> Attrs;"; nl(Out);
474 Out << "AttributeSet PAS;"; in(); nl(Out);
478 Out << "{"; in(); nl(Out);
479 Out << "AttrBuilder B;"; nl(Out);
483 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(mod->getContext(), " << opNames[0]
1169 Out << "std::vector<Value*> " << iName << "_params;";
1170 nl(Out);
1172 Out << iName << "_params.push_back("
1174 nl(Out);
1177 Out << "InvokeInst *" << iName << " = InvokeInst::Create("
1183 Out << "\", " << bbname << ");";
1184 nl(Out) << iName << "->setCallingConv(";
1186 Out << ");";
1188 Out << iName << "->setAttributes(" << iName << "_PAL);";
1189 nl(Out);
1193 Out << "new UnreachableInst("
1216 Out << "BinaryOperator* " << iName << " = BinaryOperator::Create(";
1218 case Instruction::Add: Out << "Instruction::Add"; break;
1219 case Instruction::FAdd: Out << "Instruction::FAdd"; break;
1220 case Instruction::Sub: Out << "Instruction::Sub"; break;
1221 case Instruction::FSub: Out << "Instruction::FSub"; break;
1222 case Instruction::Mul: Out << "Instruction::Mul"; break;
1223 case Instruction::FMul: Out << "Instruction::FMul"; break;
1224 case Instruction::UDiv:Out << "Instruction::UDiv"; break;
1225 case Instruction::SDiv:Out << "Instruction::SDiv"; break;
1226 case Instruction::FDiv:Out << "Instruction::FDiv"; break;
1227 case Instruction::URem:Out << "Instruction::URem"; break;
1228 case Instruction::SRem:Out << "Instruction::SRem"; break;
1229 case Instruction::FRem:Out << "Instruction::FRem"; break;
1230 case Instruction::And: Out << "Instruction::And"; break;
1231 case Instruction::Or: Out << "Instruction::Or"; break;
1232 case Instruction::Xor: Out << "Instruction::Xor"; break;
1233 case Instruction::Shl: Out << "Instruction::Shl"; break;
1234 case Instruction::LShr:Out << "Instruction::LShr"; break;
1235 case Instruction::AShr:Out << "Instruction::AShr"; break;
1236 default: Out << "Instruction::BadOpCode"; break;
1238 Out << ", " << opNames[0] << ", " << opNames[1] << ", \"";
1240 Out << "\", " << bbname << ");";
1244 Out << "FCmpInst* " << iName << " = new FCmpInst(*" << bbname << ", ";
1246 case FCmpInst::FCMP_FALSE: Out << "FCmpInst::FCMP_FALSE"; break;
1247 case FCmpInst::FCMP_OEQ : Out << "FCmpInst::FCMP_OEQ"; break;
1248 case FCmpInst::FCMP_OGT : Out << "FCmpInst::FCMP_OGT"; break;
1249 case FCmpInst::FCMP_OGE : Out << "FCmpInst::FCMP_OGE"; break;
1250 case FCmpInst::FCMP_OLT : Out << "FCmpInst::FCMP_OLT"; break;
1251 case FCmpInst::FCMP_OLE : Out << "FCmpInst::FCMP_OLE"; break;
1252 case FCmpInst::FCMP_ONE : Out << "FCmpInst::FCMP_ONE"; break;
1253 case FCmpInst::FCMP_ORD : Out << "FCmpInst::FCMP_ORD"; break;
1254 case FCmpInst::FCMP_UNO : Out << "FCmpInst::FCMP_UNO"; break;
1255 case FCmpInst::FCMP_UEQ : Out << "FCmpInst::FCMP_UEQ"; break;
1256 case FCmpInst::FCMP_UGT : Out << "FCmpInst::FCMP_UGT"; break;
1257 case FCmpInst::FCMP_UGE : Out << "FCmpInst::FCMP_UGE"; break;
1258 case FCmpInst::FCMP_ULT : Out << "FCmpInst::FCMP_ULT"; break;
1259 case FCmpInst::FCMP_ULE : Out << "FCmpInst::FCMP_ULE"; break;
1260 case FCmpInst::FCMP_UNE : Out << "FCmpInst::FCMP_UNE"; break;
1261 case FCmpInst::FCMP_TRUE : Out << "FCmpInst::FCMP_TRUE"; break;
1262 default: Out << "FCmpInst::BAD_ICMP_PREDICATE"; break;
1264 Out << ", " << opNames[0] << ", " << opNames[1] << ", \"";
1266 Out << "\");";
1270 Out << "ICmpInst* " << iName << " = new ICmpInst(*" << bbname << ", ";
1272 case ICmpInst::ICMP_EQ: Out << "ICmpInst::ICMP_EQ"; break;
1273 case ICmpInst::ICMP_NE: Out << "ICmpInst::ICMP_NE"; break;
1274 case ICmpInst::ICMP_ULE: Out << "ICmpInst::ICMP_ULE"; break;
1275 case ICmpInst::ICMP_SLE: Out << "ICmpInst::ICMP_SLE"; break;
1276 case ICmpInst::ICMP_UGE: Out << "ICmpInst::ICMP_UGE"; break;
1277 case ICmpInst::ICMP_SGE: Out << "ICmpInst::ICMP_SGE"; break;
1278 case ICmpInst::ICMP_ULT: Out << "ICmpInst::ICMP_ULT"; break;
1279 case ICmpInst::ICMP_SLT: Out << "ICmpInst::ICMP_SLT"; break;
1280 case ICmpInst::ICMP_UGT: Out << "ICmpInst::ICMP_UGT"; break;
1281 case ICmpInst::ICMP_SGT: Out << "ICmpInst::ICMP_SGT"; break;
1282 default: Out << "ICmpInst::BAD_ICMP_PREDICATE"; break;
1284 Out << ", " << opNames[0] << ", " << opNames[1] << ", \"";
1286 Out << "\");";
1291 Out << "AllocaInst* " << iName << " = new AllocaInst("
1294 Out << opNames[0] << ", ";
1295 Out << "\"";
1297 Out << "\", " << bbname << ");";
1299 nl(Out) << iName << "->setAlignment("
1305 Out << "LoadInst* " << iName << " = new LoadInst("
1308 Out << "\", " << (load->isVolatile() ? "true" : "false" )
1311 nl(Out) << iName << "->setAlignment("
1316 nl(Out) << iName << "->setAtomic("
1323 Out << "StoreInst* " << iName << " = new StoreInst("
1329 nl(Out) << iName << "->setAlignment("
1334 nl(Out) << iName << "->setAtomic("
1342 Out << "GetElementPtrInst* " << iName << " = GetElementPtrInst::Create("
1345 Out << ", " << opNames[1];
1347 Out << "std::vector<Value*> " << iName << "_indices;";
1348 nl(Out);
1350 Out << iName << "_indices.push_back("
1352 nl(Out);
1354 Out << "Instruction* " << iName << " = GetElementPtrInst::Create("
1357 Out << ", \"";
1359 Out << "\", " << bbname << ");";
1365 Out << "PHINode* " << iName << " = PHINode::Create("
1369 Out << "\", " << bbname << ");";
1370 nl(Out);
1372 Out << iName << "->addIncoming("
1375 nl(Out);
1392 Out << "CastInst* " << iName << " = new ";
1394 case Instruction::Trunc: Out << "TruncInst"; break;
1395 case Instruction::ZExt: Out << "ZExtInst"; break;
1396 case Instruction::SExt: Out << "SExtInst"; break;
1397 case Instruction::FPTrunc: Out << "FPTruncInst"; break;
1398 case Instruction::FPExt: Out << "FPExtInst"; break;
1399 case Instruction::FPToUI: Out << "FPToUIInst"; break;
1400 case Instruction::FPToSI: Out << "FPToSIInst"; break;
1401 case Instruction::UIToFP: Out << "UIToFPInst"; break;
1402 case Instruction::SIToFP: Out << "SIToFPInst"; break;
1403 case Instruction::PtrToInt: Out << "PtrToIntInst"; break;
1404 case Instruction::IntToPtr: Out << "IntToPtrInst"; break;
1405 case Instruction::BitCast: Out << "BitCastInst"; break;
1408 Out << "(" << opNames[0] << ", "
1411 Out << "\", " << bbname << ");";
1417 Out << "InlineAsm* " << getCppName(ila) << " = InlineAsm::get("
1422 nl(Out);
1425 Out << "std::vector<Value*> " << iName << "_params;";
1426 nl(Out);
1428 Out << iName << "_params.push_back(" << opNames[i] << ");";
1429 nl(Out);
1431 Out << "CallInst* " << iName << " = CallInst::Create("
1435 Out << "CallInst* " << iName << " = CallInst::Create("
1438 Out << "CallInst* " << iName << " = CallInst::Create("
1442 Out << "\", " << bbname << ");";
1443 nl(Out) << iName << "->setCallingConv(";
1445 Out << ");";
1446 nl(Out) << iName << "->setTailCall("
1448 Out << ");";
1449 nl(Out);
1451 Out << iName << "->setAttributes(" << iName << "_PAL);";
1452 nl(Out);
1457 Out << "SelectInst* " << getCppName(sel) << " = SelectInst::Create(";
1458 Out << opNames[0] << ", " << opNames[1] << ", " << opNames[2] << ", \"";
1460 Out << "\", " << bbname << ");";
1471 Out << "VAArgInst* " << getCppName(va) << " = new VAArgInst("
1474 Out << "\", " << bbname << ");";
1479 Out << "ExtractElementInst* " << getCppName(eei)
1483 Out << "\", " << bbname << ");";
1488 Out << "InsertElementInst* " << getCppName(iei)
1492 Out << "\", " << bbname << ");";
1497 Out << "ShuffleVectorInst* " << getCppName(svi)
1501 Out << "\", " << bbname << ");";
1506 Out << "std::vector<unsigned> " << iName << "_indices;";
1507 nl(Out);
1509 Out << iName << "_indices.push_back("
1511 nl(Out);
1513 Out << "ExtractValueInst* " << getCppName(evi)
1518 Out << "\", " << bbname << ");";
1523 Out << "std::vector<unsigned> " << iName << "_indices;";
1524 nl(Out);
1526 Out << iName << "_indices.push_back("
1528 nl(Out);
1530 Out << "InsertValueInst* " << getCppName(ivi)
1535 Out << "\", " << bbname << ");";
1542 Out << "FenceInst* " << iName
1552 Out << "AtomicCmpXchgInst* " << iName
1557 nl(Out) << iName << "->setName(\"";
1559 Out << "\");";
1581 Out << "AtomicRMWInst* " << iName
1587 nl(Out) << iName << "->setName(\"";
1589 Out << "\");";
1594 nl(Out);
1600 nl(Out) << "// Type Definitions"; nl(Out);
1658 nl(Out) << "// Function Declarations"; nl(Out);
1668 nl(Out) << "// Global Variable Declarations"; nl(Out);
1676 nl(Out) << "// Constant Definitions"; nl(Out);
1686 nl(Out) << "// Global Variable Definitions"; nl(Out);
1696 nl(Out) << "Function* " << getCppName(F);
1697 Out << " = mod->getFunction(\"";
1699 Out << "\");";
1700 nl(Out) << "if (!" << getCppName(F) << ") {";
1701 nl(Out) << getCppName(F);
1703 Out<< " = Function::Create(";
1704 nl(Out,1) << "/*Type=*/" << getCppName(F->getFunctionType()) << ",";
1705 nl(Out) << "/*Linkage=*/";
1707 Out << ",";
1708 nl(Out) << "/*Name=*/\"";
1710 Out << "\", mod); " << (F->isDeclaration()? "// (external, no body)" : "");
1711 nl(Out,-1);
1713 Out << "->setCallingConv(";
1715 Out << ");";
1716 nl(Out);
1719 Out << "->setSection(\"" << F->getSection() << "\");";
1720 nl(Out);
1724 Out << "->setAlignment(" << F->getAlignment() << ");";
1725 nl(Out);
1729 Out << "->setVisibility(";
1731 Out << ");";
1732 nl(Out);
1736 Out << "->setGC(\"" << F->getGC() << "\");";
1737 nl(Out);
1739 Out << "}";
1740 nl(Out);
1743 Out << "->setAttributes(" << getCppName(F) << "_PAL);";
1744 nl(Out);
1759 Out << "Function::arg_iterator args = " << getCppName(F)
1761 nl(Out);
1765 Out << "Value* " << getCppName(AI) << " = args++;";
1766 nl(Out);
1768 Out << getCppName(AI) << "->setName(\"";
1770 Out << "\");";
1771 nl(Out);
1777 nl(Out);
1781 Out << "BasicBlock* " << bbname <<
1785 Out << "\"," << getCppName(BI->getParent()) << ",0);";
1786 nl(Out);
1793 nl(Out) << "// Block " << BI->getName() << " (" << bbname << ")";
1794 nl(Out);
1806 nl(Out) << "// Resolve Forward References";
1807 nl(Out);
1812 Out << I->second << "->replaceAllUsesWith("
1814 nl(Out);
1830 nl(Out) << "BasicBlock* " << fname << "(Module* mod, Function *"
1835 Out << ", Value* arg_" << arg_count++;
1837 Out << ") {";
1838 nl(Out);
1843 Out << "return " << getCppName(F->begin()) << ";";
1844 nl(Out) << "}";
1845 nl(Out);
1850 nl(Out) << "// Type Definitions"; nl(Out);
1855 nl(Out) << "// Function Declarations"; nl(Out);
1862 nl(Out) << "// Global Variable Declarations\n"; nl(Out);
1871 nl(Out) << "// Constant Definitions"; nl(Out);
1877 nl(Out) << "// Global Variable Definitions"; nl(Out);
1884 nl(Out) << "// Function Definitions"; nl(Out);
1888 nl(Out) << "// Function: " << I->getName() << " (" << getCppName(I)
1890 nl(Out) << "{";
1891 nl(Out,1);
1893 nl(Out,-1) << "}";
1894 nl(Out);
1901 Out << "#include <llvm/Pass.h>\n";
1902 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 <llvm/IR/BasicBlock.h>\n";
1908 Out << "#include <llvm/IR/CallingConv.h>\n";
1909 Out << "#include <llvm/IR/Constants.h>\n";
1910 Out << "#include <llvm/IR/DerivedTypes.h>\n";
1911 Out << "#include <llvm/IR/Function.h>\n";
1912 Out << "#include <llvm/IR/GlobalVariable.h>\n";
1913 Out << "#include <llvm/IR/InlineAsm.h>\n";
1914 Out << "#include <llvm/IR/Instructions.h>\n";
1915 Out << "#include <llvm/IR/LLVMContext.h>\n";
1916 Out << "#include <llvm/IR/Module.h>\n";
1917 Out << "#include <llvm/Support/FormattedStream.h>\n";
1918 Out << "#include <llvm/Support/MathExtras.h>\n";
1919 Out << "#include <algorithm>\n";
1920 Out << "using namespace llvm;\n\n";
1921 Out << "Module* " << fname << "();\n\n";
1922 Out << "int main(int argc, char**argv) {\n";
1923 Out << " Module* Mod = " << fname << "();\n";
1924 Out << " verifyModule(*Mod, PrintMessageAction);\n";
1925 Out << " PassManager PM;\n";
1926 Out << " PM.add(createPrintModulePass(&outs()));\n";
1927 Out << " PM.run(*Mod);\n";
1928 Out << " return 0;\n";
1929 Out << "}\n\n";
1935 nl(Out) << "Module* " << fname << "() {";
1936 nl(Out,1) << "// Module Construction";
1937 nl(Out) << "Module* mod = new Module(\"";
1939 Out << "\", getGlobalContext());";
1941 nl(Out) << "mod->setDataLayout(\"" << TheModule->getDataLayout() << "\");";
1944 nl(Out) << "mod->setTargetTriple(\"" << TheModule->getTargetTriple()
1949 nl(Out) << "mod->setModuleInlineAsm(\"";
1951 Out << "\");";
1953 nl(Out);
1956 nl(Out) << "return mod;";
1957 nl(Out,-1) << "}";
1958 nl(Out);
1963 Out << "\nModule* " << fname << "(Module *mod) {\n";
1964 Out << "\nmod->setModuleIdentifier(\"";
1966 Out << "\");\n";
1968 Out << "\nreturn mod;\n";
1969 Out << "\n}\n";
1979 Out << "\nFunction* " << fname << "(Module *mod) {\n";
1983 Out << "return " << getCppName(F) << ";\n";
1984 Out << "}\n";
2010 Out << "\nGlobalVariable* " << fname << "(Module *mod) {\n";
2014 Out << "return " << getCppName(GV) << ";\n";
2015 Out << "}\n";
2025 Out << "\nType* " << fname << "(Module *mod) {\n";
2027 Out << "return " << getCppName(Ty) << ";\n";
2028 Out << "}\n";
2035 Out << "// Generated by llvm2cpp - DO NOT MODIFY!\n\n";