[llvm-commits] CVS: llvm/include/llvm/CodeGen/MachineConstantPool.h SelectionDAG.h SelectionDAGNodes.h
Evan Cheng
evan.cheng at apple.com
Tue Jan 31 14:21:49 PST 2006
Changes in directory llvm/include/llvm/CodeGen:
MachineConstantPool.h updated: 1.9 -> 1.10
SelectionDAG.h updated: 1.94 -> 1.95
SelectionDAGNodes.h updated: 1.98 -> 1.99
---
Log message:
Allow the specification of explicit alignments for constant pool entries.
---
Diffs of the changes: (+24 -11)
MachineConstantPool.h | 17 +++++++++++------
SelectionDAG.h | 10 ++++++----
SelectionDAGNodes.h | 8 +++++++-
3 files changed, 24 insertions(+), 11 deletions(-)
Index: llvm/include/llvm/CodeGen/MachineConstantPool.h
diff -u llvm/include/llvm/CodeGen/MachineConstantPool.h:1.9 llvm/include/llvm/CodeGen/MachineConstantPool.h:1.10
--- llvm/include/llvm/CodeGen/MachineConstantPool.h:1.9 Wed Dec 28 00:47:33 2005
+++ llvm/include/llvm/CodeGen/MachineConstantPool.h Tue Jan 31 16:21:33 2006
@@ -30,20 +30,23 @@
class Constant;
class MachineConstantPool {
- std::vector<Constant*> Constants;
+ std::vector<std::pair<Constant*,unsigned> > Constants;
public:
/// getConstantPoolIndex - Create a new entry in the constant pool or return
- /// an existing one.
+ /// an existing one. User may specify an alignment that is greater than the
+ /// default alignment. If one is not specified, it will be 0.
///
- unsigned getConstantPoolIndex(Constant *C) {
+ unsigned getConstantPoolIndex(Constant *C, unsigned Alignment = 0) {
// Check to see if we already have this constant.
//
// FIXME, this could be made much more efficient for large constant pools.
for (unsigned i = 0, e = Constants.size(); i != e; ++i)
- if (Constants[i] == C)
+ if (Constants[i].first == C) {
+ Constants[i].second = std::max(Constants[i].second, Alignment);
return i;
- Constants.push_back(C);
+ }
+ Constants.push_back(std::make_pair(C, Alignment));
return Constants.size()-1;
}
@@ -51,7 +54,9 @@
///
bool isEmpty() const { return Constants.empty(); }
- const std::vector<Constant*> &getConstants() const { return Constants; }
+ const std::vector<std::pair<Constant*,unsigned> > &getConstants() const {
+ return Constants;
+ }
/// print - Used by the MachineFunction printer to print information about
/// stack objects. Implemented in MachineFunction.cpp
Index: llvm/include/llvm/CodeGen/SelectionDAG.h
diff -u llvm/include/llvm/CodeGen/SelectionDAG.h:1.94 llvm/include/llvm/CodeGen/SelectionDAG.h:1.95
--- llvm/include/llvm/CodeGen/SelectionDAG.h:1.94 Mon Jan 30 01:47:47 2006
+++ llvm/include/llvm/CodeGen/SelectionDAG.h Tue Jan 31 16:21:33 2006
@@ -120,8 +120,10 @@
int offset = 0);
SDOperand getFrameIndex(int FI, MVT::ValueType VT);
SDOperand getTargetFrameIndex(int FI, MVT::ValueType VT);
- SDOperand getConstantPool(Constant *C, MVT::ValueType VT);
- SDOperand getTargetConstantPool(Constant *C, MVT::ValueType VT);
+ SDOperand getConstantPool(Constant *C, MVT::ValueType VT,
+ unsigned Alignment=0);
+ SDOperand getTargetConstantPool(Constant *C, MVT::ValueType VT,
+ unsigned Alignment=0);
SDOperand getBasicBlock(MachineBasicBlock *MBB);
SDOperand getExternalSymbol(const char *Sym, MVT::ValueType VT);
SDOperand getTargetExternalSymbol(const char *Sym, MVT::ValueType VT);
@@ -606,8 +608,8 @@
std::map<std::pair<uint64_t, MVT::ValueType>, SDNode*> ConstantFPs;
std::map<std::pair<uint64_t, MVT::ValueType>, SDNode*> TargetConstantFPs;
std::map<int, SDNode*> FrameIndices, TargetFrameIndices;
- std::map<Constant *, SDNode*> ConstantPoolIndices;
- std::map<Constant *, SDNode*> TargetConstantPoolIndices;
+ std::map<std::pair<Constant *, unsigned>, SDNode*> ConstantPoolIndices;
+ std::map<std::pair<Constant *, unsigned>, SDNode*> TargetConstantPoolIndices;
std::map<MachineBasicBlock *, SDNode*> BBNodes;
std::vector<SDNode*> ValueTypeNodes;
std::map<std::string, SDNode*> ExternalSymbols;
Index: llvm/include/llvm/CodeGen/SelectionDAGNodes.h
diff -u llvm/include/llvm/CodeGen/SelectionDAGNodes.h:1.98 llvm/include/llvm/CodeGen/SelectionDAGNodes.h:1.99
--- llvm/include/llvm/CodeGen/SelectionDAGNodes.h:1.98 Sun Jan 29 01:57:11 2006
+++ llvm/include/llvm/CodeGen/SelectionDAGNodes.h Tue Jan 31 16:21:33 2006
@@ -1058,14 +1058,20 @@
class ConstantPoolSDNode : public SDNode {
Constant *C;
+ unsigned Alignment;
protected:
friend class SelectionDAG;
ConstantPoolSDNode(Constant *c, MVT::ValueType VT, bool isTarget)
: SDNode(isTarget ? ISD::TargetConstantPool : ISD::ConstantPool, VT),
- C(c) {}
+ C(c), Alignment(0) {}
+ ConstantPoolSDNode(Constant *c, MVT::ValueType VT, unsigned Align,
+ bool isTarget)
+ : SDNode(isTarget ? ISD::TargetConstantPool : ISD::ConstantPool, VT),
+ C(c), Alignment(Align) {}
public:
Constant *get() const { return C; }
+ unsigned getAlignment() const { return Alignment; }
static bool classof(const ConstantPoolSDNode *) { return true; }
static bool classof(const SDNode *N) {
More information about the llvm-commits
mailing list