Lines Matching refs:GV

98   GVMemoryBlock(const GlobalVariable *GV)  in GVMemoryBlock()  argument
99 : CallbackVH(const_cast<GlobalVariable*>(GV)) {} in GVMemoryBlock()
104 static char *Create(const GlobalVariable *GV, const DataLayout& TD) { in Create() argument
105 Type *ElTy = GV->getValueType(); in Create()
108 alignTo(sizeof(GVMemoryBlock), TD.getPreferredAlign(GV)) + GVSize); in Create()
109 new(RawMemory) GVMemoryBlock(GV); in Create()
123 char *ExecutionEngine::getMemoryForGV(const GlobalVariable *GV) { in getMemoryForGV() argument
124 return GVMemoryBlock::Create(GV, getDataLayout()); in getMemoryForGV()
164 GlobalVariable *GV = Modules[i]->getGlobalVariable(Name,AllowInternal); in FindGlobalVariableNamed() local
165 if (GV && !GV->isDeclaration()) in FindGlobalVariableNamed()
166 return GV; in FindGlobalVariableNamed()
188 std::string ExecutionEngine::getMangledName(const GlobalValue *GV) { in getMangledName() argument
189 assert(GV->hasName() && "Global must have name."); in getMangledName()
195 GV->getParent()->getDataLayout().isDefault() in getMangledName()
197 : GV->getParent()->getDataLayout(); in getMangledName()
199 Mangler::getNameWithPrefix(FullName, GV->getName(), DL); in getMangledName()
203 void ExecutionEngine::addGlobalMapping(const GlobalValue *GV, void *Addr) { in addGlobalMapping() argument
205 addGlobalMapping(getMangledName(GV), (uint64_t) Addr); in addGlobalMapping()
241 uint64_t ExecutionEngine::updateGlobalMapping(const GlobalValue *GV, in updateGlobalMapping() argument
244 return updateGlobalMapping(getMangledName(GV), (uint64_t) Addr); in updateGlobalMapping()
292 void *ExecutionEngine::getPointerToGlobalIfAvailable(const GlobalValue *GV) { in getPointerToGlobalIfAvailable() argument
294 return getPointerToGlobalIfAvailable(getMangledName(GV)); in getPointerToGlobalIfAvailable()
318 if (GlobalValue *GV = Modules[i]->getNamedValue(Name)) in getGlobalValueAtAddress() local
319 return GV; in getGlobalValueAtAddress()
370 GlobalVariable *GV = module.getNamedGlobal(Name); in runStaticConstructorsDestructors() local
376 if (!GV || GV->isDeclaration() || GV->hasLocalLinkage()) return; in runStaticConstructorsDestructors()
380 ConstantArray *InitList = dyn_cast<ConstantArray>(GV->getInitializer()); in runStaticConstructorsDestructors()
565 void *ExecutionEngine::getPointerToGlobal(const GlobalValue *GV) { in getPointerToGlobal() argument
566 if (Function *F = const_cast<Function*>(dyn_cast<Function>(GV))) in getPointerToGlobal()
570 if (void* P = getPointerToGlobalIfAvailable(GV)) in getPointerToGlobal()
575 const_cast<GlobalVariable *>(dyn_cast<GlobalVariable>(GV))) in getPointerToGlobal()
580 return getPointerToGlobalIfAvailable(GV); in getPointerToGlobal()
651 GenericValue GV = getConstantValue(Op0); in getConstantValue() local
653 GV.IntVal = GV.IntVal.trunc(BitWidth); in getConstantValue()
654 return GV; in getConstantValue()
657 GenericValue GV = getConstantValue(Op0); in getConstantValue() local
659 GV.IntVal = GV.IntVal.zext(BitWidth); in getConstantValue()
660 return GV; in getConstantValue()
663 GenericValue GV = getConstantValue(Op0); in getConstantValue() local
665 GV.IntVal = GV.IntVal.sext(BitWidth); in getConstantValue()
666 return GV; in getConstantValue()
670 GenericValue GV = getConstantValue(Op0); in getConstantValue() local
671 GV.FloatVal = float(GV.DoubleVal); in getConstantValue()
672 return GV; in getConstantValue()
676 GenericValue GV = getConstantValue(Op0); in getConstantValue() local
677 GV.DoubleVal = double(GV.FloatVal); in getConstantValue()
678 return GV; in getConstantValue()
681 GenericValue GV = getConstantValue(Op0); in getConstantValue() local
683 GV.FloatVal = float(GV.IntVal.roundToDouble()); in getConstantValue()
685 GV.DoubleVal = GV.IntVal.roundToDouble(); in getConstantValue()
688 (void)apf.convertFromAPInt(GV.IntVal, in getConstantValue()
691 GV.IntVal = apf.bitcastToAPInt(); in getConstantValue()
693 return GV; in getConstantValue()
696 GenericValue GV = getConstantValue(Op0); in getConstantValue() local
698 GV.FloatVal = float(GV.IntVal.signedRoundToDouble()); in getConstantValue()
700 GV.DoubleVal = GV.IntVal.signedRoundToDouble(); in getConstantValue()
703 (void)apf.convertFromAPInt(GV.IntVal, in getConstantValue()
706 GV.IntVal = apf.bitcastToAPInt(); in getConstantValue()
708 return GV; in getConstantValue()
712 GenericValue GV = getConstantValue(Op0); in getConstantValue() local
715 GV.IntVal = APIntOps::RoundFloatToAPInt(GV.FloatVal, BitWidth); in getConstantValue()
717 GV.IntVal = APIntOps::RoundDoubleToAPInt(GV.DoubleVal, BitWidth); in getConstantValue()
719 APFloat apf = APFloat(APFloat::x87DoubleExtended(), GV.IntVal); in getConstantValue()
725 GV.IntVal = v; // endian? in getConstantValue()
727 return GV; in getConstantValue()
730 GenericValue GV = getConstantValue(Op0); in getConstantValue() local
733 GV.IntVal = APInt(PtrWidth, uintptr_t(GV.PointerVal)); in getConstantValue()
735 GV.IntVal = GV.IntVal.zextOrTrunc(IntWidth); in getConstantValue()
736 return GV; in getConstantValue()
739 GenericValue GV = getConstantValue(Op0); in getConstantValue() local
741 GV.IntVal = GV.IntVal.zextOrTrunc(PtrWidth); in getConstantValue()
742 assert(GV.IntVal.getBitWidth() <= 64 && "Bad pointer width"); in getConstantValue()
743 GV.PointerVal = PointerTy(uintptr_t(GV.IntVal.getZExtValue())); in getConstantValue()
744 return GV; in getConstantValue()
747 GenericValue GV = getConstantValue(Op0); in getConstantValue() local
754 GV.FloatVal = GV.IntVal.bitsToFloat(); in getConstantValue()
756 GV.DoubleVal = GV.IntVal.bitsToDouble(); in getConstantValue()
760 GV.IntVal = APInt::floatToBits(GV.FloatVal); in getConstantValue()
764 GV.IntVal = APInt::doubleToBits(GV.DoubleVal); in getConstantValue()
770 return GV; in getConstantValue()
787 GenericValue GV; in getConstantValue() local
793 case Instruction::Add: GV.IntVal = LHS.IntVal + RHS.IntVal; break; in getConstantValue()
794 case Instruction::Sub: GV.IntVal = LHS.IntVal - RHS.IntVal; break; in getConstantValue()
795 case Instruction::Mul: GV.IntVal = LHS.IntVal * RHS.IntVal; break; in getConstantValue()
796 case Instruction::UDiv:GV.IntVal = LHS.IntVal.udiv(RHS.IntVal); break; in getConstantValue()
797 case Instruction::SDiv:GV.IntVal = LHS.IntVal.sdiv(RHS.IntVal); break; in getConstantValue()
798 case Instruction::URem:GV.IntVal = LHS.IntVal.urem(RHS.IntVal); break; in getConstantValue()
799 case Instruction::SRem:GV.IntVal = LHS.IntVal.srem(RHS.IntVal); break; in getConstantValue()
800 case Instruction::And: GV.IntVal = LHS.IntVal & RHS.IntVal; break; in getConstantValue()
801 case Instruction::Or: GV.IntVal = LHS.IntVal | RHS.IntVal; break; in getConstantValue()
802 case Instruction::Xor: GV.IntVal = LHS.IntVal ^ RHS.IntVal; break; in getConstantValue()
809 GV.FloatVal = LHS.FloatVal + RHS.FloatVal; break; in getConstantValue()
811 GV.FloatVal = LHS.FloatVal - RHS.FloatVal; break; in getConstantValue()
813 GV.FloatVal = LHS.FloatVal * RHS.FloatVal; break; in getConstantValue()
815 GV.FloatVal = LHS.FloatVal / RHS.FloatVal; break; in getConstantValue()
817 GV.FloatVal = std::fmod(LHS.FloatVal,RHS.FloatVal); break; in getConstantValue()
824 GV.DoubleVal = LHS.DoubleVal + RHS.DoubleVal; break; in getConstantValue()
826 GV.DoubleVal = LHS.DoubleVal - RHS.DoubleVal; break; in getConstantValue()
828 GV.DoubleVal = LHS.DoubleVal * RHS.DoubleVal; break; in getConstantValue()
830 GV.DoubleVal = LHS.DoubleVal / RHS.DoubleVal; break; in getConstantValue()
832 GV.DoubleVal = std::fmod(LHS.DoubleVal,RHS.DoubleVal); break; in getConstantValue()
844 GV.IntVal = apfLHS.bitcastToAPInt(); in getConstantValue()
849 GV.IntVal = apfLHS.bitcastToAPInt(); in getConstantValue()
854 GV.IntVal = apfLHS.bitcastToAPInt(); in getConstantValue()
859 GV.IntVal = apfLHS.bitcastToAPInt(); in getConstantValue()
863 GV.IntVal = apfLHS.bitcastToAPInt(); in getConstantValue()
869 return GV; in getConstantValue()
906 else if (const GlobalVariable *GV = dyn_cast<GlobalVariable>(C)) in getConstantValue() local
907 Result = PTOGV(getOrEmitGlobalVariable(const_cast<GlobalVariable*>(GV))); in getConstantValue()
1198 for (const auto &GV : M.globals()) { in emitGlobals() local
1199 if (GV.hasLocalLinkage() || GV.isDeclaration() || in emitGlobals()
1200 GV.hasAppendingLinkage() || !GV.hasName()) in emitGlobals()
1204 std::string(GV.getName()), GV.getType())]; in emitGlobals()
1209 GVEntry = &GV; in emitGlobals()
1219 if (GV.hasExternalLinkage() || GVEntry->hasExternalWeakLinkage()) in emitGlobals()
1220 GVEntry = &GV; in emitGlobals()
1228 for (const auto &GV : M.globals()) { in emitGlobals() local
1232 std::string(GV.getName()), GV.getType())]) { in emitGlobals()
1234 if (GVEntry != &GV) { in emitGlobals()
1235 NonCanonicalGlobals.push_back(&GV); in emitGlobals()
1241 if (!GV.isDeclaration()) { in emitGlobals()
1242 addGlobalMapping(&GV, getMemoryForGV(&GV)); in emitGlobals()
1247 std::string(GV.getName()))) in emitGlobals()
1248 addGlobalMapping(&GV, SymAddr); in emitGlobals()
1251 +GV.getName()); in emitGlobals()
1259 for (const GlobalValue *GV : NonCanonicalGlobals) { in emitGlobals() local
1261 std::string(GV->getName()), GV->getType())]; in emitGlobals()
1264 addGlobalMapping(GV, Ptr); in emitGlobals()
1270 for (const auto &GV : M.globals()) { in emitGlobals() local
1271 if (!GV.isDeclaration()) { in emitGlobals()
1274 std::string(GV.getName()), GV.getType())]) in emitGlobals()
1275 if (GVEntry != &GV) // Not the canonical variable. in emitGlobals()
1278 emitGlobalVariable(&GV); in emitGlobals()
1287 void ExecutionEngine::emitGlobalVariable(const GlobalVariable *GV) { in emitGlobalVariable() argument
1288 void *GA = getPointerToGlobalIfAvailable(GV); in emitGlobalVariable()
1292 GA = getMemoryForGV(GV); in emitGlobalVariable()
1297 addGlobalMapping(GV, GA); in emitGlobalVariable()
1301 if (!GV->isThreadLocal()) in emitGlobalVariable()
1302 InitializeMemory(GV->getInitializer(), GA); in emitGlobalVariable()
1304 Type *ElTy = GV->getValueType(); in emitGlobalVariable()