diff options
author | Bill Wendling <isanbard@gmail.com> | 2009-06-30 22:38:32 +0000 |
---|---|---|
committer | Bill Wendling <isanbard@gmail.com> | 2009-06-30 22:38:32 +0000 |
commit | 25a8ae3f10965b47ecaa9eda5e997f16fe1d9414 (patch) | |
tree | 5542e5d0c5b1b7e34d9e5edf1f6ba4a2ce853dca /lib/Target/MSP430 | |
parent | bab5da1290d6e8f19a4a291acff93c58ff5966a4 (diff) | |
download | external_llvm-25a8ae3f10965b47ecaa9eda5e997f16fe1d9414.zip external_llvm-25a8ae3f10965b47ecaa9eda5e997f16fe1d9414.tar.gz external_llvm-25a8ae3f10965b47ecaa9eda5e997f16fe1d9414.tar.bz2 |
Add an "alignment" field to the MachineFunction object. It makes more sense to
have the alignment be calculated up front, and have the back-ends obey whatever
alignment is decided upon.
This allows for future work that would allow for precise no-op placement and the
like.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74564 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/MSP430')
-rw-r--r-- | lib/Target/MSP430/MSP430AsmPrinter.cpp | 5 | ||||
-rw-r--r-- | lib/Target/MSP430/MSP430ISelLowering.cpp | 5 | ||||
-rw-r--r-- | lib/Target/MSP430/MSP430ISelLowering.h | 3 |
3 files changed, 9 insertions, 4 deletions
diff --git a/lib/Target/MSP430/MSP430AsmPrinter.cpp b/lib/Target/MSP430/MSP430AsmPrinter.cpp index 71b785b..bfdb058 100644 --- a/lib/Target/MSP430/MSP430AsmPrinter.cpp +++ b/lib/Target/MSP430/MSP430AsmPrinter.cpp @@ -97,10 +97,7 @@ void MSP430AsmPrinter::emitFunctionHeader(const MachineFunction &MF) { SwitchToSection(TAI->SectionForGlobal(F)); - unsigned FnAlign = 4; - if (F->hasFnAttr(Attribute::OptimizeForSize)) - FnAlign = 1; - + unsigned FnAlign = MF.getAlignment(); EmitAlignment(FnAlign, F); switch (F->getLinkage()) { diff --git a/lib/Target/MSP430/MSP430ISelLowering.cpp b/lib/Target/MSP430/MSP430ISelLowering.cpp index 14db20e..d57ae82 100644 --- a/lib/Target/MSP430/MSP430ISelLowering.cpp +++ b/lib/Target/MSP430/MSP430ISelLowering.cpp @@ -127,6 +127,11 @@ SDValue MSP430TargetLowering::LowerOperation(SDValue Op, SelectionDAG &DAG) { } } +/// getFunctionAlignment - Return the alignment of this function. +unsigned MSP430TargetLowering::getFunctionAlignment(const Function *F) const { + return F->hasFnAttr(Attribute::OptimizeForSize) ? 1 : 4; +} + //===----------------------------------------------------------------------===// // Calling Convention Implementation //===----------------------------------------------------------------------===// diff --git a/lib/Target/MSP430/MSP430ISelLowering.h b/lib/Target/MSP430/MSP430ISelLowering.h index 404534d..fcbec59 100644 --- a/lib/Target/MSP430/MSP430ISelLowering.h +++ b/lib/Target/MSP430/MSP430ISelLowering.h @@ -74,6 +74,9 @@ namespace llvm { /// DAG node. virtual const char *getTargetNodeName(unsigned Opcode) const; + /// getFunctionAlignment - Return the alignment of this function. + virtual unsigned getFunctionAlignment(const Function *F) const; + SDValue LowerFORMAL_ARGUMENTS(SDValue Op, SelectionDAG &DAG); SDValue LowerCALL(SDValue Op, SelectionDAG &DAG); SDValue LowerRET(SDValue Op, SelectionDAG &DAG); |