Home | History | Annotate | Download | only in ExecutionEngine

Lines Matching refs:GV

88   GVMemoryBlock(const GlobalVariable *GV)
89 : CallbackVH(const_cast<GlobalVariable*>(GV)) {}
94 static char *Create(const GlobalVariable *GV, const DataLayout& TD) {
95 Type *ElTy = GV->getType()->getElementType();
99 TD.getPreferredAlignment(GV))
101 new(RawMemory) GVMemoryBlock(GV);
115 char *ExecutionEngine::getMemoryForGV(const GlobalVariable *GV) {
116 return GVMemoryBlock::Create(GV, *getDataLayout());
159 void ExecutionEngine::addGlobalMapping(const GlobalValue *GV, void *Addr) {
162 DEBUG(dbgs() << "JIT: Map \'" << GV->getName()
164 void *&CurVal = EEState.getGlobalAddressMap(locked)[GV];
172 assert((V == 0 || GV == 0) && "GlobalMapping already established!");
173 V = GV;
194 void *ExecutionEngine::updateGlobalMapping(const GlobalValue *GV, void *Addr) {
202 return EEState.RemoveMapping(locked, GV);
204 void *&CurVal = Map[GV];
215 assert((V == 0 || GV == 0) && "GlobalMapping already established!");
216 V = GV;
221 void *ExecutionEngine::getPointerToGlobalIfAvailable(const GlobalValue *GV) {
225 EEState.getGlobalAddressMap(locked).find(GV);
300 GlobalVariable *GV = module->getNamedGlobal(Name);
306 if (!GV || GV->isDeclaration() || GV->hasLocalLinkage()) return;
310 ConstantArray *InitList = dyn_cast<ConstantArray>(GV->getInitializer());
513 void *ExecutionEngine::getPointerToGlobal(const GlobalValue *GV) {
514 if (Function *F = const_cast<Function*>(dyn_cast<Function>(GV)))
518 if (void *P = EEState.getGlobalAddressMap(locked)[GV])
523 const_cast<GlobalVariable *>(dyn_cast<GlobalVariable>(GV)))
528 return EEState.getGlobalAddressMap(locked)[GV];
567 GenericValue GV = getConstantValue(Op0);
569 GV.IntVal = GV.IntVal.trunc(BitWidth);
570 return GV;
573 GenericValue GV = getConstantValue(Op0);
575 GV.IntVal = GV.IntVal.zext(BitWidth);
576 return GV;
579 GenericValue GV = getConstantValue(Op0);
581 GV.IntVal = GV.IntVal.sext(BitWidth);
582 return GV;
586 GenericValue GV = getConstantValue(Op0);
587 GV.FloatVal = float(GV.DoubleVal);
588 return GV;
592 GenericValue GV = getConstantValue(Op0);
593 GV.DoubleVal = double(GV.FloatVal);
594 return GV;
597 GenericValue GV = getConstantValue(Op0);
599 GV.FloatVal = float(GV.IntVal.roundToDouble());
601 GV.DoubleVal = GV.IntVal.roundToDouble();
604 (void)apf.convertFromAPInt(GV.IntVal,
607 GV.IntVal = apf.bitcastToAPInt();
609 return GV;
612 GenericValue GV = getConstantValue(Op0);
614 GV.FloatVal = float(GV.IntVal.signedRoundToDouble());
616 GV.DoubleVal = GV.IntVal.signedRoundToDouble();
619 (void)apf.convertFromAPInt(GV.IntVal,
622 GV.IntVal = apf.bitcastToAPInt();
624 return GV;
628 GenericValue GV = getConstantValue(Op0);
631 GV.IntVal = APIntOps::RoundFloatToAPInt(GV.FloatVal, BitWidth);
633 GV.IntVal = APIntOps::RoundDoubleToAPInt(GV.DoubleVal, BitWidth);
635 APFloat apf = APFloat(APFloat::x87DoubleExtended, GV.IntVal);
641 GV.IntVal = v; // endian?
643 return GV;
646 GenericValue GV = getConstantValue(Op0);
649 GV.IntVal = APInt(PtrWidth, uintptr_t(GV.PointerVal));
651 GV.IntVal = GV.IntVal.zextOrTrunc(IntWidth);
652 return GV;
655 GenericValue GV = getConstantValue(Op0);
657 GV.IntVal = GV.IntVal.zextOrTrunc(PtrWidth);
658 assert(GV.IntVal.getBitWidth() <= 64 && "Bad pointer width");
659 GV.PointerVal = PointerTy(uintptr_t(GV.IntVal.getZExtValue()));
660 return GV;
663 GenericValue GV = getConstantValue(Op0);
670 GV.FloatVal = GV.IntVal.bitsToFloat();
672 GV.DoubleVal = GV.IntVal.bitsToDouble();
676 GV.IntVal = APInt::floatToBits(GV.FloatVal);
680 GV.IntVal = APInt::doubleToBits(GV.DoubleVal);
686 return GV;
703 GenericValue GV;
709 case Instruction::Add: GV.IntVal = LHS.IntVal + RHS.IntVal; break;
710 case Instruction::Sub: GV.IntVal = LHS.IntVal - RHS.IntVal; break;
711 case Instruction::Mul: GV.IntVal = LHS.IntVal * RHS.IntVal; break;
712 case Instruction::UDiv:GV.IntVal = LHS.IntVal.udiv(RHS.IntVal); break;
713 case Instruction::SDiv:GV.IntVal = LHS.IntVal.sdiv(RHS.IntVal); break;
714 case Instruction::URem:GV.IntVal = LHS.IntVal.urem(RHS.IntVal); break;
715 case Instruction::SRem:GV.IntVal = LHS.IntVal.srem(RHS.IntVal); break;
716 case Instruction::And: GV.IntVal = LHS.IntVal & RHS.IntVal; break;
717 case Instruction::Or: GV.IntVal = LHS.IntVal | RHS.IntVal; break;
718 case Instruction::Xor: GV.IntVal = LHS.IntVal ^ RHS.IntVal; break;
725 GV.FloatVal = LHS.FloatVal + RHS.FloatVal; break;
727 GV.FloatVal = LHS.FloatVal - RHS.FloatVal; break;
729 GV.FloatVal = LHS.FloatVal * RHS.FloatVal; break;
731 GV.FloatVal = LHS.FloatVal / RHS.FloatVal; break;
733 GV.FloatVal = std::fmod(LHS.FloatVal,RHS.FloatVal); break;
740 GV.DoubleVal = LHS.DoubleVal + RHS.DoubleVal; break;
742 GV.DoubleVal = LHS.DoubleVal - RHS.DoubleVal; break;
744 GV.DoubleVal = LHS.DoubleVal * RHS.DoubleVal; break;
746 GV.DoubleVal = LHS.DoubleVal / RHS.DoubleVal; break;
748 GV.DoubleVal = std::fmod(LHS.DoubleVal,RHS.DoubleVal); break;
760 GV.IntVal = apfLHS.bitcastToAPInt();
765 GV.IntVal = apfLHS.bitcastToAPInt();
770 GV.IntVal = apfLHS.bitcastToAPInt();
775 GV.IntVal = apfLHS.bitcastToAPInt();
780 GV.IntVal = apfLHS.bitcastToAPInt();
786 return GV;
820 else if (const GlobalVariable *GV = dyn_cast<GlobalVariable>(C))
821 Result = PTOGV(getOrEmitGlobalVariable(const_cast<GlobalVariable*>(GV)));
1030 const GlobalValue *GV = I;
1031 if (GV->hasLocalLinkage() || GV->isDeclaration() ||
1032 GV->hasAppendingLinkage() || !GV->hasName())
1036 LinkedGlobalsMap[std::make_pair(GV->getName(), GV->getType())];
1041 GVEntry = GV;
1053 if (GV->hasExternalLinkage() || GVEntry->hasExternalWeakLinkage())
1054 GVEntry = GV;
1095 const GlobalValue *GV = NonCanonicalGlobals[i];
1097 LinkedGlobalsMap[std::make_pair(GV->getName(), GV->getType())];
1100 addGlobalMapping(GV, Ptr);
1124 void ExecutionEngine::EmitGlobalVariable(const GlobalVariable *GV) {
1125 void *GA = getPointerToGlobalIfAvailable(GV);
1129 GA = getMemoryForGV(GV);
1130 addGlobalMapping(GV, GA);
1134 if (!GV->isThreadLocal())
1135 InitializeMemory(GV->getInitializer(), GA);
1137 Type *ElTy = GV->getType()->getElementType();