mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-17 04:24:00 +00:00
Added FoldingSet style 'profiling' support for APInt.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46188 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -24,6 +24,7 @@
|
|||||||
namespace llvm {
|
namespace llvm {
|
||||||
class Serializer;
|
class Serializer;
|
||||||
class Deserializer;
|
class Deserializer;
|
||||||
|
class FoldingSetNodeID;
|
||||||
|
|
||||||
/* An unsigned host type used as a single part of a multi-part
|
/* An unsigned host type used as a single part of a multi-part
|
||||||
bignum. */
|
bignum. */
|
||||||
@ -210,6 +211,10 @@ public:
|
|||||||
/// for object deserialization (pair this with the static method Read).
|
/// for object deserialization (pair this with the static method Read).
|
||||||
explicit APInt() : BitWidth(1) {}
|
explicit APInt() : BitWidth(1) {}
|
||||||
|
|
||||||
|
/// Profile - Used to insert APInt objects, or objects that contain APInt
|
||||||
|
/// objects, into FoldingSets.
|
||||||
|
void Profile(FoldingSetNodeID& ID) const;
|
||||||
|
|
||||||
/// @brief Used by the Bitcode serializer to emit APInts to Bitcode.
|
/// @brief Used by the Bitcode serializer to emit APInts to Bitcode.
|
||||||
void Emit(Serializer& S) const;
|
void Emit(Serializer& S) const;
|
||||||
|
|
||||||
|
@ -14,6 +14,7 @@
|
|||||||
|
|
||||||
#define DEBUG_TYPE "apint"
|
#define DEBUG_TYPE "apint"
|
||||||
#include "llvm/ADT/APInt.h"
|
#include "llvm/ADT/APInt.h"
|
||||||
|
#include "llvm/ADT/FoldingSet.h"
|
||||||
#include "llvm/Support/Debug.h"
|
#include "llvm/Support/Debug.h"
|
||||||
#include "llvm/Support/MathExtras.h"
|
#include "llvm/Support/MathExtras.h"
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
@ -24,7 +25,6 @@
|
|||||||
|
|
||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
|
|
||||||
|
|
||||||
/// This enumeration just provides for internal constants used in this
|
/// This enumeration just provides for internal constants used in this
|
||||||
/// translation unit.
|
/// translation unit.
|
||||||
enum {
|
enum {
|
||||||
@ -165,6 +165,18 @@ APInt& APInt::operator=(uint64_t RHS) {
|
|||||||
return clearUnusedBits();
|
return clearUnusedBits();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Profile - This method 'profiles' an APInt for use with FoldingSet.
|
||||||
|
void APInt::Profile(FoldingSetNodeID& ID) const {
|
||||||
|
if (isSingleWord()) {
|
||||||
|
ID.AddInteger(VAL);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t NumWords = getNumWords();
|
||||||
|
for (unsigned i = 0; i < NumWords; ++i)
|
||||||
|
ID.AddInteger(pVal[i]);
|
||||||
|
}
|
||||||
|
|
||||||
/// add_1 - This function adds a single "digit" integer, y, to the multiple
|
/// add_1 - This function adds a single "digit" integer, y, to the multiple
|
||||||
/// "digit" integer array, x[]. x[] is modified to reflect the addition and
|
/// "digit" integer array, x[]. x[] is modified to reflect the addition and
|
||||||
/// 1 is returned if there is a carry out, otherwise 0 is returned.
|
/// 1 is returned if there is a carry out, otherwise 0 is returned.
|
||||||
|
Reference in New Issue
Block a user