diff options
| author | Chris Lattner <sabre@nondot.org> | 2001-09-07 18:00:19 +0000 | 
|---|---|---|
| committer | Chris Lattner <sabre@nondot.org> | 2001-09-07 18:00:19 +0000 | 
| commit | 1cedcf1c3142b172f149e6db0dba4b1c5b43da8f (patch) | |
| tree | 0aaaa1da675c32ca9db1e6b2a4519cc6070de6b9 /llvm/lib | |
| parent | 2833dd3fed0cb3ca48a7fbd77408a84418d2552e (diff) | |
| download | bcm5719-llvm-1cedcf1c3142b172f149e6db0dba4b1c5b43da8f.tar.gz bcm5719-llvm-1cedcf1c3142b172f149e6db0dba4b1c5b43da8f.zip | |
Moved functionality into the other constant pool stuff
llvm-svn: 477
Diffstat (limited to 'llvm/lib')
| -rw-r--r-- | llvm/lib/VMCore/ConstPoolVals.cpp | 108 | 
1 files changed, 0 insertions, 108 deletions
| diff --git a/llvm/lib/VMCore/ConstPoolVals.cpp b/llvm/lib/VMCore/ConstPoolVals.cpp deleted file mode 100644 index f778a3716c7..00000000000 --- a/llvm/lib/VMCore/ConstPoolVals.cpp +++ /dev/null @@ -1,108 +0,0 @@ -//===-- llvm/ConstPoolVals.cpp - Implement Constant Value nodes -*- C++ -*--=// -// -// This file implements the ConstPoolVal class and associated functions. -// -//===---------------------------------------------------------------------===// - -#include "llvm/Type.h" -#include "llvm/Value.h" -#include "llvm/ConstPoolVals.h" - - -//===-------------------------------------------------------------------------- -// External functions -// - -// Convenience functions to get the value of an integer constant, for an -// appropriate integer or non-integer type that can be held in an integer. -// The type of the argument must be the following: -//   GetSignedIntConstantValue:   signed integer or bool -//   GetUnsignedIntConstantValue: unsigned integer, bool, or pointer -//   GetConstantValueAsSignedInt: any of the above, but the value -//				  must fit into a int64_t. -//  -// isValidConstant is set to true if a valid constant was found. -//  - -int64_t -GetSignedIntConstantValue(const Value* val, bool& isValidConstant) -{ -  int64_t intValue = 0; -  isValidConstant = false; -   -  if (val->getValueType() == Value::ConstantVal) -    { -      switch(val->getType()->getPrimitiveID()) -	{ -	case Type::BoolTyID: -	  intValue = ((ConstPoolBool*) val)->getValue()? 1 : 0; -	  isValidConstant = true; -	  break; -	case Type::SByteTyID: -	case Type::ShortTyID: -	case Type::IntTyID: -	case Type::LongTyID: -	  intValue = ((ConstPoolSInt*) val)->getValue(); -	  isValidConstant = true; -	  break; -	default: -	  break; -	} -    } -   -  return intValue; -} - -uint64_t -GetUnsignedIntConstantValue(const Value* val, bool& isValidConstant) -{ -  uint64_t intValue = 0; -  isValidConstant = false; -   -  if (val->getValueType() == Value::ConstantVal) -    { -      switch(val->getType()->getPrimitiveID()) -	{ -	case Type::BoolTyID: -	  intValue = ((ConstPoolBool*) val)->getValue()? 1 : 0; -	  isValidConstant = true; -	  break; -	case Type::UByteTyID: -	case Type::UShortTyID: -	case Type::UIntTyID: -	case Type::ULongTyID: -	case Type::PointerTyID: -	  intValue = ((ConstPoolUInt*) val)->getValue(); -	  isValidConstant = true; -	  break; -	default: -	  break; -	} -    } -   -  return intValue; -} - - -int64_t -GetConstantValueAsSignedInt(const Value* val, bool& isValidConstant) -{ -  int64_t intValue = 0; -   -  if (val->getType()->isSigned()) -    { -      intValue = GetSignedIntConstantValue(val, isValidConstant); -    } -  else				// non-numeric types will fall here -    { -      uint64_t uintValue = GetUnsignedIntConstantValue(val, isValidConstant); -      if (isValidConstant && uintValue < INT64_MAX)	// then safe to cast to signed -	intValue = (int64_t) uintValue; -      else  -	isValidConstant = false; -    } -   -  return intValue; -} - -//===-------------------------------------------------------------------------- | 

