forked from OSchip/llvm-project
Make getOperandValue and executeCastOperation methods of Interpreter.
This lets us protect a few more ExecutionEngine methods. llvm-svn: 8367
This commit is contained in:
parent
a7669038fc
commit
9b518bc0be
|
@ -75,14 +75,13 @@ public:
|
||||||
//
|
//
|
||||||
virtual void *getPointerToFunction(Function *F) = 0;
|
virtual void *getPointerToFunction(Function *F) = 0;
|
||||||
|
|
||||||
|
void StoreValueToMemory(GenericValue Val, GenericValue *Ptr, const Type *Ty);
|
||||||
|
void InitializeMemory(const Constant *Init, void *Addr);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void emitGlobals();
|
void emitGlobals();
|
||||||
|
|
||||||
public: // FIXME: protected: // API shared among subclasses
|
|
||||||
GenericValue getConstantValue(const Constant *C);
|
GenericValue getConstantValue(const Constant *C);
|
||||||
void StoreValueToMemory(GenericValue Val, GenericValue *Ptr, const Type *Ty);
|
|
||||||
GenericValue LoadValueFromMemory(GenericValue *Ptr, const Type *Ty);
|
GenericValue LoadValueFromMemory(GenericValue *Ptr, const Type *Ty);
|
||||||
void InitializeMemory(const Constant *Init, void *Addr);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -77,7 +77,7 @@ static GenericValue executeAddInst(GenericValue Src1, GenericValue Src2,
|
||||||
const Type *Ty);
|
const Type *Ty);
|
||||||
|
|
||||||
|
|
||||||
static GenericValue getOperandValue(Value *V, ExecutionContext &SF) {
|
GenericValue Interpreter::getOperandValue(Value *V, ExecutionContext &SF) {
|
||||||
if (ConstantExpr *CE = dyn_cast<ConstantExpr>(V)) {
|
if (ConstantExpr *CE = dyn_cast<ConstantExpr>(V)) {
|
||||||
switch (CE->getOpcode()) {
|
switch (CE->getOpcode()) {
|
||||||
case Instruction::Cast:
|
case Instruction::Cast:
|
||||||
|
@ -840,8 +840,8 @@ void Interpreter::visitShr(ShiftInst &I) {
|
||||||
IMPLEMENT_CAST_CASE_FP_IMP(DESTTY, DESTCTY); \
|
IMPLEMENT_CAST_CASE_FP_IMP(DESTTY, DESTCTY); \
|
||||||
IMPLEMENT_CAST_CASE_END()
|
IMPLEMENT_CAST_CASE_END()
|
||||||
|
|
||||||
static GenericValue executeCastOperation(Value *SrcVal, const Type *Ty,
|
GenericValue Interpreter::executeCastOperation(Value *SrcVal, const Type *Ty,
|
||||||
ExecutionContext &SF) {
|
ExecutionContext &SF) {
|
||||||
const Type *SrcTy = SrcVal->getType();
|
const Type *SrcTy = SrcVal->getType();
|
||||||
GenericValue Dest, Src = getOperandValue(SrcVal, SF);
|
GenericValue Dest, Src = getOperandValue(SrcVal, SF);
|
||||||
|
|
||||||
|
|
|
@ -159,6 +159,9 @@ private: // Helper functions
|
||||||
|
|
||||||
void initializeExecutionEngine();
|
void initializeExecutionEngine();
|
||||||
void initializeExternalFunctions();
|
void initializeExternalFunctions();
|
||||||
|
GenericValue getOperandValue(Value *V, ExecutionContext &SF);
|
||||||
|
GenericValue executeCastOperation(Value *SrcVal, const Type *Ty,
|
||||||
|
ExecutionContext &SF);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue