diff options
author | Evan Cheng <evan.cheng@apple.com> | 2006-01-31 22:23:14 +0000 |
---|---|---|
committer | Evan Cheng <evan.cheng@apple.com> | 2006-01-31 22:23:14 +0000 |
commit | 32be2dc0afb6e91ea5af8bac112b89ea29504647 (patch) | |
tree | 8af26880214e2f9a5778418680e5a7463a5e2b5f /llvm/lib/CodeGen/AsmPrinter.cpp | |
parent | c642aa5e1cb5262d7fb26f434b6dfac15a2caaad (diff) | |
download | bcm5719-llvm-32be2dc0afb6e91ea5af8bac112b89ea29504647.tar.gz bcm5719-llvm-32be2dc0afb6e91ea5af8bac112b89ea29504647.zip |
Allow the specification of explicit alignments for constant pool entries.
llvm-svn: 25855
Diffstat (limited to 'llvm/lib/CodeGen/AsmPrinter.cpp')
-rw-r--r-- | llvm/lib/CodeGen/AsmPrinter.cpp | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter.cpp b/llvm/lib/CodeGen/AsmPrinter.cpp index ab0465df1c3..df00f47f293 100644 --- a/llvm/lib/CodeGen/AsmPrinter.cpp +++ b/llvm/lib/CodeGen/AsmPrinter.cpp @@ -103,7 +103,7 @@ void AsmPrinter::SetupMachineFunction(MachineFunction &MF) { /// the code generator. /// 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; const TargetData &TD = TM.getTargetData(); @@ -111,13 +111,17 @@ void AsmPrinter::EmitConstantPool(MachineConstantPool *MCP) { for (unsigned i = 0, e = CP.size(); i != e; ++i) { // FIXME: force doubles to be naturally aligned. We should handle this // more correctly in the future. - unsigned Alignment = TD.getTypeAlignmentShift(CP[i]->getType()); - if (CP[i]->getType() == Type::DoubleTy && Alignment < 3) Alignment = 3; + unsigned Alignment = CP[i].second; + if (Alignment == 0) { + Alignment = TD.getTypeAlignmentShift(CP[i].first->getType()); + if (CP[i].first->getType() == Type::DoubleTy && Alignment < 3) + Alignment = 3; + } EmitAlignment(Alignment); O << PrivateGlobalPrefix << "CPI" << getFunctionNumber() << '_' << i - << ":\t\t\t\t\t" << CommentString << *CP[i] << '\n'; - EmitGlobalConstant(CP[i]); + << ":\t\t\t\t\t" << CommentString << *CP[i].first << '\n'; + EmitGlobalConstant(CP[i].first); } } |