summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/Target')
-rw-r--r--llvm/lib/Target/Sparc/SparcISelDAGToDAG.cpp2
-rw-r--r--llvm/lib/Target/SparcV9/SparcV9AsmPrinter.cpp14
2 files changed, 13 insertions, 3 deletions
diff --git a/llvm/lib/Target/Sparc/SparcISelDAGToDAG.cpp b/llvm/lib/Target/Sparc/SparcISelDAGToDAG.cpp
index ecfbe917fb7..2924e7e62b3 100644
--- a/llvm/lib/Target/Sparc/SparcISelDAGToDAG.cpp
+++ b/llvm/lib/Target/Sparc/SparcISelDAGToDAG.cpp
@@ -968,7 +968,7 @@ void SparcDAGToDAGISel::InstructionSelectBasicBlock(SelectionDAG &DAG) {
}
bool SparcDAGToDAGISel::SelectADDRri(SDOperand Addr, SDOperand &Base,
- SDOperand &Offset) {
+ SDOperand &Offset) {
if (FrameIndexSDNode *FIN = dyn_cast<FrameIndexSDNode>(Addr)) {
Base = CurDAG->getTargetFrameIndex(FIN->getIndex(), MVT::i32);
Offset = CurDAG->getTargetConstant(0, MVT::i32);
diff --git a/llvm/lib/Target/SparcV9/SparcV9AsmPrinter.cpp b/llvm/lib/Target/SparcV9/SparcV9AsmPrinter.cpp
index 69f68094d57..62a31c26640 100644
--- a/llvm/lib/Target/SparcV9/SparcV9AsmPrinter.cpp
+++ b/llvm/lib/Target/SparcV9/SparcV9AsmPrinter.cpp
@@ -216,7 +216,8 @@ namespace {
if (Alignment == 0)
Alignment = ConstantToAlignment(CV, TM);
- O << "\t.align\t" << Alignment << "\n";
+ if (Alignment != 1)
+ O << "\t.align\t" << Alignment << "\n";
// Print .size and .type only if it is not a string.
if (const ConstantArray *CVA = dyn_cast<ConstantArray>(CV))
@@ -727,9 +728,18 @@ void SparcV9AsmPrinter::emitFunction(const Function &F) {
const std::vector<MachineConstantPoolEntry> &CP = MCP->getConstants();
enterSection(ReadOnlyData);
+ O << "\t.align\t" << (1 << MCP->getConstantPoolAlignment()) << "\n";
for (unsigned i = 0, e = CP.size(); i != e; ++i) {
std::string cpiName = ".CPI_" + CurrentFnName + "_" + utostr(i);
- printConstant(CP[i].Val, CP[i].Alignment, cpiName);
+ printConstant(CP[i].Val, 1, cpiName);
+
+ if (i != e-1) {
+ unsigned EntSize = TM.getTargetData().getTypeSize(CP[i].Val->getType());
+ unsigned ValEnd = CP[i].Offset + EntSize;
+ // Emit inter-object padding for alignment.
+ for (unsigned NumZeros = CP[i+1].Offset-ValEnd; NumZeros; --NumZeros)
+ O << "\t.byte 0\n";
+ }
}
enterSection(Text);
OpenPOWER on IntegriCloud