projects
/
oota-llvm.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Adding a collector name attribute to Function in the IR. These
[oota-llvm.git]
/
include
/
llvm
/
CodeGen
/
MachineConstantPool.h
diff --git
a/include/llvm/CodeGen/MachineConstantPool.h
b/include/llvm/CodeGen/MachineConstantPool.h
index b55b283a604bf5709a1f0bbbd860e327c310a5f3..f05a540d38e5b992a1ea9a009929c7a62098cdf7 100644
(file)
--- a/
include/llvm/CodeGen/MachineConstantPool.h
+++ b/
include/llvm/CodeGen/MachineConstantPool.h
@@
-15,7
+15,9
@@
#ifndef LLVM_CODEGEN_MACHINECONSTANTPOOL_H
#define LLVM_CODEGEN_MACHINECONSTANTPOOL_H
#ifndef LLVM_CODEGEN_MACHINECONSTANTPOOL_H
#define LLVM_CODEGEN_MACHINECONSTANTPOOL_H
-#include "llvm/CodeGen/SelectionDAGCSEMap.h"
+#include "llvm/ADT/FoldingSet.h"
+#include "llvm/CodeGen/SelectionDAGNodes.h"
+#include "llvm/Support/Streams.h"
#include <vector>
#include <iosfwd>
#include <vector>
#include <iosfwd>
@@
-33,8
+35,8
@@
class MachineConstantPoolValue {
const Type *Ty;
public:
const Type *Ty;
public:
- MachineConstantPoolValue(const Type *ty) : Ty(ty) {}
- virtual ~MachineConstantPoolValue() {}
;
+
explicit
MachineConstantPoolValue(const Type *ty) : Ty(ty) {}
+ virtual ~MachineConstantPoolValue() {}
/// getType - get type of this MachineConstantPoolValue.
///
/// getType - get type of this MachineConstantPoolValue.
///
@@
-43,11
+45,12
@@
public:
virtual int getExistingMachineCPValue(MachineConstantPool *CP,
unsigned Alignment) = 0;
virtual int getExistingMachineCPValue(MachineConstantPool *CP,
unsigned Alignment) = 0;
- virtual void AddSelectionDAGCSEId(
SelectionDAGCSEMap::NodeID *Id
) = 0;
+ virtual void AddSelectionDAGCSEId(
FoldingSetNodeID &ID
) = 0;
/// print - Implement operator<<...
///
virtual void print(std::ostream &O) const = 0;
/// print - Implement operator<<...
///
virtual void print(std::ostream &O) const = 0;
+ void print(std::ostream *O) const { if (O) print(*O); }
};
inline std::ostream &operator<<(std::ostream &OS,
};
inline std::ostream &operator<<(std::ostream &OS,
@@
-60,15
+63,16
@@
inline std::ostream &operator<<(std::ostream &OS,
/// It contains a pointer to the value and an offset from the start of
/// the constant pool.
/// @brief An entry in a MachineConstantPool
/// It contains a pointer to the value and an offset from the start of
/// the constant pool.
/// @brief An entry in a MachineConstantPool
-struct MachineConstantPoolEntry {
+class MachineConstantPoolEntry {
+public:
/// The constant itself.
union {
Constant *ConstVal;
MachineConstantPoolValue *MachineCPVal;
} Val;
/// The constant itself.
union {
Constant *ConstVal;
MachineConstantPoolValue *MachineCPVal;
} Val;
- /// The offset of the constant from the start of the pool.
It's really
- ///
31-bit only. The top bit is set
when Val is a MachineConstantPoolValue.
+ /// The offset of the constant from the start of the pool.
The top bit is set
+ /// when Val is a MachineConstantPoolValue.
unsigned Offset;
MachineConstantPoolEntry(Constant *V, unsigned O)
unsigned Offset;
MachineConstantPoolEntry(Constant *V, unsigned O)
@@
-86,6
+90,12
@@
struct MachineConstantPoolEntry {
bool isMachineConstantPoolEntry() const {
return (int)Offset < 0;
}
bool isMachineConstantPoolEntry() const {
return (int)Offset < 0;
}
+
+ int getOffset() const {
+ return Offset & ~(1 << (sizeof(unsigned)*8-1));
+ }
+
+ const Type *getType() const;
};
/// The MachineConstantPool class keeps track of constants referenced by a
};
/// The MachineConstantPool class keeps track of constants referenced by a
@@
-104,7
+114,8
@@
class MachineConstantPool {
std::vector<MachineConstantPoolEntry> Constants; ///< The pool of constants.
public:
/// @brief The only constructor.
std::vector<MachineConstantPoolEntry> Constants; ///< The pool of constants.
public:
/// @brief The only constructor.
- MachineConstantPool(const TargetData *td) : TD(td), PoolAlignment(1) {}
+ explicit MachineConstantPool(const TargetData *td)
+ : TD(td), PoolAlignment(1) {}
~MachineConstantPool();
/// getConstantPoolAlignment - Return the log2 of the alignment required by
~MachineConstantPool();
/// getConstantPoolAlignment - Return the log2 of the alignment required by
@@
-127,6
+138,7
@@
public:
/// constant pool objects. Implemented in MachineFunction.cpp
///
void print(std::ostream &OS) const;
/// constant pool objects. Implemented in MachineFunction.cpp
///
void print(std::ostream &OS) const;
+ void print(std::ostream *OS) const { if (OS) print(*OS); }
/// dump - Call print(std::cerr) to be called from the debugger.
///
/// dump - Call print(std::cerr) to be called from the debugger.
///