summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorEvan Cheng <evan.cheng@apple.com>2006-01-31 22:23:14 +0000
committerEvan Cheng <evan.cheng@apple.com>2006-01-31 22:23:14 +0000
commitb8973bd8f50d7321635e1e07b81a880a0828d185 (patch)
tree452842927ad6a1c0969372cef9b984007ac68328 /include
parent259e97cc725011a3c138563d421a4654b082a64c (diff)
downloadllvm-b8973bd8f50d7321635e1e07b81a880a0828d185.tar.gz
llvm-b8973bd8f50d7321635e1e07b81a880a0828d185.tar.bz2
llvm-b8973bd8f50d7321635e1e07b81a880a0828d185.tar.xz
Allow the specification of explicit alignments for constant pool entries.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@25855 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r--include/llvm/CodeGen/MachineConstantPool.h17
-rw-r--r--include/llvm/CodeGen/SelectionDAG.h10
-rw-r--r--include/llvm/CodeGen/SelectionDAGNodes.h8
3 files changed, 24 insertions, 11 deletions
diff --git a/include/llvm/CodeGen/MachineConstantPool.h b/include/llvm/CodeGen/MachineConstantPool.h
index c2c3399adb..1bbf88d843 100644
--- a/include/llvm/CodeGen/MachineConstantPool.h
+++ b/include/llvm/CodeGen/MachineConstantPool.h
@@ -30,20 +30,23 @@ namespace llvm {
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 @@ public:
///
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
diff --git a/include/llvm/CodeGen/SelectionDAG.h b/include/llvm/CodeGen/SelectionDAG.h
index 195e8e435b..6d75e47acf 100644
--- a/include/llvm/CodeGen/SelectionDAG.h
+++ b/include/llvm/CodeGen/SelectionDAG.h
@@ -120,8 +120,10 @@ public:
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 @@ private:
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;
diff --git a/include/llvm/CodeGen/SelectionDAGNodes.h b/include/llvm/CodeGen/SelectionDAGNodes.h
index ae2519a836..0b850e617b 100644
--- a/include/llvm/CodeGen/SelectionDAGNodes.h
+++ b/include/llvm/CodeGen/SelectionDAGNodes.h
@@ -1058,14 +1058,20 @@ public:
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) {