Lines Matching refs:Src
64 LLVMTypeRef Clone(LLVMValueRef Src) { in Clone()
65 return Clone(LLVMTypeOf(Src)); in Clone()
68 LLVMTypeRef Clone(LLVMTypeRef Src) { in Clone()
69 LLVMTypeKind Kind = LLVMGetTypeKind(Src); in Clone()
88 return LLVMIntTypeInContext(Ctx, LLVMGetIntTypeWidth(Src)); in Clone()
90 unsigned ParamCount = LLVMCountParamTypes(Src); in Clone()
94 LLVMGetParamTypes(Src, Params); in Clone()
99 LLVMTypeRef FunTy = LLVMFunctionType(Clone(LLVMGetReturnType(Src)), in Clone()
101 LLVMIsFunctionVarArg(Src)); in Clone()
108 const char *Name = LLVMGetStructName(Src); in Clone()
114 if (LLVMIsOpaqueStruct(Src)) in Clone()
118 unsigned EltCount = LLVMCountStructElementTypes(Src); in Clone()
121 Elts.push_back(Clone(LLVMStructGetTypeAtIndex(Src, i))); in Clone()
123 LLVMStructSetBody(S, Elts.data(), EltCount, LLVMIsPackedStruct(Src)); in Clone()
126 LLVMIsPackedStruct(Src)); in Clone()
131 Clone(LLVMGetElementType(Src)), in Clone()
132 LLVMGetArrayLength(Src) in Clone()
136 Clone(LLVMGetElementType(Src)), in Clone()
137 LLVMGetPointerAddressSpace(Src) in Clone()
141 Clone(LLVMGetElementType(Src)), in Clone()
142 LLVMGetVectorSize(Src) in Clone()
157 static ValueMap clone_params(LLVMValueRef Src, LLVMValueRef Dst) { in clone_params() argument
158 unsigned Count = LLVMCountParams(Src); in clone_params()
166 LLVMValueRef SrcFirst = LLVMGetFirstParam(Src); in clone_params()
168 LLVMValueRef SrcLast = LLVMGetLastParam(Src); in clone_params()
344 FunCloner(LLVMValueRef Src, LLVMValueRef Dst): Fun(Dst), in FunCloner()
345 M(LLVMGetGlobalParent(Fun)), VMap(clone_params(Src, Dst)) {} in FunCloner()
347 LLVMTypeRef CloneType(LLVMTypeRef Src) { in CloneType()
348 return TypeCloner(M).Clone(Src); in CloneType()
351 LLVMTypeRef CloneType(LLVMValueRef Src) { in CloneType()
352 return TypeCloner(M).Clone(Src); in CloneType()
356 LLVMValueRef CloneValue(LLVMValueRef Src) { in CloneValue()
358 if (LLVMIsAConstant(Src)) in CloneValue()
359 return clone_constant(Src, M); in CloneValue()
362 auto i = VMap.find(Src); in CloneValue()
366 if (!LLVMIsAInstruction(Src)) in CloneValue()
371 auto BB = DeclareBB(LLVMGetInstructionParent(Src)); in CloneValue()
373 auto Dst = CloneInstruction(Src, Builder); in CloneValue()
378 void CloneAttrs(LLVMValueRef Src, LLVMValueRef Dst) { in CloneAttrs()
380 int ArgCount = LLVMGetNumArgOperands(Src); in CloneAttrs()
383 if (auto SrcA = LLVMGetCallSiteEnumAttribute(Src, i, k)) { in CloneAttrs()
392 LLVMValueRef CloneInstruction(LLVMValueRef Src, LLVMBuilderRef Builder) { in CloneInstruction()
393 check_value_kind(Src, LLVMInstructionValueKind); in CloneInstruction()
394 if (!LLVMIsAInstruction(Src)) in CloneInstruction()
397 const char *Name = LLVMGetValueName(Src); in CloneInstruction()
401 auto i = VMap.find(Src); in CloneInstruction()
417 LLVMOpcode Op = LLVMGetInstructionOpcode(Src); in CloneInstruction()
420 int OpCount = LLVMGetNumOperands(Src); in CloneInstruction()
424 Dst = LLVMBuildRet(Builder, CloneValue(LLVMGetOperand(Src, 0))); in CloneInstruction()
428 if (!LLVMIsConditional(Src)) { in CloneInstruction()
429 LLVMValueRef SrcOp = LLVMGetOperand(Src, 0); in CloneInstruction()
435 LLVMValueRef Cond = LLVMGetCondition(Src); in CloneInstruction()
436 LLVMValueRef Else = LLVMGetOperand(Src, 1); in CloneInstruction()
438 LLVMValueRef Then = LLVMGetOperand(Src, 2); in CloneInstruction()
448 int ArgCount = LLVMGetNumArgOperands(Src); in CloneInstruction()
450 Args.push_back(CloneValue(LLVMGetOperand(Src, i))); in CloneInstruction()
451 LLVMValueRef Fn = CloneValue(LLVMGetCalledValue(Src)); in CloneInstruction()
452 LLVMBasicBlockRef Then = DeclareBB(LLVMGetNormalDest(Src)); in CloneInstruction()
453 LLVMBasicBlockRef Unwind = DeclareBB(LLVMGetUnwindDest(Src)); in CloneInstruction()
456 CloneAttrs(Src, Dst); in CloneInstruction()
463 LLVMValueRef LHS = CloneValue(LLVMGetOperand(Src, 0)); in CloneInstruction()
464 LLVMValueRef RHS = CloneValue(LLVMGetOperand(Src, 1)); in CloneInstruction()
469 LLVMValueRef LHS = CloneValue(LLVMGetOperand(Src, 0)); in CloneInstruction()
470 LLVMValueRef RHS = CloneValue(LLVMGetOperand(Src, 1)); in CloneInstruction()
475 LLVMValueRef LHS = CloneValue(LLVMGetOperand(Src, 0)); in CloneInstruction()
476 LLVMValueRef RHS = CloneValue(LLVMGetOperand(Src, 1)); in CloneInstruction()
481 LLVMValueRef LHS = CloneValue(LLVMGetOperand(Src, 0)); in CloneInstruction()
482 LLVMValueRef RHS = CloneValue(LLVMGetOperand(Src, 1)); in CloneInstruction()
487 LLVMValueRef LHS = CloneValue(LLVMGetOperand(Src, 0)); in CloneInstruction()
488 LLVMValueRef RHS = CloneValue(LLVMGetOperand(Src, 1)); in CloneInstruction()
493 LLVMValueRef LHS = CloneValue(LLVMGetOperand(Src, 0)); in CloneInstruction()
494 LLVMValueRef RHS = CloneValue(LLVMGetOperand(Src, 1)); in CloneInstruction()
499 LLVMValueRef LHS = CloneValue(LLVMGetOperand(Src, 0)); in CloneInstruction()
500 LLVMValueRef RHS = CloneValue(LLVMGetOperand(Src, 1)); in CloneInstruction()
505 LLVMValueRef LHS = CloneValue(LLVMGetOperand(Src, 0)); in CloneInstruction()
506 LLVMValueRef RHS = CloneValue(LLVMGetOperand(Src, 1)); in CloneInstruction()
511 LLVMValueRef LHS = CloneValue(LLVMGetOperand(Src, 0)); in CloneInstruction()
512 LLVMValueRef RHS = CloneValue(LLVMGetOperand(Src, 1)); in CloneInstruction()
517 LLVMValueRef LHS = CloneValue(LLVMGetOperand(Src, 0)); in CloneInstruction()
518 LLVMValueRef RHS = CloneValue(LLVMGetOperand(Src, 1)); in CloneInstruction()
523 LLVMValueRef LHS = CloneValue(LLVMGetOperand(Src, 0)); in CloneInstruction()
524 LLVMValueRef RHS = CloneValue(LLVMGetOperand(Src, 1)); in CloneInstruction()
529 LLVMValueRef LHS = CloneValue(LLVMGetOperand(Src, 0)); in CloneInstruction()
530 LLVMValueRef RHS = CloneValue(LLVMGetOperand(Src, 1)); in CloneInstruction()
535 LLVMValueRef LHS = CloneValue(LLVMGetOperand(Src, 0)); in CloneInstruction()
536 LLVMValueRef RHS = CloneValue(LLVMGetOperand(Src, 1)); in CloneInstruction()
541 LLVMTypeRef Ty = CloneType(LLVMGetAllocatedType(Src)); in CloneInstruction()
546 LLVMValueRef Ptr = CloneValue(LLVMGetOperand(Src, 0)); in CloneInstruction()
548 LLVMSetAlignment(Dst, LLVMGetAlignment(Src)); in CloneInstruction()
552 LLVMValueRef Val = CloneValue(LLVMGetOperand(Src, 0)); in CloneInstruction()
553 LLVMValueRef Ptr = CloneValue(LLVMGetOperand(Src, 1)); in CloneInstruction()
555 LLVMSetAlignment(Dst, LLVMGetAlignment(Src)); in CloneInstruction()
559 LLVMValueRef Ptr = CloneValue(LLVMGetOperand(Src, 0)); in CloneInstruction()
561 int NumIdx = LLVMGetNumIndices(Src); in CloneInstruction()
563 Idx.push_back(CloneValue(LLVMGetOperand(Src, i))); in CloneInstruction()
564 if (LLVMIsInBounds(Src)) in CloneInstruction()
571 LLVMValueRef Ptr = CloneValue(LLVMGetOperand(Src, 0)); in CloneInstruction()
572 LLVMValueRef Cmp = CloneValue(LLVMGetOperand(Src, 1)); in CloneInstruction()
573 LLVMValueRef New = CloneValue(LLVMGetOperand(Src, 2)); in CloneInstruction()
574 LLVMAtomicOrdering Succ = LLVMGetCmpXchgSuccessOrdering(Src); in CloneInstruction()
575 LLVMAtomicOrdering Fail = LLVMGetCmpXchgFailureOrdering(Src); in CloneInstruction()
576 LLVMBool SingleThread = LLVMIsAtomicSingleThread(Src); in CloneInstruction()
582 LLVMValueRef V = CloneValue(LLVMGetOperand(Src, 0)); in CloneInstruction()
583 Dst = LLVMBuildBitCast(Builder, V, CloneType(Src), Name); in CloneInstruction()
587 LLVMIntPredicate Pred = LLVMGetICmpPredicate(Src); in CloneInstruction()
588 LLVMValueRef LHS = CloneValue(LLVMGetOperand(Src, 0)); in CloneInstruction()
589 LLVMValueRef RHS = CloneValue(LLVMGetOperand(Src, 1)); in CloneInstruction()
595 VMap[Src] = Dst = LLVMBuildPhi(Builder, CloneType(Src), Name); in CloneInstruction()
600 unsigned IncomingCount = LLVMCountIncoming(Src); in CloneInstruction()
602 Blocks.push_back(DeclareBB(LLVMGetIncomingBlock(Src, i))); in CloneInstruction()
603 Values.push_back(CloneValue(LLVMGetIncomingValue(Src, i))); in CloneInstruction()
611 int ArgCount = LLVMGetNumArgOperands(Src); in CloneInstruction()
613 Args.push_back(CloneValue(LLVMGetOperand(Src, i))); in CloneInstruction()
614 LLVMValueRef Fn = CloneValue(LLVMGetCalledValue(Src)); in CloneInstruction()
616 LLVMSetTailCall(Dst, LLVMIsTailCall(Src)); in CloneInstruction()
617 CloneAttrs(Src, Dst); in CloneInstruction()
621 Dst = LLVMBuildResume(Builder, CloneValue(LLVMGetOperand(Src, 0))); in CloneInstruction()
626 Dst = LLVMBuildLandingPad(Builder, CloneType(Src), nullptr, 0, Name); in CloneInstruction()
627 unsigned NumClauses = LLVMGetNumClauses(Src); in CloneInstruction()
629 LLVMAddClause(Dst, CloneValue(LLVMGetClause(Src, i))); in CloneInstruction()
630 LLVMSetCleanup(Dst, LLVMIsCleanup(Src)); in CloneInstruction()
634 LLVMValueRef Agg = CloneValue(LLVMGetOperand(Src, 0)); in CloneInstruction()
635 if (LLVMGetNumIndices(Src) != 1) in CloneInstruction()
637 auto I = LLVMGetIndices(Src)[0]; in CloneInstruction()
642 LLVMValueRef Agg = CloneValue(LLVMGetOperand(Src, 0)); in CloneInstruction()
643 LLVMValueRef V = CloneValue(LLVMGetOperand(Src, 1)); in CloneInstruction()
644 if (LLVMGetNumIndices(Src) != 1) in CloneInstruction()
646 auto I = LLVMGetIndices(Src)[0]; in CloneInstruction()
660 return VMap[Src] = Dst; in CloneInstruction()
663 LLVMBasicBlockRef DeclareBB(LLVMBasicBlockRef Src) { in DeclareBB()
666 auto i = BBMap.find(Src); in DeclareBB()
672 LLVMValueRef V = LLVMBasicBlockAsValue(Src); in DeclareBB()
673 if (!LLVMValueIsBasicBlock(V) || LLVMValueAsBasicBlock(V) != Src) in DeclareBB()
676 const char *Name = LLVMGetBasicBlockName(Src); in DeclareBB()
682 return BBMap[Src] = BB; in DeclareBB()
685 LLVMBasicBlockRef CloneBB(LLVMBasicBlockRef Src) { in CloneBB()
686 LLVMBasicBlockRef BB = DeclareBB(Src); in CloneBB()
689 LLVMBasicBlockRef Prev = LLVMGetPreviousBasicBlock(Src); in CloneBB()
693 LLVMValueRef First = LLVMGetFirstInstruction(Src); in CloneBB()
694 LLVMValueRef Last = LLVMGetLastInstruction(Src); in CloneBB()
728 void CloneBBs(LLVMValueRef Src) { in CloneBBs()
729 unsigned Count = LLVMCountBasicBlocks(Src); in CloneBBs()
733 LLVMBasicBlockRef First = LLVMGetFirstBasicBlock(Src); in CloneBBs()
734 LLVMBasicBlockRef Last = LLVMGetLastBasicBlock(Src); in CloneBBs()
760 static void declare_symbols(LLVMModuleRef Src, LLVMModuleRef M) { in declare_symbols() argument
761 LLVMValueRef Begin = LLVMGetFirstGlobal(Src); in declare_symbols()
762 LLVMValueRef End = LLVMGetLastGlobal(Src); in declare_symbols()
793 Begin = LLVMGetFirstFunction(Src); in declare_symbols()
794 End = LLVMGetLastFunction(Src); in declare_symbols()
839 static void clone_symbols(LLVMModuleRef Src, LLVMModuleRef M) { in clone_symbols() argument
840 LLVMValueRef Begin = LLVMGetFirstGlobal(Src); in clone_symbols()
841 LLVMValueRef End = LLVMGetLastGlobal(Src); in clone_symbols()
884 Begin = LLVMGetFirstFunction(Src); in clone_symbols()
885 End = LLVMGetLastFunction(Src); in clone_symbols()
929 LLVMModuleRef Src = llvm_load_module(false, true); in llvm_echo() local
931 const char *ModuleName = LLVMGetModuleIdentifier(Src, &Len); in llvm_echo()
943 LLVMSetTarget(M, LLVMGetTarget(Src)); in llvm_echo()
944 LLVMSetModuleDataLayout(M, LLVMGetModuleDataLayout(Src)); in llvm_echo()
945 if (strcmp(LLVMGetDataLayoutStr(M), LLVMGetDataLayoutStr(Src))) in llvm_echo()
948 declare_symbols(Src, M); in llvm_echo()
949 clone_symbols(Src, M); in llvm_echo()