diff options
author | Reid Spencer <rspencer@reidspencer.com> | 2007-03-03 06:19:55 +0000 |
---|---|---|
committer | Reid Spencer <rspencer@reidspencer.com> | 2007-03-03 06:19:55 +0000 |
commit | 72aafa1d49c2380ca6a868ec9ef91e7475f2ad40 (patch) | |
tree | 8f8f767fd990df797fd3940ce149b1bc8a70682f /llvm/lib/ExecutionEngine | |
parent | 323cf8f6029df2cfdfa50d75607d276bf9cef6a6 (diff) | |
download | bcm5719-llvm-72aafa1d49c2380ca6a868ec9ef91e7475f2ad40.tar.gz bcm5719-llvm-72aafa1d49c2380ca6a868ec9ef91e7475f2ad40.zip |
1. Have the ExecutionContext keep track of the APInt's allocated and
ensure they are cleaned up when the stack frame exits.
2. Move a function to the Execution.cpp file where it belongs.
llvm-svn: 34876
Diffstat (limited to 'llvm/lib/ExecutionEngine')
-rw-r--r-- | llvm/lib/ExecutionEngine/Interpreter/Interpreter.h | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/llvm/lib/ExecutionEngine/Interpreter/Interpreter.h b/llvm/lib/ExecutionEngine/Interpreter/Interpreter.h index aef4cb23b13..abc3e08336a 100644 --- a/llvm/lib/ExecutionEngine/Interpreter/Interpreter.h +++ b/llvm/lib/ExecutionEngine/Interpreter/Interpreter.h @@ -17,6 +17,7 @@ #include "llvm/Function.h" #include "llvm/ExecutionEngine/ExecutionEngine.h" #include "llvm/ExecutionEngine/GenericValue.h" +#include "llvm/ADT/APInt.h" #include "llvm/Support/InstVisitor.h" #include "llvm/Support/CallSite.h" #include "llvm/Target/TargetData.h" @@ -75,6 +76,18 @@ struct ExecutionContext { CallSite Caller; // Holds the call that called subframes. // NULL if main func or debugger invoked fn AllocaHolderHandle Allocas; // Track memory allocated by alloca + std::vector<APInt*> APInts; // Track memory allocated for APInts + APInt* getAPInt(uint32_t BitWidth) { + APInt* Result = new APInt(BitWidth, 0); + APInts.push_back(Result); + return Result; + } + ~ExecutionContext() { + while (!APInts.empty()) { + delete APInts.back(); + APInts.pop_back(); + } + } }; // Interpreter - This class represents the entirety of the interpreter. @@ -235,17 +248,6 @@ private: // Helper functions }; -inline void maskToBitWidth(GenericValue& GV, unsigned BitWidth) { - uint64_t BitMask = ~(uint64_t)(0ull) >> (64-BitWidth); - if (BitWidth <= 8) - GV.Int8Val &= BitMask; - else if (BitWidth <= 16) - GV.Int16Val &= BitMask; - else if (BitWidth <= 32) - GV.Int32Val &= BitMask; - else - GV.Int64Val &= BitMask; -} } // End llvm namespace #endif |