2001-08-24 01:05:04 +08:00
|
|
|
//===-- Interpreter.h ------------------------------------------*- C++ -*--===//
|
2005-04-22 06:43:08 +08:00
|
|
|
//
|
2003-10-21 23:17:13 +08:00
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
2007-12-30 04:36:04 +08:00
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
2005-04-22 06:43:08 +08:00
|
|
|
//
|
2003-10-21 23:17:13 +08:00
|
|
|
//===----------------------------------------------------------------------===//
|
2001-08-24 01:05:04 +08:00
|
|
|
//
|
|
|
|
// This header file defines the interpreter structure
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#ifndef LLI_INTERPRETER_H
|
|
|
|
#define LLI_INTERPRETER_H
|
|
|
|
|
2003-09-06 03:39:22 +08:00
|
|
|
#include "llvm/ExecutionEngine/ExecutionEngine.h"
|
|
|
|
#include "llvm/ExecutionEngine/GenericValue.h"
|
2013-01-02 19:36:10 +08:00
|
|
|
#include "llvm/IR/DataLayout.h"
|
|
|
|
#include "llvm/IR/Function.h"
|
2012-12-04 15:12:27 +08:00
|
|
|
#include "llvm/InstVisitor.h"
|
2009-08-23 12:37:46 +08:00
|
|
|
#include "llvm/Support/CallSite.h"
|
2010-11-30 02:16:10 +08:00
|
|
|
#include "llvm/Support/DataTypes.h"
|
2009-07-12 04:10:48 +08:00
|
|
|
#include "llvm/Support/ErrorHandling.h"
|
2009-08-23 12:37:46 +08:00
|
|
|
#include "llvm/Support/raw_ostream.h"
|
2003-11-12 06:41:34 +08:00
|
|
|
namespace llvm {
|
|
|
|
|
2006-03-23 13:22:51 +08:00
|
|
|
class IntrinsicLowering;
|
2004-02-26 15:59:22 +08:00
|
|
|
struct FunctionInfo;
|
2004-04-05 01:30:06 +08:00
|
|
|
template<typename T> class generic_gep_type_iterator;
|
2003-12-11 08:23:28 +08:00
|
|
|
class ConstantExpr;
|
2004-04-05 03:47:06 +08:00
|
|
|
typedef generic_gep_type_iterator<User::const_op_iterator> gep_type_iterator;
|
2004-04-05 01:30:06 +08:00
|
|
|
|
2001-08-24 01:05:04 +08:00
|
|
|
|
2002-02-20 02:50:09 +08:00
|
|
|
// AllocaHolder - Object to track all of the blocks of memory allocated by
|
2003-12-11 08:23:28 +08:00
|
|
|
// alloca. When the function returns, this object is popped off the execution
|
2002-02-20 02:50:09 +08:00
|
|
|
// stack, which causes the dtor to be run, which frees all the alloca'd memory.
|
|
|
|
//
|
|
|
|
class AllocaHolder {
|
|
|
|
friend class AllocaHolderHandle;
|
|
|
|
std::vector<void*> Allocations;
|
|
|
|
unsigned RefCnt;
|
|
|
|
public:
|
|
|
|
AllocaHolder() : RefCnt(0) {}
|
|
|
|
void add(void *mem) { Allocations.push_back(mem); }
|
|
|
|
~AllocaHolder() {
|
|
|
|
for (unsigned i = 0; i < Allocations.size(); ++i)
|
|
|
|
free(Allocations[i]);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
// AllocaHolderHandle gives AllocaHolder value semantics so we can stick it into
|
|
|
|
// a vector...
|
|
|
|
//
|
|
|
|
class AllocaHolderHandle {
|
|
|
|
AllocaHolder *H;
|
|
|
|
public:
|
|
|
|
AllocaHolderHandle() : H(new AllocaHolder()) { H->RefCnt++; }
|
|
|
|
AllocaHolderHandle(const AllocaHolderHandle &AH) : H(AH.H) { H->RefCnt++; }
|
|
|
|
~AllocaHolderHandle() { if (--H->RefCnt == 0) delete H; }
|
|
|
|
|
|
|
|
void add(void *mem) { H->add(mem); }
|
|
|
|
};
|
|
|
|
|
2002-01-21 06:54:45 +08:00
|
|
|
typedef std::vector<GenericValue> ValuePlaneTy;
|
2001-08-24 01:05:04 +08:00
|
|
|
|
|
|
|
// ExecutionContext struct - This struct represents one stack frame currently
|
|
|
|
// executing.
|
|
|
|
//
|
|
|
|
struct ExecutionContext {
|
2003-05-09 00:18:31 +08:00
|
|
|
Function *CurFunction;// The currently executing function
|
2001-08-24 01:05:04 +08:00
|
|
|
BasicBlock *CurBB; // The currently executing BB
|
|
|
|
BasicBlock::iterator CurInst; // The next instruction to execute
|
2003-10-25 03:59:37 +08:00
|
|
|
std::map<Value *, GenericValue> Values; // LLVM values used in this invocation
|
2003-05-09 00:06:52 +08:00
|
|
|
std::vector<GenericValue> VarArgs; // Values passed through an ellipsis
|
2003-11-08 03:26:23 +08:00
|
|
|
CallSite Caller; // Holds the call that called subframes.
|
|
|
|
// NULL if main func or debugger invoked fn
|
2002-02-20 02:50:09 +08:00
|
|
|
AllocaHolderHandle Allocas; // Track memory allocated by alloca
|
2001-08-24 01:05:04 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
// Interpreter - This class represents the entirety of the interpreter.
|
|
|
|
//
|
2003-05-11 05:22:39 +08:00
|
|
|
class Interpreter : public ExecutionEngine, public InstVisitor<Interpreter> {
|
2006-02-07 13:29:44 +08:00
|
|
|
GenericValue ExitValue; // The return value of the called function
|
2012-10-09 00:38:25 +08:00
|
|
|
DataLayout TD;
|
2003-12-28 17:44:37 +08:00
|
|
|
IntrinsicLowering *IL;
|
2001-08-24 01:05:04 +08:00
|
|
|
|
|
|
|
// The runtime stack of executing code. The top of the stack is the current
|
2002-04-08 04:49:59 +08:00
|
|
|
// function record.
|
2002-01-21 06:54:45 +08:00
|
|
|
std::vector<ExecutionContext> ECStack;
|
2001-08-24 01:05:04 +08:00
|
|
|
|
2003-09-06 02:42:01 +08:00
|
|
|
// AtExitHandlers - List of functions to call when the program exits,
|
|
|
|
// registered with the atexit() library function.
|
2003-05-14 22:21:30 +08:00
|
|
|
std::vector<Function*> AtExitHandlers;
|
2003-09-18 01:26:22 +08:00
|
|
|
|
2001-08-24 01:05:04 +08:00
|
|
|
public:
|
2010-01-28 04:34:15 +08:00
|
|
|
explicit Interpreter(Module *M);
|
2003-12-28 17:44:37 +08:00
|
|
|
~Interpreter();
|
2001-08-24 01:05:04 +08:00
|
|
|
|
2003-12-26 14:13:05 +08:00
|
|
|
/// runAtExitHandlers - Run any functions registered by the program's calls to
|
|
|
|
/// atexit(3), which we intercept and store in AtExitHandlers.
|
2003-09-06 02:42:01 +08:00
|
|
|
///
|
2003-12-26 14:13:05 +08:00
|
|
|
void runAtExitHandlers();
|
2003-09-06 02:42:01 +08:00
|
|
|
|
2006-03-22 14:07:50 +08:00
|
|
|
static void Register() {
|
|
|
|
InterpCtor = create;
|
|
|
|
}
|
|
|
|
|
2006-03-23 13:22:51 +08:00
|
|
|
/// create - Create an interpreter ExecutionEngine. This can never fail.
|
2003-09-04 04:34:19 +08:00
|
|
|
///
|
2010-01-28 04:34:15 +08:00
|
|
|
static ExecutionEngine *create(Module *M, std::string *ErrorStr = 0);
|
2003-09-04 04:34:19 +08:00
|
|
|
|
2002-12-24 07:59:41 +08:00
|
|
|
/// run - Start execution with the specified function and arguments.
|
|
|
|
///
|
2003-12-26 14:13:05 +08:00
|
|
|
virtual GenericValue runFunction(Function *F,
|
|
|
|
const std::vector<GenericValue> &ArgValues);
|
2001-08-24 01:05:04 +08:00
|
|
|
|
2012-01-06 05:16:14 +08:00
|
|
|
virtual void *getPointerToNamedFunction(const std::string &Name,
|
|
|
|
bool AbortOnFailure = true) {
|
|
|
|
// FIXME: not implemented.
|
|
|
|
return 0;
|
2012-01-24 06:55:02 +08:00
|
|
|
}
|
2012-01-06 05:16:14 +08:00
|
|
|
|
2003-12-08 16:23:04 +08:00
|
|
|
/// recompileAndRelinkFunction - For the interpreter, functions are always
|
|
|
|
/// up-to-date.
|
|
|
|
///
|
|
|
|
virtual void *recompileAndRelinkFunction(Function *F) {
|
|
|
|
return getPointerToFunction(F);
|
|
|
|
}
|
|
|
|
|
2004-11-08 07:58:46 +08:00
|
|
|
/// freeMachineCodeForFunction - The interpreter does not generate any code.
|
|
|
|
///
|
|
|
|
void freeMachineCodeForFunction(Function *F) { }
|
2005-04-22 06:43:08 +08:00
|
|
|
|
2003-09-06 02:42:01 +08:00
|
|
|
// Methods used to execute code:
|
|
|
|
// Place a call on the stack
|
2003-05-09 00:18:31 +08:00
|
|
|
void callFunction(Function *F, const std::vector<GenericValue> &ArgVals);
|
2003-09-06 02:42:01 +08:00
|
|
|
void run(); // Execute instructions until nothing left to do
|
2001-08-24 01:05:04 +08:00
|
|
|
|
|
|
|
// Opcode Implementations
|
2003-05-11 05:22:39 +08:00
|
|
|
void visitReturnInst(ReturnInst &I);
|
|
|
|
void visitBranchInst(BranchInst &I);
|
|
|
|
void visitSwitchInst(SwitchInst &I);
|
2009-10-29 13:26:09 +08:00
|
|
|
void visitIndirectBrInst(IndirectBrInst &I);
|
2003-05-11 05:22:39 +08:00
|
|
|
|
|
|
|
void visitBinaryOperator(BinaryOperator &I);
|
2006-12-23 14:05:41 +08:00
|
|
|
void visitICmpInst(ICmpInst &I);
|
|
|
|
void visitFCmpInst(FCmpInst &I);
|
2009-10-24 05:09:37 +08:00
|
|
|
void visitAllocaInst(AllocaInst &I);
|
2003-05-11 05:22:39 +08:00
|
|
|
void visitLoadInst(LoadInst &I);
|
|
|
|
void visitStoreInst(StoreInst &I);
|
|
|
|
void visitGetElementPtrInst(GetElementPtrInst &I);
|
2009-07-12 04:10:48 +08:00
|
|
|
void visitPHINode(PHINode &PN) {
|
2009-07-15 00:55:14 +08:00
|
|
|
llvm_unreachable("PHI nodes already handled!");
|
2009-07-12 04:10:48 +08:00
|
|
|
}
|
For PR1064:
Implement the arbitrary bit-width integer feature. The feature allows
integers of any bitwidth (up to 64) to be defined instead of just 1, 8,
16, 32, and 64 bit integers.
This change does several things:
1. Introduces a new Derived Type, IntegerType, to represent the number of
bits in an integer. The Type classes SubclassData field is used to
store the number of bits. This allows 2^23 bits in an integer type.
2. Removes the five integer Type::TypeID values for the 1, 8, 16, 32 and
64-bit integers. These are replaced with just IntegerType which is not
a primitive any more.
3. Adjust the rest of LLVM to account for this change.
Note that while this incremental change lays the foundation for arbitrary
bit-width integers, LLVM has not yet been converted to actually deal with
them in any significant way. Most optimization passes, for example, will
still only deal with the byte-width integer types. Future increments
will rectify this situation.
llvm-svn: 33113
2007-01-12 15:05:14 +08:00
|
|
|
void visitTruncInst(TruncInst &I);
|
|
|
|
void visitZExtInst(ZExtInst &I);
|
|
|
|
void visitSExtInst(SExtInst &I);
|
|
|
|
void visitFPTruncInst(FPTruncInst &I);
|
|
|
|
void visitFPExtInst(FPExtInst &I);
|
|
|
|
void visitUIToFPInst(UIToFPInst &I);
|
|
|
|
void visitSIToFPInst(SIToFPInst &I);
|
|
|
|
void visitFPToUIInst(FPToUIInst &I);
|
|
|
|
void visitFPToSIInst(FPToSIInst &I);
|
|
|
|
void visitPtrToIntInst(PtrToIntInst &I);
|
|
|
|
void visitIntToPtrInst(IntToPtrInst &I);
|
|
|
|
void visitBitCastInst(BitCastInst &I);
|
2004-04-21 00:43:21 +08:00
|
|
|
void visitSelectInst(SelectInst &I);
|
|
|
|
|
2003-11-08 04:04:22 +08:00
|
|
|
|
|
|
|
void visitCallSite(CallSite CS);
|
|
|
|
void visitCallInst(CallInst &I) { visitCallSite (CallSite (&I)); }
|
|
|
|
void visitInvokeInst(InvokeInst &I) { visitCallSite (CallSite (&I)); }
|
2004-10-17 02:21:33 +08:00
|
|
|
void visitUnreachableInst(UnreachableInst &I);
|
2003-11-08 04:04:22 +08:00
|
|
|
|
2007-02-02 10:16:23 +08:00
|
|
|
void visitShl(BinaryOperator &I);
|
|
|
|
void visitLShr(BinaryOperator &I);
|
|
|
|
void visitAShr(BinaryOperator &I);
|
|
|
|
|
2003-11-08 05:20:47 +08:00
|
|
|
void visitVAArgInst(VAArgInst &I);
|
2013-04-01 23:53:30 +08:00
|
|
|
void visitExtractElementInst(ExtractElementInst &I);
|
2013-09-02 14:40:09 +08:00
|
|
|
void visitInsertElementInst(InsertElementInst &I);
|
|
|
|
void visitShuffleVectorInst(ShuffleVectorInst &I);
|
|
|
|
|
2013-09-12 18:48:23 +08:00
|
|
|
void visitExtractValueInst(ExtractValueInst &I);
|
|
|
|
void visitInsertValueInst(InsertValueInst &I);
|
|
|
|
|
2003-05-11 05:22:39 +08:00
|
|
|
void visitInstruction(Instruction &I) {
|
2011-09-10 04:22:48 +08:00
|
|
|
errs() << I << "\n";
|
2009-07-15 00:55:14 +08:00
|
|
|
llvm_unreachable("Instruction not interpretable yet!");
|
2003-05-11 05:22:39 +08:00
|
|
|
}
|
|
|
|
|
2005-04-22 06:43:08 +08:00
|
|
|
GenericValue callExternalFunction(Function *F,
|
2003-05-09 00:18:31 +08:00
|
|
|
const std::vector<GenericValue> &ArgVals);
|
2001-10-27 12:15:57 +08:00
|
|
|
void exitCalled(GenericValue GV);
|
2001-08-24 01:05:04 +08:00
|
|
|
|
2003-05-14 22:21:30 +08:00
|
|
|
void addAtExitHandler(Function *F) {
|
|
|
|
AtExitHandlers.push_back(F);
|
|
|
|
}
|
|
|
|
|
2003-11-13 14:06:01 +08:00
|
|
|
GenericValue *getFirstVarArg () {
|
2004-02-13 14:18:39 +08:00
|
|
|
return &(ECStack.back ().VarArgs[0]);
|
2003-11-13 14:06:01 +08:00
|
|
|
}
|
|
|
|
|
2010-05-01 10:43:10 +08:00
|
|
|
private: // Helper functions
|
2003-11-26 04:44:56 +08:00
|
|
|
GenericValue executeGEPOperation(Value *Ptr, gep_type_iterator I,
|
2005-04-22 12:08:30 +08:00
|
|
|
gep_type_iterator E, ExecutionContext &SF);
|
2002-12-24 07:59:41 +08:00
|
|
|
|
2003-05-11 04:21:16 +08:00
|
|
|
// SwitchToNewBasicBlock - Start execution in a new basic block and run any
|
|
|
|
// PHI nodes in the top of the block. This is used for intraprocedural
|
|
|
|
// control flow.
|
2005-04-22 06:43:08 +08:00
|
|
|
//
|
2003-05-11 04:21:16 +08:00
|
|
|
void SwitchToNewBasicBlock(BasicBlock *Dest, ExecutionContext &SF);
|
|
|
|
|
2003-08-14 02:17:54 +08:00
|
|
|
void *getPointerToFunction(Function *F) { return (void*)F; }
|
2009-10-29 13:26:09 +08:00
|
|
|
void *getPointerToBasicBlock(BasicBlock *BB) { return (void*)BB; }
|
2002-12-24 07:59:41 +08:00
|
|
|
|
2009-06-27 00:46:15 +08:00
|
|
|
void initializeExecutionEngine() { }
|
2003-05-09 00:18:31 +08:00
|
|
|
void initializeExternalFunctions();
|
2003-12-11 08:23:28 +08:00
|
|
|
GenericValue getConstantExprValue(ConstantExpr *CE, ExecutionContext &SF);
|
2003-09-06 02:55:03 +08:00
|
|
|
GenericValue getOperandValue(Value *V, ExecutionContext &SF);
|
2011-07-18 12:54:35 +08:00
|
|
|
GenericValue executeTruncInst(Value *SrcVal, Type *DstTy,
|
For PR1064:
Implement the arbitrary bit-width integer feature. The feature allows
integers of any bitwidth (up to 64) to be defined instead of just 1, 8,
16, 32, and 64 bit integers.
This change does several things:
1. Introduces a new Derived Type, IntegerType, to represent the number of
bits in an integer. The Type classes SubclassData field is used to
store the number of bits. This allows 2^23 bits in an integer type.
2. Removes the five integer Type::TypeID values for the 1, 8, 16, 32 and
64-bit integers. These are replaced with just IntegerType which is not
a primitive any more.
3. Adjust the rest of LLVM to account for this change.
Note that while this incremental change lays the foundation for arbitrary
bit-width integers, LLVM has not yet been converted to actually deal with
them in any significant way. Most optimization passes, for example, will
still only deal with the byte-width integer types. Future increments
will rectify this situation.
llvm-svn: 33113
2007-01-12 15:05:14 +08:00
|
|
|
ExecutionContext &SF);
|
2011-07-18 12:54:35 +08:00
|
|
|
GenericValue executeSExtInst(Value *SrcVal, Type *DstTy,
|
For PR1064:
Implement the arbitrary bit-width integer feature. The feature allows
integers of any bitwidth (up to 64) to be defined instead of just 1, 8,
16, 32, and 64 bit integers.
This change does several things:
1. Introduces a new Derived Type, IntegerType, to represent the number of
bits in an integer. The Type classes SubclassData field is used to
store the number of bits. This allows 2^23 bits in an integer type.
2. Removes the five integer Type::TypeID values for the 1, 8, 16, 32 and
64-bit integers. These are replaced with just IntegerType which is not
a primitive any more.
3. Adjust the rest of LLVM to account for this change.
Note that while this incremental change lays the foundation for arbitrary
bit-width integers, LLVM has not yet been converted to actually deal with
them in any significant way. Most optimization passes, for example, will
still only deal with the byte-width integer types. Future increments
will rectify this situation.
llvm-svn: 33113
2007-01-12 15:05:14 +08:00
|
|
|
ExecutionContext &SF);
|
2011-07-18 12:54:35 +08:00
|
|
|
GenericValue executeZExtInst(Value *SrcVal, Type *DstTy,
|
For PR1064:
Implement the arbitrary bit-width integer feature. The feature allows
integers of any bitwidth (up to 64) to be defined instead of just 1, 8,
16, 32, and 64 bit integers.
This change does several things:
1. Introduces a new Derived Type, IntegerType, to represent the number of
bits in an integer. The Type classes SubclassData field is used to
store the number of bits. This allows 2^23 bits in an integer type.
2. Removes the five integer Type::TypeID values for the 1, 8, 16, 32 and
64-bit integers. These are replaced with just IntegerType which is not
a primitive any more.
3. Adjust the rest of LLVM to account for this change.
Note that while this incremental change lays the foundation for arbitrary
bit-width integers, LLVM has not yet been converted to actually deal with
them in any significant way. Most optimization passes, for example, will
still only deal with the byte-width integer types. Future increments
will rectify this situation.
llvm-svn: 33113
2007-01-12 15:05:14 +08:00
|
|
|
ExecutionContext &SF);
|
2011-07-18 12:54:35 +08:00
|
|
|
GenericValue executeFPTruncInst(Value *SrcVal, Type *DstTy,
|
For PR1064:
Implement the arbitrary bit-width integer feature. The feature allows
integers of any bitwidth (up to 64) to be defined instead of just 1, 8,
16, 32, and 64 bit integers.
This change does several things:
1. Introduces a new Derived Type, IntegerType, to represent the number of
bits in an integer. The Type classes SubclassData field is used to
store the number of bits. This allows 2^23 bits in an integer type.
2. Removes the five integer Type::TypeID values for the 1, 8, 16, 32 and
64-bit integers. These are replaced with just IntegerType which is not
a primitive any more.
3. Adjust the rest of LLVM to account for this change.
Note that while this incremental change lays the foundation for arbitrary
bit-width integers, LLVM has not yet been converted to actually deal with
them in any significant way. Most optimization passes, for example, will
still only deal with the byte-width integer types. Future increments
will rectify this situation.
llvm-svn: 33113
2007-01-12 15:05:14 +08:00
|
|
|
ExecutionContext &SF);
|
2011-07-18 12:54:35 +08:00
|
|
|
GenericValue executeFPExtInst(Value *SrcVal, Type *DstTy,
|
For PR1064:
Implement the arbitrary bit-width integer feature. The feature allows
integers of any bitwidth (up to 64) to be defined instead of just 1, 8,
16, 32, and 64 bit integers.
This change does several things:
1. Introduces a new Derived Type, IntegerType, to represent the number of
bits in an integer. The Type classes SubclassData field is used to
store the number of bits. This allows 2^23 bits in an integer type.
2. Removes the five integer Type::TypeID values for the 1, 8, 16, 32 and
64-bit integers. These are replaced with just IntegerType which is not
a primitive any more.
3. Adjust the rest of LLVM to account for this change.
Note that while this incremental change lays the foundation for arbitrary
bit-width integers, LLVM has not yet been converted to actually deal with
them in any significant way. Most optimization passes, for example, will
still only deal with the byte-width integer types. Future increments
will rectify this situation.
llvm-svn: 33113
2007-01-12 15:05:14 +08:00
|
|
|
ExecutionContext &SF);
|
2011-07-18 12:54:35 +08:00
|
|
|
GenericValue executeFPToUIInst(Value *SrcVal, Type *DstTy,
|
For PR1064:
Implement the arbitrary bit-width integer feature. The feature allows
integers of any bitwidth (up to 64) to be defined instead of just 1, 8,
16, 32, and 64 bit integers.
This change does several things:
1. Introduces a new Derived Type, IntegerType, to represent the number of
bits in an integer. The Type classes SubclassData field is used to
store the number of bits. This allows 2^23 bits in an integer type.
2. Removes the five integer Type::TypeID values for the 1, 8, 16, 32 and
64-bit integers. These are replaced with just IntegerType which is not
a primitive any more.
3. Adjust the rest of LLVM to account for this change.
Note that while this incremental change lays the foundation for arbitrary
bit-width integers, LLVM has not yet been converted to actually deal with
them in any significant way. Most optimization passes, for example, will
still only deal with the byte-width integer types. Future increments
will rectify this situation.
llvm-svn: 33113
2007-01-12 15:05:14 +08:00
|
|
|
ExecutionContext &SF);
|
2011-07-18 12:54:35 +08:00
|
|
|
GenericValue executeFPToSIInst(Value *SrcVal, Type *DstTy,
|
For PR1064:
Implement the arbitrary bit-width integer feature. The feature allows
integers of any bitwidth (up to 64) to be defined instead of just 1, 8,
16, 32, and 64 bit integers.
This change does several things:
1. Introduces a new Derived Type, IntegerType, to represent the number of
bits in an integer. The Type classes SubclassData field is used to
store the number of bits. This allows 2^23 bits in an integer type.
2. Removes the five integer Type::TypeID values for the 1, 8, 16, 32 and
64-bit integers. These are replaced with just IntegerType which is not
a primitive any more.
3. Adjust the rest of LLVM to account for this change.
Note that while this incremental change lays the foundation for arbitrary
bit-width integers, LLVM has not yet been converted to actually deal with
them in any significant way. Most optimization passes, for example, will
still only deal with the byte-width integer types. Future increments
will rectify this situation.
llvm-svn: 33113
2007-01-12 15:05:14 +08:00
|
|
|
ExecutionContext &SF);
|
2011-07-18 12:54:35 +08:00
|
|
|
GenericValue executeUIToFPInst(Value *SrcVal, Type *DstTy,
|
For PR1064:
Implement the arbitrary bit-width integer feature. The feature allows
integers of any bitwidth (up to 64) to be defined instead of just 1, 8,
16, 32, and 64 bit integers.
This change does several things:
1. Introduces a new Derived Type, IntegerType, to represent the number of
bits in an integer. The Type classes SubclassData field is used to
store the number of bits. This allows 2^23 bits in an integer type.
2. Removes the five integer Type::TypeID values for the 1, 8, 16, 32 and
64-bit integers. These are replaced with just IntegerType which is not
a primitive any more.
3. Adjust the rest of LLVM to account for this change.
Note that while this incremental change lays the foundation for arbitrary
bit-width integers, LLVM has not yet been converted to actually deal with
them in any significant way. Most optimization passes, for example, will
still only deal with the byte-width integer types. Future increments
will rectify this situation.
llvm-svn: 33113
2007-01-12 15:05:14 +08:00
|
|
|
ExecutionContext &SF);
|
2011-07-18 12:54:35 +08:00
|
|
|
GenericValue executeSIToFPInst(Value *SrcVal, Type *DstTy,
|
For PR1064:
Implement the arbitrary bit-width integer feature. The feature allows
integers of any bitwidth (up to 64) to be defined instead of just 1, 8,
16, 32, and 64 bit integers.
This change does several things:
1. Introduces a new Derived Type, IntegerType, to represent the number of
bits in an integer. The Type classes SubclassData field is used to
store the number of bits. This allows 2^23 bits in an integer type.
2. Removes the five integer Type::TypeID values for the 1, 8, 16, 32 and
64-bit integers. These are replaced with just IntegerType which is not
a primitive any more.
3. Adjust the rest of LLVM to account for this change.
Note that while this incremental change lays the foundation for arbitrary
bit-width integers, LLVM has not yet been converted to actually deal with
them in any significant way. Most optimization passes, for example, will
still only deal with the byte-width integer types. Future increments
will rectify this situation.
llvm-svn: 33113
2007-01-12 15:05:14 +08:00
|
|
|
ExecutionContext &SF);
|
2011-07-18 12:54:35 +08:00
|
|
|
GenericValue executePtrToIntInst(Value *SrcVal, Type *DstTy,
|
For PR1064:
Implement the arbitrary bit-width integer feature. The feature allows
integers of any bitwidth (up to 64) to be defined instead of just 1, 8,
16, 32, and 64 bit integers.
This change does several things:
1. Introduces a new Derived Type, IntegerType, to represent the number of
bits in an integer. The Type classes SubclassData field is used to
store the number of bits. This allows 2^23 bits in an integer type.
2. Removes the five integer Type::TypeID values for the 1, 8, 16, 32 and
64-bit integers. These are replaced with just IntegerType which is not
a primitive any more.
3. Adjust the rest of LLVM to account for this change.
Note that while this incremental change lays the foundation for arbitrary
bit-width integers, LLVM has not yet been converted to actually deal with
them in any significant way. Most optimization passes, for example, will
still only deal with the byte-width integer types. Future increments
will rectify this situation.
llvm-svn: 33113
2007-01-12 15:05:14 +08:00
|
|
|
ExecutionContext &SF);
|
2011-07-18 12:54:35 +08:00
|
|
|
GenericValue executeIntToPtrInst(Value *SrcVal, Type *DstTy,
|
For PR1064:
Implement the arbitrary bit-width integer feature. The feature allows
integers of any bitwidth (up to 64) to be defined instead of just 1, 8,
16, 32, and 64 bit integers.
This change does several things:
1. Introduces a new Derived Type, IntegerType, to represent the number of
bits in an integer. The Type classes SubclassData field is used to
store the number of bits. This allows 2^23 bits in an integer type.
2. Removes the five integer Type::TypeID values for the 1, 8, 16, 32 and
64-bit integers. These are replaced with just IntegerType which is not
a primitive any more.
3. Adjust the rest of LLVM to account for this change.
Note that while this incremental change lays the foundation for arbitrary
bit-width integers, LLVM has not yet been converted to actually deal with
them in any significant way. Most optimization passes, for example, will
still only deal with the byte-width integer types. Future increments
will rectify this situation.
llvm-svn: 33113
2007-01-12 15:05:14 +08:00
|
|
|
ExecutionContext &SF);
|
2011-07-18 12:54:35 +08:00
|
|
|
GenericValue executeBitCastInst(Value *SrcVal, Type *DstTy,
|
For PR1064:
Implement the arbitrary bit-width integer feature. The feature allows
integers of any bitwidth (up to 64) to be defined instead of just 1, 8,
16, 32, and 64 bit integers.
This change does several things:
1. Introduces a new Derived Type, IntegerType, to represent the number of
bits in an integer. The Type classes SubclassData field is used to
store the number of bits. This allows 2^23 bits in an integer type.
2. Removes the five integer Type::TypeID values for the 1, 8, 16, 32 and
64-bit integers. These are replaced with just IntegerType which is not
a primitive any more.
3. Adjust the rest of LLVM to account for this change.
Note that while this incremental change lays the foundation for arbitrary
bit-width integers, LLVM has not yet been converted to actually deal with
them in any significant way. Most optimization passes, for example, will
still only deal with the byte-width integer types. Future increments
will rectify this situation.
llvm-svn: 33113
2007-01-12 15:05:14 +08:00
|
|
|
ExecutionContext &SF);
|
2006-11-27 09:05:10 +08:00
|
|
|
GenericValue executeCastOperation(Instruction::CastOps opcode, Value *SrcVal,
|
2011-07-18 12:54:35 +08:00
|
|
|
Type *Ty, ExecutionContext &SF);
|
|
|
|
void popStackAndReturnValueToCaller(Type *RetTy, GenericValue Result);
|
2007-01-18 10:12:10 +08:00
|
|
|
|
2001-08-24 01:05:04 +08:00
|
|
|
};
|
|
|
|
|
2003-11-12 06:41:34 +08:00
|
|
|
} // End llvm namespace
|
|
|
|
|
2001-08-24 01:05:04 +08:00
|
|
|
#endif
|