-//===-- ConstantVals.cpp - Implement Constant nodes --------------*- C++ -*--=//
+//===-- Constants.cpp - Implement Constant nodes -----------------*- C++ -*--=//
//
// This file implements the Constant* classes...
//
//===----------------------------------------------------------------------===//
#define __STDC_LIMIT_MACROS // Get defs for INT64_MAX and friends...
-#include "llvm/ConstantVals.h"
+#include "llvm/Constants.h"
#include "llvm/DerivedTypes.h"
#include "llvm/SymbolTable.h"
#include "llvm/GlobalValue.h"
}
// Static constructor to create a '0' constant of arbitrary type...
-Constant *Constant::getNullConstant(const Type *Ty) {
+Constant *Constant::getNullValue(const Type *Ty) {
switch (Ty->getPrimitiveID()) {
case Type::BoolTyID: return ConstantBool::get(false);
case Type::SByteTyID:
}
};
-//===----------------------------------------------------------------------===//
-// Hash Function Implementations
-#if 0
-unsigned ConstantSInt::hash(const Type *Ty, int64_t V) {
- return unsigned(Ty->getPrimitiveID() ^ V);
-}
-
-unsigned ConstantUInt::hash(const Type *Ty, uint64_t V) {
- return unsigned(Ty->getPrimitiveID() ^ V);
-}
-
-unsigned ConstantFP::hash(const Type *Ty, double V) {
- return Ty->getPrimitiveID() ^ unsigned(V);
-}
-
-unsigned ConstantArray::hash(const ArrayType *Ty,
- const std::vector<Constant*> &V) {
- unsigned Result = (Ty->getUniqueID() << 5) ^ (Ty->getUniqueID() * 7);
- for (unsigned i = 0; i < V.size(); ++i)
- Result ^= V[i]->getHash() << (i & 7);
- return Result;
-}
-
-unsigned ConstantStruct::hash(const StructType *Ty,
- const std::vector<Constant*> &V) {
- unsigned Result = (Ty->getUniqueID() << 5) ^ (Ty->getUniqueID() * 7);
- for (unsigned i = 0; i < V.size(); ++i)
- Result ^= V[i]->getHash() << (i & 7);
- return Result;
-}
-#endif
-
//===----------------------------------------------------------------------===//
// Factory Function Implementation