mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-11-23 16:19:52 +00:00
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
This commit is contained in:
@@ -30,20 +30,23 @@ namespace llvm {
|
|||||||
class Constant;
|
class Constant;
|
||||||
|
|
||||||
class MachineConstantPool {
|
class MachineConstantPool {
|
||||||
std::vector<Constant*> Constants;
|
std::vector<std::pair<Constant*,unsigned> > Constants;
|
||||||
public:
|
public:
|
||||||
|
|
||||||
/// getConstantPoolIndex - Create a new entry in the constant pool or return
|
/// 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.
|
// Check to see if we already have this constant.
|
||||||
//
|
//
|
||||||
// FIXME, this could be made much more efficient for large constant pools.
|
// FIXME, this could be made much more efficient for large constant pools.
|
||||||
for (unsigned i = 0, e = Constants.size(); i != e; ++i)
|
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;
|
return i;
|
||||||
Constants.push_back(C);
|
}
|
||||||
|
Constants.push_back(std::make_pair(C, Alignment));
|
||||||
return Constants.size()-1;
|
return Constants.size()-1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -51,7 +54,9 @@ public:
|
|||||||
///
|
///
|
||||||
bool isEmpty() const { return Constants.empty(); }
|
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
|
/// print - Used by the MachineFunction printer to print information about
|
||||||
/// stack objects. Implemented in MachineFunction.cpp
|
/// stack objects. Implemented in MachineFunction.cpp
|
||||||
|
|||||||
@@ -120,8 +120,10 @@ public:
|
|||||||
int offset = 0);
|
int offset = 0);
|
||||||
SDOperand getFrameIndex(int FI, MVT::ValueType VT);
|
SDOperand getFrameIndex(int FI, MVT::ValueType VT);
|
||||||
SDOperand getTargetFrameIndex(int FI, MVT::ValueType VT);
|
SDOperand getTargetFrameIndex(int FI, MVT::ValueType VT);
|
||||||
SDOperand getConstantPool(Constant *C, MVT::ValueType VT);
|
SDOperand getConstantPool(Constant *C, MVT::ValueType VT,
|
||||||
SDOperand getTargetConstantPool(Constant *C, MVT::ValueType VT);
|
unsigned Alignment=0);
|
||||||
|
SDOperand getTargetConstantPool(Constant *C, MVT::ValueType VT,
|
||||||
|
unsigned Alignment=0);
|
||||||
SDOperand getBasicBlock(MachineBasicBlock *MBB);
|
SDOperand getBasicBlock(MachineBasicBlock *MBB);
|
||||||
SDOperand getExternalSymbol(const char *Sym, MVT::ValueType VT);
|
SDOperand getExternalSymbol(const char *Sym, MVT::ValueType VT);
|
||||||
SDOperand getTargetExternalSymbol(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*> ConstantFPs;
|
||||||
std::map<std::pair<uint64_t, MVT::ValueType>, SDNode*> TargetConstantFPs;
|
std::map<std::pair<uint64_t, MVT::ValueType>, SDNode*> TargetConstantFPs;
|
||||||
std::map<int, SDNode*> FrameIndices, TargetFrameIndices;
|
std::map<int, SDNode*> FrameIndices, TargetFrameIndices;
|
||||||
std::map<Constant *, SDNode*> ConstantPoolIndices;
|
std::map<std::pair<Constant *, unsigned>, SDNode*> ConstantPoolIndices;
|
||||||
std::map<Constant *, SDNode*> TargetConstantPoolIndices;
|
std::map<std::pair<Constant *, unsigned>, SDNode*> TargetConstantPoolIndices;
|
||||||
std::map<MachineBasicBlock *, SDNode*> BBNodes;
|
std::map<MachineBasicBlock *, SDNode*> BBNodes;
|
||||||
std::vector<SDNode*> ValueTypeNodes;
|
std::vector<SDNode*> ValueTypeNodes;
|
||||||
std::map<std::string, SDNode*> ExternalSymbols;
|
std::map<std::string, SDNode*> ExternalSymbols;
|
||||||
|
|||||||
@@ -1058,14 +1058,20 @@ public:
|
|||||||
|
|
||||||
class ConstantPoolSDNode : public SDNode {
|
class ConstantPoolSDNode : public SDNode {
|
||||||
Constant *C;
|
Constant *C;
|
||||||
|
unsigned Alignment;
|
||||||
protected:
|
protected:
|
||||||
friend class SelectionDAG;
|
friend class SelectionDAG;
|
||||||
ConstantPoolSDNode(Constant *c, MVT::ValueType VT, bool isTarget)
|
ConstantPoolSDNode(Constant *c, MVT::ValueType VT, bool isTarget)
|
||||||
: SDNode(isTarget ? ISD::TargetConstantPool : ISD::ConstantPool, VT),
|
: 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:
|
public:
|
||||||
|
|
||||||
Constant *get() const { return C; }
|
Constant *get() const { return C; }
|
||||||
|
unsigned getAlignment() const { return Alignment; }
|
||||||
|
|
||||||
static bool classof(const ConstantPoolSDNode *) { return true; }
|
static bool classof(const ConstantPoolSDNode *) { return true; }
|
||||||
static bool classof(const SDNode *N) {
|
static bool classof(const SDNode *N) {
|
||||||
|
|||||||
@@ -103,7 +103,7 @@ void AsmPrinter::SetupMachineFunction(MachineFunction &MF) {
|
|||||||
/// the code generator.
|
/// the code generator.
|
||||||
///
|
///
|
||||||
void AsmPrinter::EmitConstantPool(MachineConstantPool *MCP) {
|
void AsmPrinter::EmitConstantPool(MachineConstantPool *MCP) {
|
||||||
const std::vector<Constant*> &CP = MCP->getConstants();
|
const std::vector<std::pair<Constant*, unsigned> > &CP = MCP->getConstants();
|
||||||
if (CP.empty()) return;
|
if (CP.empty()) return;
|
||||||
const TargetData &TD = TM.getTargetData();
|
const TargetData &TD = TM.getTargetData();
|
||||||
|
|
||||||
@@ -111,13 +111,17 @@ void AsmPrinter::EmitConstantPool(MachineConstantPool *MCP) {
|
|||||||
for (unsigned i = 0, e = CP.size(); i != e; ++i) {
|
for (unsigned i = 0, e = CP.size(); i != e; ++i) {
|
||||||
// FIXME: force doubles to be naturally aligned. We should handle this
|
// FIXME: force doubles to be naturally aligned. We should handle this
|
||||||
// more correctly in the future.
|
// more correctly in the future.
|
||||||
unsigned Alignment = TD.getTypeAlignmentShift(CP[i]->getType());
|
unsigned Alignment = CP[i].second;
|
||||||
if (CP[i]->getType() == Type::DoubleTy && Alignment < 3) Alignment = 3;
|
if (Alignment == 0) {
|
||||||
|
Alignment = TD.getTypeAlignmentShift(CP[i].first->getType());
|
||||||
|
if (CP[i].first->getType() == Type::DoubleTy && Alignment < 3)
|
||||||
|
Alignment = 3;
|
||||||
|
}
|
||||||
|
|
||||||
EmitAlignment(Alignment);
|
EmitAlignment(Alignment);
|
||||||
O << PrivateGlobalPrefix << "CPI" << getFunctionNumber() << '_' << i
|
O << PrivateGlobalPrefix << "CPI" << getFunctionNumber() << '_' << i
|
||||||
<< ":\t\t\t\t\t" << CommentString << *CP[i] << '\n';
|
<< ":\t\t\t\t\t" << CommentString << *CP[i].first << '\n';
|
||||||
EmitGlobalConstant(CP[i]);
|
EmitGlobalConstant(CP[i].first);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -346,8 +346,11 @@ void MachineFrameInfo::dump(const MachineFunction &MF) const {
|
|||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
void MachineConstantPool::print(std::ostream &OS) const {
|
void MachineConstantPool::print(std::ostream &OS) const {
|
||||||
for (unsigned i = 0, e = Constants.size(); i != e; ++i)
|
for (unsigned i = 0, e = Constants.size(); i != e; ++i) {
|
||||||
OS << " <cp #" << i << "> is" << *(Value*)Constants[i] << "\n";
|
OS << " <cp #" << i << "> is" << *(Value*)Constants[i].first;
|
||||||
|
if (Constants[i].second != 0) OS << " , align=" << Constants[i].second;
|
||||||
|
OS << "\n";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MachineConstantPool::dump() const { print(std::cerr); }
|
void MachineConstantPool::dump() const { print(std::cerr); }
|
||||||
|
|||||||
@@ -194,7 +194,8 @@ void ScheduleDAG::EmitNode(NodeInfo *NI) {
|
|||||||
MI->addFrameIndexOperand(FI->getIndex());
|
MI->addFrameIndexOperand(FI->getIndex());
|
||||||
} else if (ConstantPoolSDNode *CP =
|
} else if (ConstantPoolSDNode *CP =
|
||||||
dyn_cast<ConstantPoolSDNode>(Node->getOperand(i))) {
|
dyn_cast<ConstantPoolSDNode>(Node->getOperand(i))) {
|
||||||
unsigned Idx = ConstPool->getConstantPoolIndex(CP->get());
|
unsigned Idx = ConstPool->getConstantPoolIndex(CP->get(),
|
||||||
|
CP->getAlignment());
|
||||||
MI->addConstantPoolIndexOperand(Idx);
|
MI->addConstantPoolIndexOperand(Idx);
|
||||||
} else if (ExternalSymbolSDNode *ES =
|
} else if (ExternalSymbolSDNode *ES =
|
||||||
dyn_cast<ExternalSymbolSDNode>(Node->getOperand(i))) {
|
dyn_cast<ExternalSymbolSDNode>(Node->getOperand(i))) {
|
||||||
|
|||||||
@@ -310,10 +310,14 @@ void SelectionDAG::RemoveNodeFromCSEMaps(SDNode *N) {
|
|||||||
Erased = TargetFrameIndices.erase(cast<FrameIndexSDNode>(N)->getIndex());
|
Erased = TargetFrameIndices.erase(cast<FrameIndexSDNode>(N)->getIndex());
|
||||||
break;
|
break;
|
||||||
case ISD::ConstantPool:
|
case ISD::ConstantPool:
|
||||||
Erased = ConstantPoolIndices.erase(cast<ConstantPoolSDNode>(N)->get());
|
Erased = ConstantPoolIndices.
|
||||||
|
erase(std::make_pair(cast<ConstantPoolSDNode>(N)->get(),
|
||||||
|
cast<ConstantPoolSDNode>(N)->getAlignment()));
|
||||||
break;
|
break;
|
||||||
case ISD::TargetConstantPool:
|
case ISD::TargetConstantPool:
|
||||||
Erased =TargetConstantPoolIndices.erase(cast<ConstantPoolSDNode>(N)->get());
|
Erased = TargetConstantPoolIndices.
|
||||||
|
erase(std::make_pair(cast<ConstantPoolSDNode>(N)->get(),
|
||||||
|
cast<ConstantPoolSDNode>(N)->getAlignment()));
|
||||||
break;
|
break;
|
||||||
case ISD::BasicBlock:
|
case ISD::BasicBlock:
|
||||||
Erased = BBNodes.erase(cast<BasicBlockSDNode>(N)->getBasicBlock());
|
Erased = BBNodes.erase(cast<BasicBlockSDNode>(N)->getBasicBlock());
|
||||||
@@ -655,18 +659,20 @@ SDOperand SelectionDAG::getTargetFrameIndex(int FI, MVT::ValueType VT) {
|
|||||||
return SDOperand(N, 0);
|
return SDOperand(N, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
SDOperand SelectionDAG::getConstantPool(Constant *C, MVT::ValueType VT) {
|
SDOperand SelectionDAG::getConstantPool(Constant *C, MVT::ValueType VT,
|
||||||
SDNode *&N = ConstantPoolIndices[C];
|
unsigned Alignment) {
|
||||||
|
SDNode *&N = ConstantPoolIndices[std::make_pair(C, Alignment)];
|
||||||
if (N) return SDOperand(N, 0);
|
if (N) return SDOperand(N, 0);
|
||||||
N = new ConstantPoolSDNode(C, VT, false);
|
N = new ConstantPoolSDNode(C, VT, Alignment, false);
|
||||||
AllNodes.push_back(N);
|
AllNodes.push_back(N);
|
||||||
return SDOperand(N, 0);
|
return SDOperand(N, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
SDOperand SelectionDAG::getTargetConstantPool(Constant *C, MVT::ValueType VT) {
|
SDOperand SelectionDAG::getTargetConstantPool(Constant *C, MVT::ValueType VT,
|
||||||
SDNode *&N = TargetConstantPoolIndices[C];
|
unsigned Alignment) {
|
||||||
|
SDNode *&N = TargetConstantPoolIndices[std::make_pair(C, Alignment)];
|
||||||
if (N) return SDOperand(N, 0);
|
if (N) return SDOperand(N, 0);
|
||||||
N = new ConstantPoolSDNode(C, VT, true);
|
N = new ConstantPoolSDNode(C, VT, Alignment, true);
|
||||||
AllNodes.push_back(N);
|
AllNodes.push_back(N);
|
||||||
return SDOperand(N, 0);
|
return SDOperand(N, 0);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -566,16 +566,18 @@ void JITEmitter::finishFunction(MachineFunction &F) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void JITEmitter::emitConstantPool(MachineConstantPool *MCP) {
|
void JITEmitter::emitConstantPool(MachineConstantPool *MCP) {
|
||||||
const std::vector<Constant*> &Constants = MCP->getConstants();
|
const std::vector<std::pair<Constant*,unsigned> > &Constants = MCP->getConstants();
|
||||||
if (Constants.empty()) return;
|
if (Constants.empty()) return;
|
||||||
|
|
||||||
for (unsigned i = 0, e = Constants.size(); i != e; ++i) {
|
for (unsigned i = 0, e = Constants.size(); i != e; ++i) {
|
||||||
const Type *Ty = Constants[i]->getType();
|
const Type *Ty = Constants[i].first->getType();
|
||||||
unsigned Size = (unsigned)TheJIT->getTargetData().getTypeSize(Ty);
|
unsigned Size = (unsigned)TheJIT->getTargetData().getTypeSize(Ty);
|
||||||
unsigned Alignment = TheJIT->getTargetData().getTypeAlignment(Ty);
|
unsigned Alignment = (Constants[i].second == 0)
|
||||||
|
? TheJIT->getTargetData().getTypeAlignment(Ty)
|
||||||
|
: Constants[i].second;
|
||||||
|
|
||||||
void *Addr = MemMgr.allocateConstant(Size, Alignment);
|
void *Addr = MemMgr.allocateConstant(Size, Alignment);
|
||||||
TheJIT->InitializeMemory(Constants[i], Addr);
|
TheJIT->InitializeMemory(Constants[i].first, Addr);
|
||||||
ConstantPoolAddresses.push_back(Addr);
|
ConstantPoolAddresses.push_back(Addr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -482,8 +482,9 @@ SDOperand AlphaTargetLowering::LowerOperation(SDOperand Op, SelectionDAG &DAG) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
case ISD::ConstantPool: {
|
case ISD::ConstantPool: {
|
||||||
Constant *C = cast<ConstantPoolSDNode>(Op)->get();
|
ConstantPoolSDNode *CP = cast<ConstantPoolSDNode>(Op);
|
||||||
SDOperand CPI = DAG.getTargetConstantPool(C, MVT::i64);
|
Constant *C = CP->get();
|
||||||
|
SDOperand CPI = DAG.getTargetConstantPool(C, MVT::i64, CP->getAlignment());
|
||||||
|
|
||||||
SDOperand Hi = DAG.getNode(AlphaISD::GPRelHi, MVT::i64, CPI,
|
SDOperand Hi = DAG.getNode(AlphaISD::GPRelHi, MVT::i64, CPI,
|
||||||
DAG.getNode(AlphaISD::GlobalBaseReg, MVT::i64));
|
DAG.getNode(AlphaISD::GlobalBaseReg, MVT::i64));
|
||||||
|
|||||||
@@ -442,8 +442,10 @@ SDOperand IA64DAGToDAGISel::Select(SDOperand Op) {
|
|||||||
|
|
||||||
case ISD::ConstantPool: { // TODO: nuke the constant pool
|
case ISD::ConstantPool: { // TODO: nuke the constant pool
|
||||||
// (ia64 doesn't need one)
|
// (ia64 doesn't need one)
|
||||||
Constant *C = cast<ConstantPoolSDNode>(N)->get();
|
ConstantPoolSDNode *CP = cast<ConstantPoolSDNode>(N);
|
||||||
SDOperand CPI = CurDAG->getTargetConstantPool(C, MVT::i64);
|
Constant *C = CP->get();
|
||||||
|
SDOperand CPI = CurDAG->getTargetConstantPool(C, MVT::i64,
|
||||||
|
CP->getAlignment());
|
||||||
return CurDAG->getTargetNode(IA64::ADDL_GA, MVT::i64, // ?
|
return CurDAG->getTargetNode(IA64::ADDL_GA, MVT::i64, // ?
|
||||||
CurDAG->getRegister(IA64::r1, MVT::i64), CPI);
|
CurDAG->getRegister(IA64::r1, MVT::i64), CPI);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -389,8 +389,9 @@ SDOperand PPCTargetLowering::LowerOperation(SDOperand Op, SelectionDAG &DAG) {
|
|||||||
return DAG.getNode(ISD::BUILD_PAIR, MVT::i64, OutLo, OutHi);
|
return DAG.getNode(ISD::BUILD_PAIR, MVT::i64, OutLo, OutHi);
|
||||||
}
|
}
|
||||||
case ISD::ConstantPool: {
|
case ISD::ConstantPool: {
|
||||||
Constant *C = cast<ConstantPoolSDNode>(Op)->get();
|
ConstantPoolSDNode *CP = cast<ConstantPoolSDNode>(Op);
|
||||||
SDOperand CPI = DAG.getTargetConstantPool(C, MVT::i32);
|
Constant *C = CP->get();
|
||||||
|
SDOperand CPI = DAG.getTargetConstantPool(C, MVT::i32, CP->getAlignment());
|
||||||
SDOperand Zero = DAG.getConstant(0, MVT::i32);
|
SDOperand Zero = DAG.getConstant(0, MVT::i32);
|
||||||
|
|
||||||
if (PPCGenerateStaticCode) {
|
if (PPCGenerateStaticCode) {
|
||||||
|
|||||||
@@ -693,7 +693,8 @@ LowerOperation(SDOperand Op, SelectionDAG &DAG) {
|
|||||||
}
|
}
|
||||||
case ISD::ConstantPool: {
|
case ISD::ConstantPool: {
|
||||||
Constant *C = cast<ConstantPoolSDNode>(Op)->get();
|
Constant *C = cast<ConstantPoolSDNode>(Op)->get();
|
||||||
SDOperand CP = DAG.getTargetConstantPool(C, MVT::i32);
|
SDOperand CP = DAG.getTargetConstantPool(C, MVT::i32,
|
||||||
|
cast<ConstantPoolSDNode>(Op)->getAlignment());
|
||||||
SDOperand Hi = DAG.getNode(V8ISD::Hi, MVT::i32, CP);
|
SDOperand Hi = DAG.getNode(V8ISD::Hi, MVT::i32, CP);
|
||||||
SDOperand Lo = DAG.getNode(V8ISD::Lo, MVT::i32, CP);
|
SDOperand Lo = DAG.getNode(V8ISD::Lo, MVT::i32, CP);
|
||||||
return DAG.getNode(ISD::ADD, MVT::i32, Lo, Hi);
|
return DAG.getNode(ISD::ADD, MVT::i32, Lo, Hi);
|
||||||
|
|||||||
@@ -693,7 +693,8 @@ LowerOperation(SDOperand Op, SelectionDAG &DAG) {
|
|||||||
}
|
}
|
||||||
case ISD::ConstantPool: {
|
case ISD::ConstantPool: {
|
||||||
Constant *C = cast<ConstantPoolSDNode>(Op)->get();
|
Constant *C = cast<ConstantPoolSDNode>(Op)->get();
|
||||||
SDOperand CP = DAG.getTargetConstantPool(C, MVT::i32);
|
SDOperand CP = DAG.getTargetConstantPool(C, MVT::i32,
|
||||||
|
cast<ConstantPoolSDNode>(Op)->getAlignment());
|
||||||
SDOperand Hi = DAG.getNode(V8ISD::Hi, MVT::i32, CP);
|
SDOperand Hi = DAG.getNode(V8ISD::Hi, MVT::i32, CP);
|
||||||
SDOperand Lo = DAG.getNode(V8ISD::Lo, MVT::i32, CP);
|
SDOperand Lo = DAG.getNode(V8ISD::Lo, MVT::i32, CP);
|
||||||
return DAG.getNode(ISD::ADD, MVT::i32, Lo, Hi);
|
return DAG.getNode(ISD::ADD, MVT::i32, Lo, Hi);
|
||||||
|
|||||||
@@ -209,11 +209,14 @@ namespace {
|
|||||||
// Print a constant (which may be an aggregate) prefixed by all the
|
// Print a constant (which may be an aggregate) prefixed by all the
|
||||||
// appropriate directives. Uses printConstantValueOnly() to print the
|
// appropriate directives. Uses printConstantValueOnly() to print the
|
||||||
// value or values.
|
// value or values.
|
||||||
void printConstant(const Constant* CV, std::string valID = "") {
|
void printConstant(const Constant* CV, unsigned Alignment,
|
||||||
|
std::string valID = "") {
|
||||||
if (valID.length() == 0)
|
if (valID.length() == 0)
|
||||||
valID = getID(CV);
|
valID = getID(CV);
|
||||||
|
|
||||||
O << "\t.align\t" << ConstantToAlignment(CV, TM) << "\n";
|
if (Alignment == 0)
|
||||||
|
Alignment = ConstantToAlignment(CV, TM);
|
||||||
|
O << "\t.align\t" << Alignment << "\n";
|
||||||
|
|
||||||
// Print .size and .type only if it is not a string.
|
// Print .size and .type only if it is not a string.
|
||||||
if (const ConstantArray *CVA = dyn_cast<ConstantArray>(CV))
|
if (const ConstantArray *CVA = dyn_cast<ConstantArray>(CV))
|
||||||
@@ -721,12 +724,12 @@ void SparcV9AsmPrinter::emitFunction(const Function &F) {
|
|||||||
|
|
||||||
// Emit constant pool for this function
|
// Emit constant pool for this function
|
||||||
const MachineConstantPool *MCP = MF.getConstantPool();
|
const MachineConstantPool *MCP = MF.getConstantPool();
|
||||||
const std::vector<Constant*> &CP = MCP->getConstants();
|
const std::vector<std::pair<Constant*, unsigned> > &CP = MCP->getConstants();
|
||||||
|
|
||||||
enterSection(ReadOnlyData);
|
enterSection(ReadOnlyData);
|
||||||
for (unsigned i = 0, e = CP.size(); i != e; ++i) {
|
for (unsigned i = 0, e = CP.size(); i != e; ++i) {
|
||||||
std::string cpiName = ".CPI_" + CurrentFnName + "_" + utostr(i);
|
std::string cpiName = ".CPI_" + CurrentFnName + "_" + utostr(i);
|
||||||
printConstant(CP[i], cpiName);
|
printConstant(CP[i].first, CP[i].second, cpiName);
|
||||||
}
|
}
|
||||||
|
|
||||||
enterSection(Text);
|
enterSection(Text);
|
||||||
@@ -755,7 +758,7 @@ void SparcV9AsmPrinter::printGlobalVariable(const GlobalVariable* GV) {
|
|||||||
if (GV->hasInitializer() &&
|
if (GV->hasInitializer() &&
|
||||||
!(GV->getInitializer()->isNullValue() ||
|
!(GV->getInitializer()->isNullValue() ||
|
||||||
isa<UndefValue>(GV->getInitializer()))) {
|
isa<UndefValue>(GV->getInitializer()))) {
|
||||||
printConstant(GV->getInitializer(), getID(GV));
|
printConstant(GV->getInitializer(), 0, getID(GV));
|
||||||
} else {
|
} else {
|
||||||
O << "\t.align\t" << TypeToAlignment(GV->getType()->getElementType(),
|
O << "\t.align\t" << TypeToAlignment(GV->getType()->getElementType(),
|
||||||
TM) << "\n";
|
TM) << "\n";
|
||||||
|
|||||||
Reference in New Issue
Block a user