Home | History | Annotate | Download | only in CppBackend

Lines Matching defs: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);
129 inline void out() { if (indent_level >0) indent_level--; }
167 formatted_raw_ostream &CppWriter::nl(formatted_raw_ostream &Out, int delta) {
168 Out << '\n';
171 Out.indent(indent_level);
172 return Out;
222 Out << "ConstantFP::get(mod->getContext(), ";
223 Out << "APFloat(";
232 Out << "BitsToDouble(" << Buffer << ")";
234 Out << "BitsToFloat((float)" << Buffer << ")";
235 Out << ")";
250 Out << StrVal;
252 Out << StrVal << "f";
254 Out << "BitsToDouble(0x"
258 Out << "BitsToFloat(0x"
262 Out << ")";
266 Out << ")";
272 case CallingConv::C: Out << "CallingConv::C"; break;
273 case CallingConv::Fast: Out << "CallingConv::Fast"; break;
274 case CallingConv::Cold: Out << "CallingConv::Cold"; break;
275 case CallingConv::FirstTargetCC: Out << "CallingConv::FirstTargetCC"; break;
276 default: Out << cc; break;
283 Out << "GlobalValue::InternalLinkage"; break;
285 Out << "GlobalValue::PrivateLinkage"; break;
287 Out << "GlobalValue::AvailableExternallyLinkage "; break;
289 Out << "GlobalValue::LinkOnceAnyLinkage "; break;
291 Out << "GlobalValue::LinkOnceODRLinkage "; break;
293 Out << "GlobalValue::WeakAnyLinkage"; break;
295 Out << "GlobalValue::WeakODRLinkage"; break;
297 Out << "GlobalValue::AppendingLinkage"; break;
299 Out << "GlobalValue::ExternalLinkage"; break;
301 Out << "GlobalValue::ExternalWeakLinkage"; break;
303 Out << "GlobalValue::CommonLinkage"; break;
310 Out << "GlobalValue::DefaultVisibility";
313 Out << "GlobalValue::HiddenVisibility";
316 Out << "GlobalValue::ProtectedVisibility";
325 Out << "GlobalValue::DefaultStorageClass";
328 Out << "GlobalValue::DLLImportStorageClass";
331 Out << "GlobalValue::DLLExportStorageClass";
339 Out << "GlobalVariable::NotThreadLocal";
342 Out << "GlobalVariable::GeneralDynamicTLSModel";
345 Out << "GlobalVariable::LocalDynamicTLSModel";
348 Out << "GlobalVariable::InitialExecTLSModel";
351 Out << "GlobalVariable::LocalExecTLSModel";
362 Out << C;
364 Out << "\\x"
476 Out << "AttributeSet " << name << "_PAL;";
477 nl(Out);
479 Out << '{'; in(); nl(Out);
480 Out << "SmallVector<AttributeSet, 4> Attrs;"; nl(Out);
481 Out << "AttributeSet PAS;"; in(); nl(Out);
485 Out << "{"; in(); nl(Out);
486 Out << "AttrBuilder B;"; nl(Out);
490 Out << "B.addAttribute(Attribute::" #X ");"; nl(Out); \
525 Out << "B.addStackAlignmentAttr(" << attrs.getStackAlignment()<<')';
526 nl(Out);
530 Out << "PAS = AttributeSet::get(mod->getContext(), ";
532 Out << "~0U,";
534 Out << index << "U,";
535 Out << " B);"; out(); nl(Out);
536 Out << "}"; out(); nl(Out);
537 nl(Out);
538 Out << "Attrs.push_back(PAS);"; nl(Out);
540 Out << name << "_PAL = AttributeSet::get(mod->getContext(), Attrs);";
541 nl(Out);
542 out(); nl(Out);
543 Out << '}'; nl(Out);
564 Out << "std::vector<Type*>" << typeName << "_args;";
565 nl(Out);
572 Out << typeName << "_args.push_back(" << argName;
573 Out << ");";
574 nl(Out);
578 Out << "FunctionType* " << typeName << " = FunctionType::get(";
579 in(); nl(Out) << "/*Result=*/" << retTypeName;
580 Out << ",";
581 nl(Out) << "/*Params=*/" << typeName << "_args,";
582 nl(Out) << "/*isVarArg=*/" << (FT->isVarArg() ? "true" : "false") << ");";
583 out();
584 nl(Out);
590 Out << "StructType *" << typeName << " = mod->getTypeByName(\"";
592 Out << "\");";
593 nl(Out);
594 Out << "if (!" << typeName << ") {";
595 nl(Out);
596 Out << typeName << " = ";
597 Out << "StructType::create(mod->getContext(), \"";
599 Out << "\");";
600 nl(Out);
601 Out << "}";
602 nl(Out);
607 Out << "std::vector<Type*>" << typeName << "_fields;";
608 nl(Out);
615 Out << typeName << "_fields.push_back(" << fieldName;
616 Out << ");";
617 nl(Out);
621 Out << "StructType *" << typeName << " = ";
622 Out << "StructType::get(" << "mod->getContext(), ";
624 Out << "if (" << typeName << "->isOpaque()) {";
625 nl(Out);
626 Out << typeName << "->setBody(";
629 Out << typeName << "_fields, /*isPacked=*/"
631 nl(Out);
633 Out << "}";
634 nl(Out);
644 Out << "ArrayType* " << typeName << " = ArrayType::get("
647 nl(Out);
657 Out << "PointerType* " << typeName << " = PointerType::get("
660 nl(Out);
670 Out << "VectorType* " << typeName << " = VectorType::get("
673 nl(Out);
685 nl(Out);
723 // printConstant - Print out a constant pool entry...
736 Out << "ConstantInt* " << constName
741 Out << "ConstantAggregateZero* " << constName
744 Out << "ConstantPointerNull* " << constName
747 Out << "ConstantFP* " << constName << " = ";
749 Out << ";";
751 Out << "std::vector<Constant*> " << constName << "_elems;";
752 nl(Out);
756 Out << constName << "_elems.push_back("
758 nl(Out);
760 Out << "Constant* " << constName << " = ConstantArray::get("
763 Out << "std::vector<Constant*> " << constName << "_fields;";
764 nl(Out);
768 Out << constName << "_fields.push_back("
770 nl(Out);
772 Out << "Constant* " << constName << " = ConstantStruct::get("
775 Out << "std::vector<Constant*> " << constName << "_elems;";
776 nl(Out);
780 Out << constName << "_elems.push_back("
782 nl(Out);
784 Out << "Constant* " << constName << " = ConstantVector::get("
787 Out << "UndefValue* " << constName << " = UndefValue::get("
792 Out << "Constant *" << constName <<
803 Out << "\", true);";
805 Out << "\", false);";// No null terminator
808 Out << "std::vector<Constant*> " << constName << "_elems;";
809 nl(Out);
813 Out << constName << "_elems.push_back(" << getCppName(Elt) << ");";
814 nl(Out);
816 Out << "Constant* " << constName;
819 Out << " = ConstantArray::get(";
821 Out << " = ConstantVector::get(";
822 Out << typeName << ", " << constName << "_elems);";
826 Out << "std::vector<Constant*> " << constName << "_indices;";
827 nl(Out);
831 Out << constName << "_indices.push_back("
833 nl(Out);
835 Out << "Constant* " << constName
841 Out << "Constant* " << constName << " = ConstantExpr::getCast(";
844 case Instruction::Trunc: Out << "Instruction::Trunc"; break;
845 case Instruction::ZExt: Out << "Instruction::ZExt"; break;
846 case Instruction::SExt: Out << "Instruction::SExt"; break;
847 case Instruction::FPTrunc: Out << "Instruction::FPTrunc"; break;
848 case Instruction::FPExt: Out << "Instruction::FPExt"; break;
849 case Instruction::FPToUI: Out << "Instruction::FPToUI"; break;
850 case Instruction::FPToSI: Out << "Instruction::FPToSI"; break;
851 case Instruction::UIToFP: Out << "Instruction::UIToFP"; break;
852 case Instruction::SIToFP: Out << "Instruction::SIToFP"; break;
853 case Instruction::PtrToInt: Out << "Instruction::PtrToInt"; break;
854 case Instruction::IntToPtr: Out << "Instruction::IntToPtr"; break;
855 case Instruction::BitCast: Out << "Instruction::BitCast"; break;
857 Out << ", " << getCppName(CE->getOperand(0)) << ", "
864 Out << "Constant* " << constName << " = ConstantExpr::";
866 case Instruction::Add: Out << "getAdd("; break;
867 case Instruction::FAdd: Out << "getFAdd("; break;
868 case Instruction::Sub: Out << "getSub("; break;
869 case Instruction::FSub: Out << "getFSub("; break;
870 case Instruction::Mul: Out << "getMul("; break;
871 case Instruction::FMul: Out << "getFMul("; break;
872 case Instruction::UDiv: Out << "getUDiv("; break;
873 case Instruction::SDiv: Out << "getSDiv("; break;
874 case Instruction::FDiv: Out << "getFDiv("; break;
875 case Instruction::URem: Out << "getURem("; break;
876 case Instruction::SRem: Out << "getSRem("; break;
877 case Instruction::FRem: Out << "getFRem("; break;
878 case Instruction::And: Out << "getAnd("; break;
879 case Instruction::Or: Out << "getOr("; break;
880 case Instruction::Xor: Out << "getXor("; break;
882 Out << "getICmp(ICmpInst::ICMP_";
884 case ICmpInst::ICMP_EQ: Out << "EQ"; break;
885 case ICmpInst::ICMP_NE: Out << "NE"; break;
886 case ICmpInst::ICMP_SLT: Out << "SLT"; break;
887 case ICmpInst::ICMP_ULT: Out << "ULT"; break;
888 case ICmpInst::ICMP_SGT: Out << "SGT"; break;
889 case ICmpInst::ICMP_UGT: Out << "UGT"; break;
890 case ICmpInst::ICMP_SLE: Out << "SLE"; break;
891 case ICmpInst::ICMP_ULE: Out << "ULE"; break;
892 case ICmpInst::ICMP_SGE: Out << "SGE"; break;
893 case ICmpInst::ICMP_UGE: Out << "UGE"; break;
898 Out << "getFCmp(FCmpInst::FCMP_";
900 case FCmpInst::FCMP_FALSE: Out << "FALSE"; break;
901 case FCmpInst::FCMP_ORD: Out << "ORD"; break;
902 case FCmpInst::FCMP_UNO: Out << "UNO"; break;
903 case FCmpInst::FCMP_OEQ: Out << "OEQ"; break;
904 case FCmpInst::FCMP_UEQ: Out << "UEQ"; break;
905 case FCmpInst::FCMP_ONE: Out << "ONE"; break;
906 case FCmpInst::FCMP_UNE: Out << "UNE"; break;
907 case FCmpInst::FCMP_OLT: Out << "OLT"; break;
908 case FCmpInst::FCMP_ULT: Out << "ULT"; break;
909 Out << "OGT"; break;
910 case FCmpInst::FCMP_UGT: Out << "UGT"; break;
911 case FCmpInst::FCMP_OLE: Out << "OLE"; break;
912 case FCmpInst::FCMP_ULE: Out << "ULE"; break;
913 case FCmpInst::FCMP_OGE: Out << "OGE"; break;
914 case FCmpInst::FCMP_UGE: Out << "UGE"; break;
915 case FCmpInst::FCMP_TRUE: Out << "TRUE"; break;
919 case Instruction::Shl: Out << "getShl("; break;
920 case Instruction::LShr: Out << "getLShr("; break;
921 case Instruction::AShr: Out << "getAShr("; break;
922 case Instruction::Select: Out << "getSelect("; break;
923 case Instruction::ExtractElement: Out << "getExtractElement("; break;
924 case Instruction::InsertElement: Out << "getInsertElement("; break;
925 case Instruction::ShuffleVector: Out << "getShuffleVector("; break;
930 Out << getCppName(CE->getOperand(0));
932 Out << ", " << getCppName(CE->getOperand(i));
933 Out << ");";
936 Out << "Constant* " << constName << " = ";
937 Out << "BlockAddress::get(" << getOpName(BA->getBasicBlock()) << ");";
940 Out << "Constant* " << constName << " = 0; ";
942 nl(Out);
971 nl(Out) << "// Type Definitions";
972 nl(Out);
978 nl(Out)<< "/ Function Declarations"; nl(Out);
981 nl(Out) << "// Global Variable Declarations"; nl(Out);
984 nl(Out) << "// Global Variable Definitions"; nl(Out);
987 nl(Out) << "// Constant Definitions"; nl(Out);
994 nl(Out) << "GlobalVariable* " << getCppName(GV);
996 Out << " = mod->getGlobalVariable(mod->getContext(), ";
998 Out << ", " << getCppName(GV->getType()->getElementType()) << ",true)";
999 nl(Out) << "if (!" << getCppName(GV) << ") {";
1000 in(); nl(Out) << getCppName(GV);
1002 Out << " = new GlobalVariable(/*Module=*/*mod, ";
1003 nl(Out) << "/*Type=*/";
1005 Out << ",";
1006 nl(Out) << "/*isConstant=*/" << (GV->isConstant()?"true":"false");
1007 Out << ",";
1008 nl(Out) << "/*Linkage=*/";
1010 Out << ",";
1011 nl(Out) << "/*Initializer=*/0, ";
1013 Out << "// has initializer, specified below";
1015 nl(Out) << "/*Name=*/\"";
1017 Out << "\");";
1018 nl(Out);
1022 Out << "->setSection(\"";
1024 Out << "\");";
1025 nl(Out);
1029 Out << "->setAlignment(" << utostr(GV->getAlignment()) << ");";
1030 nl(Out);
1034 Out << "->setVisibility(";
1036 Out << ");";
1037 nl(Out);
1041 Out << "->setDLLStorageClass(";
1043 Out << ");";
1044 nl(Out);
1048 Out << "->setThreadLocalMode(";
1050 Out << ");";
1051 nl(Out);
1054 out(); Out << "}"; nl(Out);
1061 Out << "->setInitializer(";
1062 Out << getCppName(GV->getInitializer()) << ");";
1063 nl(Out);
1083 Out << "Argument* " << result << " = new Argument("
1085 nl(Out);
1130 Out << "ReturnInst::Create(mod->getContext(), "
1136 Out << "BranchInst::Create(" ;
1138 Out << opNames[2] << ", "
1143 Out << opNames[0] << ", ";
1147 Out << bbname << ");";
1152 Out << "SwitchInst* " << iName << " = SwitchInst::Create("
1156 nl(Out);
1161 Out << iName << "->addCase("
1164 nl(Out);
1170 Out << "IndirectBrInst *" << iName << " = IndirectBrInst::Create("
1172 nl(Out);
1174 Out << iName << "->addDestination(" << opNames[i] << ");";
1175 nl(Out);
1180 Out << "ResumeInst::Create(" << opNames[0] << ", " << bbname << ");";
1185 Out << "std::vector<Value*> " << iName << "_params;";
1186 nl(Out);
1188 Out << iName << "_params.push_back("
1190 nl(Out);
1193 Out << "InvokeInst *" << iName << " = InvokeInst::Create("
1199 Out << "\", " << bbname << ");";
1200 nl(Out) << iName << "->setCallingConv(";
1202 Out << ");";
1204 Out << iName << "->setAttributes(" << iName << "_PAL);";
1205 nl(Out);
1209 Out << "new UnreachableInst("
1232 Out << "BinaryOperator* " << iName << " = BinaryOperator::Create(";
1234 case Instruction::Add: Out << "Instruction::Add"; break;
1235 case Instruction::FAdd: Out << "Instruction::FAdd"; break;
1236 case Instruction::Sub: Out << "Instruction::Sub"; break;
1237 case Instruction::FSub: Out << "Instruction::FSub"; break;
1238 case Instruction::Mul: Out << "Instruction::Mul"; break;
1239 case Instruction::FMul: Out << "Instruction::FMul"; break;
1240 case Instruction::UDiv:Out << "Instruction::UDiv"; break;
1241 case Instruction::SDiv:Out << "Instruction::SDiv"; break;
1242 case Instruction::FDiv:Out << "Instruction::FDiv"; break;
1243 case Instruction::URem:Out << "Instruction::URem"; break;
1244 case Instruction::SRem:Out << "Instruction::SRem"; break;
1245 case Instruction::FRem:Out << "Instruction::FRem"; break;
1246 case Instruction::And: Out << "Instruction::And"; break;
1247 case Instruction::Or: Out << "Instruction::Or"; break;
1248 case Instruction::Xor: Out << "Instruction::Xor"; break;
1249 case Instruction::Shl: Out << "Instruction::Shl"; break;
1250 case Instruction::LShr:Out << "Instruction::LShr"; break;
1251 case Instruction::AShr:Out << "Instruction::AShr"; break;
1252 default: Out << "Instruction::BadOpCode"; break;
1254 Out << ", " << opNames[0] << ", " << opNames[1] << ", \"";
1256 Out << "\", " << bbname << ");";
1260 Out << "FCmpInst* " << iName << " = new FCmpInst(*" << bbname << ", ";
1262 case FCmpInst::FCMP_FALSE: Out << "FCmpInst::FCMP_FALSE"; break;
1263 case FCmpInst::FCMP_OEQ : Out << "FCmpInst::FCMP_OEQ"; break;
1264 case FCmpInst::FCMP_OGT : Out << "FCmpInst::FCMP_OGT"; break;
1265 case FCmpInst::FCMP_OGE : Out << "FCmpInst::FCMP_OGE"; break;
1266 case FCmpInst::FCMP_OLT : Out << "FCmpInst::FCMP_OLT"; break;
1267 case FCmpInst::FCMP_OLE : Out << "FCmpInst::FCMP_OLE"; break;
1268 case FCmpInst::FCMP_ONE : Out << "FCmpInst::FCMP_ONE"; break;
1269 case FCmpInst::FCMP_ORD : Out << "FCmpInst::FCMP_ORD"; break;
1270 case FCmpInst::FCMP_UNO : Out << "FCmpInst::FCMP_UNO"; break;
1271 case FCmpInst::FCMP_UEQ : Out << "FCmpInst::FCMP_UEQ"; break;
1272 case FCmpInst::FCMP_UGT : Out << "FCmpInst::FCMP_UGT"; break;
1273 case FCmpInst::FCMP_UGE : Out << "FCmpInst::FCMP_UGE"; break;
1274 case FCmpInst::FCMP_ULT : Out << "FCmpInst::FCMP_ULT"; break;
1275 case FCmpInst::FCMP_ULE : Out << "FCmpInst::FCMP_ULE"; break;
1276 case FCmpInst::FCMP_UNE : Out << "FCmpInst::FCMP_UNE"; break;
1277 case FCmpInst::FCMP_TRUE : Out << "FCmpInst::FCMP_TRUE"; break;
1278 default: Out << "FCmpInst::BAD_ICMP_PREDICATE"; break;
1280 Out << ", " << opNames[0] << ", " << opNames[1] << ", \"";
1282 Out << "\");";
1286 Out << "ICmpInst* " << iName << " = new ICmpInst(*" << bbname << ", ";
1288 case ICmpInst::ICMP_EQ: Out << "ICmpInst::ICMP_EQ"; break;
1289 case ICmpInst::ICMP_NE: Out << "ICmpInst::ICMP_NE"; break;
1290 case ICmpInst::ICMP_ULE: Out << "ICmpInst::ICMP_ULE"; break;
1291 case ICmpInst::ICMP_SLE: Out << "ICmpInst::ICMP_SLE"; break;
1292 case ICmpInst::ICMP_UGE: Out << "ICmpInst::ICMP_UGE"; break;
1293 case ICmpInst::ICMP_SGE: Out << "ICmpInst::ICMP_SGE"; break;
1294 case ICmpInst::ICMP_ULT: Out << "ICmpInst::ICMP_ULT"; break;
1295 case ICmpInst::ICMP_SLT: Out << "ICmpInst::ICMP_SLT"; break;
1296 case ICmpInst::ICMP_UGT: Out << "ICmpInst::ICMP_UGT"; break;
1297 case ICmpInst::ICMP_SGT: Out << "ICmpInst::ICMP_SGT"; break;
1298 default: Out << "ICmpInst::BAD_ICMP_PREDICATE"; break;
1300 Out << ", " << opNames[0] << ", " << opNames[1] << ", \"";
1302 Out << "\");";
1307 Out << "AllocaInst* " << iName << " = new AllocaInst("
1310 Out << opNames[0] << ", ";
1311 Out << "\"";
1313 Out << "\", " << bbname << ");";
1315 nl(Out) << iName << "->setAlignment("
1321 Out << "LoadInst* " << iName << " = new LoadInst("
1324 Out << "\", " << (load->isVolatile() ? "true" : "false" )
1327 nl(Out) << iName << "->setAlignment("
1332 nl(Out) << iName << "->setAtomic("
1339 Out << "StoreInst* " << iName << " = new StoreInst("
1345 nl(Out) << iName << "->setAlignment("
1350 nl(Out) << iName << "->setAtomic("
1358 Out << "GetElementPtrInst* " << iName << " = GetElementPtrInst::Create("
1361 Out << ", " << opNames[1];
1363 Out << "std::vector<Value*> " << iName << "_indices;";
1364 nl(Out);
1366 Out << iName << "_indices.push_back("
1368 nl(Out);
1370 Out << "Instruction* " << iName << " = GetElementPtrInst::Create("
1373 Out << ", \"";
1375 Out << "\", " << bbname << ");";
1381 Out << "PHINode* " << iName << " = PHINode::Create("
1385 Out << "\", " << bbname << ");";
1386 nl(Out);
1388 Out << iName << "->addIncoming("
1391 nl(Out);
1408 Out << "CastInst* " << iName << " = new ";
1410 case Instruction::Trunc: Out << "TruncInst"; break;
1411 case Instruction::ZExt: Out << "ZExtInst"; break;
1412 case Instruction::SExt: Out << "SExtInst"; break;
1413 case Instruction::FPTrunc: Out << "FPTruncInst"; break;
1414 case Instruction::FPExt: Out << "FPExtInst"; break;
1415 case Instruction::FPToUI: Out << "FPToUIInst"; break;
1416 case Instruction::FPToSI: Out << "FPToSIInst"; break;
1417 case Instruction::UIToFP: Out << "UIToFPInst"; break;
1418 case Instruction::SIToFP: Out << "SIToFPInst"; break;
1419 case Instruction::PtrToInt: Out << "PtrToIntInst"; break;
1420 case Instruction::IntToPtr: Out << "IntToPtrInst"; break;
1421 case Instruction::BitCast: Out << "BitCastInst"; break;
1424 Out << "(" << opNames[0] << ", "
1427 Out << "\", " << bbname << ");";
1433 Out << "InlineAsm* " << getCppName(ila) << " = InlineAsm::get("
1438 nl(Out);
1441 Out << "std::vector<Value*> " << iName << "_params;";
1442 nl(Out);
1444 Out << iName << "_params.push_back(" << opNames[i] << ");";
1445 nl(Out);
1447 Out << "CallInst* " << iName << " = CallInst::Create("
1451 Out << "CallInst* " << iName << " = CallInst::Create("
1454 Out << "CallInst* " << iName << " = CallInst::Create("
1458 Out << "\", " << bbname << ");";
1459 nl(Out) << iName << "->setCallingConv(";
1461 Out << ");";
1462 nl(Out) << iName << "->setTailCall("
1464 Out << ");";
1465 nl(Out);
1467 Out << iName << "->setAttributes(" << iName << "_PAL);";
1468 nl(Out);
1473 Out << "SelectInst* " << getCppName(sel) << " = SelectInst::Create(";
1474 Out << opNames[0] << ", " << opNames[1] << ", " << opNames[2] << ", \"";
1476 Out << "\", " << bbname << ");";
1487 Out << "VAArgInst* " << getCppName(va) << " = new VAArgInst("
1490 Out << "\", " << bbname << ");";
1495 Out << "ExtractElementInst* " << getCppName(eei)
1499 Out << "\", " << bbname << ");";
1504 Out << "InsertElementInst* " << getCppName(iei)
1508 Out << "\", " << bbname << ");";
1513 Out << "ShuffleVectorInst* " << getCppName(svi)
1517 Out << "\", " << bbname << ");";
1522 Out << "std::vector<unsigned> " << iName << "_indices;";
1523 nl(Out);
1525 Out << iName << "_indices.push_back("
1527 nl(Out);
1529 Out << "ExtractValueInst* " << getCppName(evi)
1534 Out << "\", " << bbname << ");";
1539 Out << "std::vector<unsigned> " << iName << "_indices;";
1540 nl(Out);
1542 Out << iName << "_indices.push_back("
1544 nl(Out);
1546 Out << "InsertValueInst* " << getCppName(ivi)
1551 Out << "\", " << bbname << ");";
1558 Out << "FenceInst* " << iName
1571 Out << "AtomicCmpXchgInst* " << iName
1577 nl(Out) << iName << "->setName(\"";
1579 Out << "\");";
1580 nl(Out) << iName << "->setVolatile("
1582 nl(Out) << iName << "->setWeak("
1605 Out << "AtomicRMWInst* " << iName
1611 nl(Out) << iName << "->setName(\"";
1613 Out << "\");";
1614 nl(Out) << iName << "->setVolatile("
1620 Out << "LandingPadInst* " << iName << " = LandingPadInst::Create(";
1622 Out << ", " << opNames[0] << ", " << lpi->getNumClauses() << ", \"";
1624 Out << "\", " << bbname << ");";
1625 nl(Out) << iName << "->setCleanup("
1629 nl(Out) << iName << "->addClause(" << opNames[i+1] << ");";
1634 nl(Out);
1638 // Print out the types, constants and declarations needed by one function
1640 nl(Out) << "// Type Definitions"; nl(Out);
1698 nl(Out) << "// Function Declarations"; nl(Out);
1707 nl(Out) << "// Global Variable Declarations"; nl(Out);
1714 nl(Out) << "// Constant Definitions"; nl(Out);
1723 nl(Out) << "// Global Variable Definitions"; nl(Out);
1732 nl(Out) << "Function* " << getCppName(F);
1733 Out << " = mod->getFunction(\"";
1735 Out << "\");";
1736 nl(Out) << "if (!" << getCppName(F) << ") {";
1737 nl(Out) << getCppName(F);
1739 Out<< " = Function::Create(";
1740 nl(Out,1) << "/*Type=*/" << getCppName(F->getFunctionType()) << ",";
1741 nl(Out) << "/*Linkage=*/";
1743 Out << ",";
1744 nl(Out) << "/*Name=*/\"";
1746 Out << "\", mod); " << (F->isDeclaration()? "// (external, no body)" : "");
1747 nl(Out,-1);
1749 Out << "->setCallingConv(";
1751 Out << ");";
1752 nl(Out);
1755 Out << "->setSection(\"" << F->getSection() << "\");";
1756 nl(Out);
1760 Out << "->setAlignment(" << F->getAlignment() << ");";
1761 nl(Out);
1765 Out << "->setVisibility(";
1767 Out << ");";
1768 nl(Out);
1772 Out << "->setDLLStorageClass(";
1774 Out << ");";
1775 nl(Out);
1779 Out << "->setGC(\"" << F->getGC() << "\");";
1780 nl(Out);
1782 Out << "}";
1783 nl(Out);
1786 Out
1787 nl(Out);
1802 Out << "Function::arg_iterator args = " << getCppName(F)
1804 nl(Out);
1808 Out << "Value* " << getCppName(AI) << " = args++;";
1809 nl(Out);
1811 Out << getCppName(AI) << "->setName(\"";
1813 Out << "\");";
1814 nl(Out);
1820 nl(Out);
1824 Out << "BasicBlock* " << bbname <<
1828 Out << "\"," << getCppName(BI->getParent()) << ",0);";
1829 nl(Out);
1836 nl(Out) << "// Block " << BI->getName() << " (" << bbname << ")";
1837 nl(Out);
1849 nl(Out) << "// Resolve Forward References";
1850 nl(Out);
1855 Out << I->second << "->replaceAllUsesWith("
1857 nl(Out);
1873 nl(Out) << "BasicBlock* " << fname << "(Module* mod, Function *"
1878 Out << ", Value* arg_" << arg_count++;
1880 Out << ") {";
1881 nl(Out);
1886 Out << "return " << getCppName(F->begin()) << ";";
1887 nl(Out) << "}";
1888 nl(Out);
1892 // Print out all the type definitions
1893 nl(Out) << "// Type Definitions"; nl(Out);
1898 nl(Out) << "// Function Declarations"; nl(Out);
1905 nl(Out) << "// Global Variable Declarations\n"; nl(Out);
1911 // Print out all the constants definitions. Constants don't recurse except
1914 nl(Out) << "// Constant Definitions"; nl(Out);
1920 nl(Out) << "// Global Variable Definitions"; nl(Out);
1926 // Finally, we can safely put out all of the function bodies.
1927 nl(Out) << "// Function Definitions"; nl(Out);
1931 nl(Out) << "// Function: " << I->getName() << " (" << getCppName(I)
1933 nl(Out) << "{";
1934 nl(Out,1);
1936 nl(Out,-1) << "}";
1937 nl(Out);
1944 Out << "#include <llvm/Pass.h>\n";
1945 Out << "#include <llvm/PassManager.h>\n";
1947 Out << "#include <llvm/ADT/SmallVector.h>\n";
1948 Out << "#include <llvm/Analysis/Verifier.h>\n";
1949 Out << "#include <llvm/IR/BasicBlock.h>\n";
1950 Out << "#include <llvm/IR/CallingConv.h>\n";
1951 Out << "#include <llvm/IR/Constants.h>\n";
1952 Out << "#include <llvm/IR/DerivedTypes.h>\n";
1953 Out << "#include <llvm/IR/Function.h>\n";
1954 Out << "#include <llvm/IR/GlobalVariable.h>\n";
1955 Out << "#include <llvm/IR/IRPrintingPasses.h>\n";
1956 Out << "#include <llvm/IR/InlineAsm.h>\n";
1957 Out << "#include <llvm/IR/Instructions.h>\n";
1958 Out << "#include <llvm/IR/LLVMContext.h>\n";
1959 Out << "#include <llvm/IR/Module.h>\n";
1960 Out << "#include <llvm/Support/FormattedStream.h>\n";
1961 Out << "#include <llvm/Support/MathExtras.h>\n";
1962 Out << "#include <algorithm>\n";
1963 Out << "using namespace llvm;\n\n";
1964 Out << "Module* " << fname << "();\n\n";
1965 Out << "int main(int argc, char**argv) {\n";
1966 Out << " Module* Mod = " << fname << "();\n";
1967 Out << " verifyModule(*Mod, PrintMessageAction);\n";
1968 Out << " PassManager PM;\n";
1969 Out << " PM.add(createPrintModulePass(&outs()));\n";
1970 Out << " PM.run(*Mod);\n";
1971 Out << " return 0;\n";
1972 Out << "}\n\n";
1978 nl(Out) << "Module* " << fname << "() {";
1979 nl(Out,1) << "// Module Construction";
1980 nl(Out) << "Module* mod = new Module(\"";
1982 Out << "\", getGlobalContext());";
1984 nl(Out) << "mod->setDataLayout(\"" << TheModule->getDataLayout() << "\");";
1987 nl(Out) << "mod->setTargetTriple(\"" << TheModule->getTargetTriple()
1992 nl(Out) << "mod->setModuleInlineAsm(\"";
1994 Out << "\");";
1996 nl(Out);
1999 nl(Out) << "return mod;";
2000 nl(Out,-1) << "}";
2001 nl(Out);
2006 Out << "\nModule* " << fname << "(Module *mod) {\n";
2007 Out << "\nmod->setModuleIdentifier(\"";
2009 Out << "\");\n";
2011 Out << "\nreturn mod;\n";
2012 Out << "\n}\n";
2022 Out << "\nFunction* " << fname << "(Module *mod) {\n";
2026 Out << "return " << getCppName(F) << ";\n";
2027 Out << "}\n";
2053 Out << "\nGlobalVariable* " << fname << "(Module *mod) {\n";
2057 Out << "return " << getCppName(GV) << ";\n";
2058 Out << "}\n";
2068 Out << "\nType* " << fname << "(Module *mod) {\n";
2070 Out << "return " << getCppName(Ty) << ";\n";
2071 Out << "}\n";
2078 Out << "// Generated by llvm2cpp - DO NOT MODIFY!\n\n";