Lines Matching refs:llvm
173 static std::map<std::string, llvm::Value*> namedValues;
186 static llvm::StructType *ourTypeInfoType;
187 static llvm::StructType *ourCaughtResultType;
188 static llvm::StructType *ourExceptionType;
189 static llvm::StructType *ourUnwindExceptionType;
191 static llvm::ConstantInt *ourExceptionNotThrownState;
192 static llvm::ConstantInt *ourExceptionThrownState;
193 static llvm::ConstantInt *ourExceptionCaughtState;
196 typedef std::vector<llvm::Type*> ArgTypes;
214 llvm::Function *createFunction(llvm::Module &module, in createFunction()
215 llvm::Type *retType, in createFunction()
219 llvm::GlobalValue::LinkageTypes linkage, in createFunction()
222 llvm::FunctionType *functType = in createFunction()
223 llvm::FunctionType::get(retType, theArgTypes, isVarArg); in createFunction()
224 llvm::Function *ret = in createFunction()
225 llvm::Function::Create(functType, linkage, functName, &module); in createFunction()
231 for (llvm::Function::arg_iterator argIndex = ret->arg_begin(); in createFunction()
250 static llvm::AllocaInst *createEntryBlockAlloca(llvm::Function &function, in createEntryBlockAlloca()
252 llvm::Type *type, in createEntryBlockAlloca()
253 llvm::Constant *initWith = 0) { in createEntryBlockAlloca()
254 llvm::BasicBlock &block = function.getEntryBlock(); in createEntryBlockAlloca()
255 llvm::IRBuilder<> tmp(&block, block.begin()); in createEntryBlockAlloca()
256 llvm::AllocaInst *ret = tmp.CreateAlloca(type, 0, varName.c_str()); in createEntryBlockAlloca()
423 if (Encoding == llvm::dwarf::DW_EH_PE_omit) in getEncodingSize()
427 case llvm::dwarf::DW_EH_PE_absptr: in getEncodingSize()
429 case llvm::dwarf::DW_EH_PE_udata2: in getEncodingSize()
431 case llvm::dwarf::DW_EH_PE_udata4: in getEncodingSize()
433 case llvm::dwarf::DW_EH_PE_udata8: in getEncodingSize()
435 case llvm::dwarf::DW_EH_PE_sdata2: in getEncodingSize()
437 case llvm::dwarf::DW_EH_PE_sdata4: in getEncodingSize()
439 case llvm::dwarf::DW_EH_PE_sdata8: in getEncodingSize()
457 if (encoding == llvm::dwarf::DW_EH_PE_omit) in readEncodedPointer()
462 case llvm::dwarf::DW_EH_PE_absptr: in readEncodedPointer()
466 case llvm::dwarf::DW_EH_PE_uleb128: in readEncodedPointer()
470 case llvm::dwarf::DW_EH_PE_sleb128: in readEncodedPointer()
473 case llvm::dwarf::DW_EH_PE_udata2: in readEncodedPointer()
477 case llvm::dwarf::DW_EH_PE_udata4: in readEncodedPointer()
481 case llvm::dwarf::DW_EH_PE_udata8: in readEncodedPointer()
485 case llvm::dwarf::DW_EH_PE_sdata2: in readEncodedPointer()
489 case llvm::dwarf::DW_EH_PE_sdata4: in readEncodedPointer()
493 case llvm::dwarf::DW_EH_PE_sdata8: in readEncodedPointer()
505 case llvm::dwarf::DW_EH_PE_absptr: in readEncodedPointer()
508 case llvm::dwarf::DW_EH_PE_pcrel: in readEncodedPointer()
511 case llvm::dwarf::DW_EH_PE_textrel: in readEncodedPointer()
512 case llvm::dwarf::DW_EH_PE_datarel: in readEncodedPointer()
513 case llvm::dwarf::DW_EH_PE_funcrel: in readEncodedPointer()
514 case llvm::dwarf::DW_EH_PE_aligned: in readEncodedPointer()
522 if (encoding & llvm::dwarf::DW_EH_PE_indirect) { in readEncodedPointer()
676 if (lpStartEncoding != llvm::dwarf::DW_EH_PE_omit) { in handleLsda()
683 if (ttypeEncoding != llvm::dwarf::DW_EH_PE_omit) { in handleLsda()
902 void generateStringPrint(llvm::LLVMContext &context, in generateStringPrint()
903 llvm::Module &module, in generateStringPrint()
904 llvm::IRBuilder<> &builder, in generateStringPrint()
907 llvm::Function *printFunct = module.getFunction("printStr"); in generateStringPrint()
909 llvm::Value *stringVar; in generateStringPrint()
910 llvm::Constant *stringConstant = in generateStringPrint()
911 llvm::ConstantDataArray::getString(context, toPrint); in generateStringPrint()
916 new llvm::GlobalVariable(module, in generateStringPrint()
919 llvm::GlobalValue::PrivateLinkage, in generateStringPrint()
928 llvm::Value *cast = builder.CreatePointerCast(stringVar, in generateStringPrint()
946 void generateIntegerPrint(llvm::LLVMContext &context, in generateIntegerPrint()
947 llvm::Module &module, in generateIntegerPrint()
948 llvm::IRBuilder<> &builder, in generateIntegerPrint()
949 llvm::Function &printFunct, in generateIntegerPrint()
950 llvm::Value &toPrint, in generateIntegerPrint()
953 llvm::Constant *stringConstant = in generateIntegerPrint()
954 llvm::ConstantDataArray::getString(context, format); in generateIntegerPrint()
955 llvm::Value *stringVar; in generateIntegerPrint()
960 new llvm::GlobalVariable(module, in generateIntegerPrint()
963 llvm::GlobalValue::PrivateLinkage, in generateIntegerPrint()
972 llvm::Value *cast = builder.CreateBitCast(stringVar, in generateIntegerPrint()
998 static llvm::BasicBlock *createFinallyBlock(llvm::LLVMContext &context, in createFinallyBlock()
999 llvm::Module &module, in createFinallyBlock()
1000 llvm::IRBuilder<> &builder, in createFinallyBlock()
1001 llvm::Function &toAddTo, in createFinallyBlock()
1004 llvm::BasicBlock &terminatorBlock, in createFinallyBlock()
1005 llvm::BasicBlock &unwindResumeBlock, in createFinallyBlock()
1006 llvm::Value **exceptionCaughtFlag, in createFinallyBlock()
1007 llvm::Value **exceptionStorage, in createFinallyBlock()
1008 llvm::Value **caughtResultStorage) { in createFinallyBlock()
1024 llvm::PointerType *exceptionStorageType = builder.getInt8PtrTy(); in createFinallyBlock()
1028 llvm::ConstantPointerNull::get( in createFinallyBlock()
1033 llvm::ConstantAggregateZero::get( in createFinallyBlock()
1036 llvm::BasicBlock *ret = llvm::BasicBlock::Create(context, in createFinallyBlock()
1051 llvm::SwitchInst *theSwitch = builder.CreateSwitch(builder.CreateLoad( in createFinallyBlock()
1074 static llvm::BasicBlock *createCatchBlock(llvm::LLVMContext &context, in createCatchBlock()
1075 llvm::Module &module, in createCatchBlock()
1076 llvm::IRBuilder<> &builder, in createCatchBlock()
1077 llvm::Function &toAddTo, in createCatchBlock()
1080 llvm::BasicBlock &terminatorBlock, in createCatchBlock()
1081 llvm::Value &exceptionCaughtFlag) { in createCatchBlock()
1083 llvm::BasicBlock *ret = llvm::BasicBlock::Create(context, in createCatchBlock()
1126 static llvm::Function *createCatchWrappedInvokeFunction( in createCatchWrappedInvokeFunction()
1127 llvm::Module &module, llvm::IRBuilder<> &builder, in createCatchWrappedInvokeFunction()
1128 llvm::legacy::FunctionPassManager &fpm, llvm::Function &toInvoke, in createCatchWrappedInvokeFunction()
1132 llvm::LLVMContext &context = module.getContext(); in createCatchWrappedInvokeFunction()
1133 llvm::Function *toPrint32Int = module.getFunction("print32Int"); in createCatchWrappedInvokeFunction()
1141 llvm::Function *ret = createFunction(module, in createCatchWrappedInvokeFunction()
1146 llvm::Function::ExternalLinkage, in createCatchWrappedInvokeFunction()
1151 llvm::BasicBlock *entryBlock = llvm::BasicBlock::Create(context, in createCatchWrappedInvokeFunction()
1155 llvm::BasicBlock *normalBlock = llvm::BasicBlock::Create(context, in createCatchWrappedInvokeFunction()
1159 llvm::BasicBlock *exceptionBlock = llvm::BasicBlock::Create(context, in createCatchWrappedInvokeFunction()
1164 llvm::BasicBlock *exceptionRouteBlock = llvm::BasicBlock::Create(context, in createCatchWrappedInvokeFunction()
1169 llvm::BasicBlock *externalExceptionBlock = llvm::BasicBlock::Create(context, in createCatchWrappedInvokeFunction()
1174 llvm::BasicBlock *unwindResumeBlock = llvm::BasicBlock::Create(context, in createCatchWrappedInvokeFunction()
1179 llvm::BasicBlock *endBlock = llvm::BasicBlock::Create(context, "end", ret); in createCatchWrappedInvokeFunction()
1182 std::vector<llvm::BasicBlock*> catchBlocks(numExceptionsToCatch); in createCatchWrappedInvokeFunction()
1183 llvm::Value *exceptionCaughtFlag = NULL; in createCatchWrappedInvokeFunction()
1184 llvm::Value *exceptionStorage = NULL; in createCatchWrappedInvokeFunction()
1185 llvm::Value *caughtResultStorage = NULL; in createCatchWrappedInvokeFunction()
1189 llvm::BasicBlock *finallyBlock = createFinallyBlock(context, in createCatchWrappedInvokeFunction()
1220 std::vector<llvm::Value*> args; in createCatchWrappedInvokeFunction()
1236 llvm::Function *deleteOurException = module.getFunction("deleteOurException"); in createCatchWrappedInvokeFunction()
1266 llvm::Function *personality = module.getFunction("ourPersonality"); in createCatchWrappedInvokeFunction()
1268 llvm::LandingPadInst *caughtResult = in createCatchWrappedInvokeFunction()
1282 llvm::Value *unwindException = builder.CreateExtractValue(caughtResult, 0); in createCatchWrappedInvokeFunction()
1283 llvm::Value *retTypeInfoIndex = builder.CreateExtractValue(caughtResult, 1); in createCatchWrappedInvokeFunction()
1295 llvm::Value *unwindExceptionClass = in createCatchWrappedInvokeFunction()
1304 llvm::ConstantInt::get(builder.getInt64Ty(), in createCatchWrappedInvokeFunction()
1330 llvm::Value *typeInfoThrown = builder.CreatePointerCast( in createCatchWrappedInvokeFunction()
1341 llvm::Value *typeInfoThrownType = in createCatchWrappedInvokeFunction()
1356 llvm::SwitchInst *switchToCatchBlock = builder.CreateSwitch(retTypeInfoIndex, in createCatchWrappedInvokeFunction()
1364 switchToCatchBlock->addCase(llvm::ConstantInt::get( in createCatchWrappedInvokeFunction()
1365 llvm::Type::getInt32Ty(context), i), in createCatchWrappedInvokeFunction()
1369 llvm::verifyFunction(*ret); in createCatchWrappedInvokeFunction()
1390 static llvm::Function *
1391 createThrowExceptionFunction(llvm::Module &module, llvm::IRBuilder<> &builder, in createThrowExceptionFunction()
1392 llvm::legacy::FunctionPassManager &fpm, in createThrowExceptionFunction()
1394 llvm::Function &nativeThrowFunct) { in createThrowExceptionFunction()
1395 llvm::LLVMContext &context = module.getContext(); in createThrowExceptionFunction()
1402 llvm::Function *ret = createFunction(module, in createThrowExceptionFunction()
1407 llvm::Function::ExternalLinkage, in createThrowExceptionFunction()
1413 llvm::BasicBlock *entryBlock = llvm::BasicBlock::Create(context, in createThrowExceptionFunction()
1417 llvm::BasicBlock *nativeThrowBlock = llvm::BasicBlock::Create(context, in createThrowExceptionFunction()
1421 llvm::BasicBlock *generatedThrowBlock = llvm::BasicBlock::Create(context, in createThrowExceptionFunction()
1425 llvm::Value *exceptionType = namedValues["exceptTypeToThrow"]; in createThrowExceptionFunction()
1439 llvm::Function *toPrint32Int = module.getFunction("print32Int"); in createThrowExceptionFunction()
1453 llvm::SwitchInst *theSwitch = builder.CreateSwitch(exceptionType, in createThrowExceptionFunction()
1457 theSwitch->addCase(llvm::ConstantInt::get(llvm::Type::getInt32Ty(context), in createThrowExceptionFunction()
1465 llvm::Function *createOurException = module.getFunction("createOurException"); in createThrowExceptionFunction()
1466 llvm::Function *raiseOurException = module.getFunction( in createThrowExceptionFunction()
1470 llvm::Value *exception = builder.CreateCall(createOurException, in createThrowExceptionFunction()
1477 llvm::verifyFunction(*ret); in createThrowExceptionFunction()
1484 llvm::Module &module,
1485 llvm::IRBuilder<> &builder);
1507 llvm::Function *
1508 createUnwindExceptionTest(llvm::Module &module, llvm::IRBuilder<> &builder, in createUnwindExceptionTest()
1509 llvm::legacy::FunctionPassManager &fpm, in createUnwindExceptionTest()
1519 llvm::Function *nativeThrowFunct = module.getFunction(nativeThrowFunctName); in createUnwindExceptionTest()
1523 llvm::Function *throwFunct = createThrowExceptionFunction(module, in createUnwindExceptionTest()
1535 llvm::Function *innerCatchFunct = createCatchWrappedInvokeFunction(module, in createUnwindExceptionTest()
1549 llvm::Function *outerCatchFunct = createCatchWrappedInvokeFunction(module, in createUnwindExceptionTest()
1600 void runExceptionThrow(llvm::ExecutionEngine *engine, in runExceptionThrow()
1601 llvm::Function *function, in runExceptionThrow()
1636 typedef llvm::ArrayRef<llvm::Type*> TypeArray;
1645 llvm::Module &module, in createStandardUtilityFunctions()
1646 llvm::IRBuilder<> &builder) { in createStandardUtilityFunctions()
1648 llvm::LLVMContext &context = module.getContext(); in createStandardUtilityFunctions()
1654 llvm::ConstantInt::get(llvm::Type::getInt8Ty(context), 0), in createStandardUtilityFunctions()
1656 llvm::ConstantInt::get(llvm::Type::getInt8Ty(context), 1), in createStandardUtilityFunctions()
1658 llvm::ConstantInt::get(llvm::Type::getInt8Ty(context), 2), in createStandardUtilityFunctions()
1663 ourTypeInfoType = llvm::StructType::get(context, in createStandardUtilityFunctions()
1666 llvm::Type *caughtResultFieldTypes[] = { in createStandardUtilityFunctions()
1672 ourCaughtResultType = llvm::StructType::get(context, in createStandardUtilityFunctions()
1676 ourExceptionType = llvm::StructType::get(context, in createStandardUtilityFunctions()
1684 llvm::StructType::get(context, in createStandardUtilityFunctions()
1712 std::vector<llvm::Constant*> structVals; in createStandardUtilityFunctions()
1714 llvm::Constant *nextStruct; in createStandardUtilityFunctions()
1721 structVals.push_back(llvm::ConstantInt::get(builder.getInt32Ty(), i)); in createStandardUtilityFunctions()
1722 nextStruct = llvm::ConstantStruct::get(ourTypeInfoType, structVals); in createStandardUtilityFunctions()
1729 new llvm::GlobalVariable(module, in createStandardUtilityFunctions()
1732 llvm::GlobalValue::ExternalLinkage, in createStandardUtilityFunctions()
1742 llvm::Function *funct = NULL; in createStandardUtilityFunctions()
1746 llvm::Type *retType = builder.getVoidTy(); in createStandardUtilityFunctions()
1759 llvm::Function::ExternalLinkage, in createStandardUtilityFunctions()
1778 llvm::Function::ExternalLinkage, in createStandardUtilityFunctions()
1796 llvm::Function::ExternalLinkage, in createStandardUtilityFunctions()
1814 llvm::Function::ExternalLinkage, in createStandardUtilityFunctions()
1832 llvm::Function::ExternalLinkage, in createStandardUtilityFunctions()
1850 llvm::Function::ExternalLinkage, in createStandardUtilityFunctions()
1868 llvm::Function::ExternalLinkage, in createStandardUtilityFunctions()
1888 llvm::Function::ExternalLinkage, in createStandardUtilityFunctions()
1912 llvm::Function::ExternalLinkage, in createStandardUtilityFunctions()
1918 getDeclaration(&module, llvm::Intrinsic::eh_typeid_for); in createStandardUtilityFunctions()
1948 llvm::TargetOptions Opts; in main()
1950 llvm::InitializeNativeTarget(); in main()
1951 llvm::InitializeNativeTargetAsmPrinter(); in main()
1952 llvm::LLVMContext &context = llvm::getGlobalContext(); in main()
1953 llvm::IRBuilder<> theBuilder(context); in main()
1956 std::unique_ptr<llvm::Module> Owner = in main()
1957 llvm::make_unique<llvm::Module>("my cool jit", context); in main()
1958 llvm::Module *module = Owner.get(); in main()
1960 std::unique_ptr<llvm::RTDyldMemoryManager> MemMgr(new llvm::SectionMemoryManager()); in main()
1963 llvm::EngineBuilder factory(std::move(Owner)); in main()
1964 factory.setEngineKind(llvm::EngineKind::JIT); in main()
1967 llvm::ExecutionEngine *executionEngine = factory.create(); in main()
1970 llvm::legacy::FunctionPassManager fpm(module); in main()
1981 fpm.add(llvm::createBasicAliasAnalysisPass()); in main()
1984 fpm.add(llvm::createPromoteMemoryToRegisterPass()); in main()
1987 fpm.add(llvm::createInstructionCombiningPass()); in main()
1990 fpm.add(llvm::createReassociatePass()); in main()
1993 fpm.add(llvm::createGVNPass()); in main()
1997 fpm.add(llvm::createCFGSimplificationPass()); in main()
2004 llvm::Function *toRun = in main()