1. Make StoreValueToMemory a little more efficient by not requiring caller
authorReid Spencer <rspencer@reidspencer.com>
Tue, 6 Mar 2007 05:03:16 +0000 (05:03 +0000)
committerReid Spencer <rspencer@reidspencer.com>
Tue, 6 Mar 2007 05:03:16 +0000 (05:03 +0000)
   to make a copy of the GenericValue.
2. Fix a copy & paste bug in StoreValueToMemory where 64-bit values were
   truncated to 32

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34958 91177308-0d34-0410-b5e6-96231b3b80d8

lib/ExecutionEngine/ExecutionEngine.cpp

index 7a0bc23f32dc9200481d483e0c5360a45053a29b..981ef107a5ec2c307dd86b8b49a8d835c770c141 100644 (file)
@@ -410,7 +410,7 @@ GenericValue ExecutionEngine::getConstantValue(const Constant *C) {
 /// It is not a pointer to a GenericValue containing the address at which to
 /// store Val.
 ///
-void ExecutionEngine::StoreValueToMemory(GenericValue Val, GenericValue *Ptr,
+void ExecutionEngine::StoreValueToMemory(const GenericValue &Val, GenericValue *Ptr,
                                          const Type *Ty) {
   switch (Ty->getTypeID()) {
   case Type::IntegerTyID: {
@@ -423,7 +423,7 @@ void ExecutionEngine::StoreValueToMemory(GenericValue Val, GenericValue *Ptr,
     } else if (BitWidth <= 32) {
       *((uint32_t*)Ptr) = uint32_t(Val.IntVal.getZExtValue());
     } else if (BitWidth <= 64) {
-      *((uint64_t*)Ptr) = uint32_t(Val.IntVal.getZExtValue());
+      *((uint64_t*)Ptr) = uint64_t(Val.IntVal.getZExtValue());
     } else {
       uint64_t *Dest = (uint64_t*)Ptr;
       const uint64_t *Src = Val.IntVal.getRawData();