[llvm-commits] [llvm] r46833 - in /llvm/trunk: include/llvm/ADT/FoldingSet.h lib/Support/FoldingSet.cpp
Dan Gohman
gohman at apple.com
Wed Feb 6 15:09:16 PST 2008
Author: djg
Date: Wed Feb 6 17:09:15 2008
New Revision: 46833
URL: http://llvm.org/viewvc/llvm-project?rev=46833&view=rev
Log:
Add support to FoldingSet for hashing APInt objects.
Modified:
llvm/trunk/include/llvm/ADT/FoldingSet.h
llvm/trunk/lib/Support/FoldingSet.cpp
Modified: llvm/trunk/include/llvm/ADT/FoldingSet.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/FoldingSet.h?rev=46833&r1=46832&r2=46833&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ADT/FoldingSet.h (original)
+++ llvm/trunk/include/llvm/ADT/FoldingSet.h Wed Feb 6 17:09:15 2008
@@ -22,6 +22,7 @@
namespace llvm {
class APFloat;
+ class APInt;
/// This folding set used for two purposes:
/// 1. Given information about a node we want to create, look up the unique
@@ -206,6 +207,7 @@
void AddFloat(float F);
void AddDouble(double D);
void AddAPFloat(const APFloat& apf);
+ void AddAPInt(const APInt& api);
void AddString(const std::string &String);
/// clear - Clear the accumulated profile, allowing this FoldingSetNodeID
Modified: llvm/trunk/lib/Support/FoldingSet.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/FoldingSet.cpp?rev=46833&r1=46832&r2=46833&view=diff
==============================================================================
--- llvm/trunk/lib/Support/FoldingSet.cpp (original)
+++ llvm/trunk/lib/Support/FoldingSet.cpp Wed Feb 6 17:09:15 2008
@@ -16,6 +16,7 @@
#include "llvm/ADT/FoldingSet.h"
#include "llvm/ADT/APFloat.h"
+#include "llvm/ADT/APInt.h"
#include "llvm/Support/MathExtras.h"
#include <cassert>
using namespace llvm;
@@ -59,6 +60,9 @@
}
void FoldingSetNodeID::AddAPFloat(const APFloat& apf) {
APInt api = apf.convertToAPInt();
+ AddAPInt(api);
+}
+void FoldingSetNodeID::AddAPInt(const APInt& api) {
const uint64_t *p = api.getRawData();
for (unsigned i=0; i<api.getNumWords(); i++)
AddInteger(*p++);
More information about the llvm-commits
mailing list