[llvm-commits] [llvm] r48805 - in /llvm/trunk/lib/Target: PowerPC/PPCAsmPrinter.cpp X86/X86ATTAsmPrinter.cpp X86/X86IntelAsmPrinter.cpp
Evan Cheng
evan.cheng at apple.com
Tue Mar 25 15:29:46 PDT 2008
Author: evancheng
Date: Tue Mar 25 17:29:46 2008
New Revision: 48805
URL: http://llvm.org/viewvc/llvm-project?rev=48805&view=rev
Log:
Smaller function alignment when optimizing for size.
Modified:
llvm/trunk/lib/Target/PowerPC/PPCAsmPrinter.cpp
llvm/trunk/lib/Target/X86/X86ATTAsmPrinter.cpp
llvm/trunk/lib/Target/X86/X86IntelAsmPrinter.cpp
Modified: llvm/trunk/lib/Target/PowerPC/PPCAsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCAsmPrinter.cpp?rev=48805&r1=48804&r2=48805&view=diff
==============================================================================
--- llvm/trunk/lib/Target/PowerPC/PPCAsmPrinter.cpp (original)
+++ llvm/trunk/lib/Target/PowerPC/PPCAsmPrinter.cpp Tue Mar 25 17:29:46 2008
@@ -819,7 +819,7 @@
if (const char *Directive = TAI->getHiddenDirective())
O << Directive << CurrentFnName << "\n";
- EmitAlignment(4, F);
+ EmitAlignment(OptimizeForSize ? 2 : 4, F);
O << CurrentFnName << ":\n";
// Emit pre-function debug information.
Modified: llvm/trunk/lib/Target/X86/X86ATTAsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ATTAsmPrinter.cpp?rev=48805&r1=48804&r2=48805&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86ATTAsmPrinter.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86ATTAsmPrinter.cpp Tue Mar 25 17:29:46 2008
@@ -98,21 +98,22 @@
SwitchToTextSection(getSectionForFunction(*F).c_str(), F);
+ unsigned FnAlign = OptimizeForSize ? 1 : 4;
switch (F->getLinkage()) {
default: assert(0 && "Unknown linkage type!");
case Function::InternalLinkage: // Symbols default to internal.
- EmitAlignment(4, F);
+ EmitAlignment(FnAlign, F);
break;
case Function::DLLExportLinkage:
DLLExportedFns.insert(Mang->makeNameProper(F->getName(), ""));
//FALLS THROUGH
case Function::ExternalLinkage:
- EmitAlignment(4, F);
+ EmitAlignment(FnAlign, F);
O << "\t.globl\t" << CurrentFnName << "\n";
break;
case Function::LinkOnceLinkage:
case Function::WeakLinkage:
- EmitAlignment(4, F);
+ EmitAlignment(FnAlign, F);
if (Subtarget->isTargetDarwin()) {
O << "\t.globl\t" << CurrentFnName << "\n";
O << TAI->getWeakDefDirective() << CurrentFnName << "\n";
Modified: llvm/trunk/lib/Target/X86/X86IntelAsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86IntelAsmPrinter.cpp?rev=48805&r1=48804&r2=48805&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86IntelAsmPrinter.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86IntelAsmPrinter.cpp Tue Mar 25 17:29:46 2008
@@ -57,17 +57,18 @@
SwitchToTextSection(getSectionForFunction(*F).c_str(), F);
+ unsigned FnAlign = OptimizeForSize ? 1 : 4;
switch (F->getLinkage()) {
default: assert(0 && "Unsupported linkage type!");
case Function::InternalLinkage:
- EmitAlignment(4);
+ EmitAlignment(FnAlign);
break;
case Function::DLLExportLinkage:
DLLExportedFns.insert(CurrentFnName);
//FALLS THROUGH
case Function::ExternalLinkage:
O << "\tpublic " << CurrentFnName << "\n";
- EmitAlignment(4);
+ EmitAlignment(FnAlign);
break;
}
More information about the llvm-commits
mailing list