add Align field, and use when generating function alignment

llvm-svn: 36371
This commit is contained in:
Dale Johannesen 2007-04-23 20:07:25 +00:00
parent 9dce0dffd1
commit f7d3443fa7
2 changed files with 13 additions and 3 deletions

View File

@ -211,7 +211,7 @@ bool ARMAsmPrinter::runOnMachineFunction(MachineFunction &MF) {
O << Directive << CurrentFnName << "\n";
if (AFI->isThumbFunction()) {
EmitAlignment(1, F);
EmitAlignment(AFI->getAlign(), F);
O << "\t.code\t16\n";
O << "\t.thumb_func";
if (Subtarget->isTargetDarwin())

View File

@ -27,9 +27,14 @@ namespace llvm {
class ARMFunctionInfo : public MachineFunctionInfo {
/// isThumb - True if this function is compiled under Thumb mode.
///
/// Used to initialized Align, so must precede it.
bool isThumb;
/// Align - required alignment. ARM functions and Thumb functions with
/// constant pools require 4-byte alignment; other Thumb functions
/// require only 2-byte alignment.
unsigned Align;
/// VarArgsRegSaveSize - Size of the register save area for vararg functions.
///
unsigned VarArgsRegSaveSize;
@ -84,7 +89,8 @@ class ARMFunctionInfo : public MachineFunctionInfo {
public:
ARMFunctionInfo() :
isThumb(false),
isThumb(false),
Align(2U),
VarArgsRegSaveSize(0), HasStackFrame(false),
LRSpilledForFarJump(false), R3IsLiveIn(false),
FramePtrSpillOffset(0), GPRCS1Offset(0), GPRCS2Offset(0), DPRCSOffset(0),
@ -94,6 +100,7 @@ public:
ARMFunctionInfo(MachineFunction &MF) :
isThumb(MF.getTarget().getSubtarget<ARMSubtarget>().isThumb()),
Align(isThumb ? 1U : 2U),
VarArgsRegSaveSize(0), HasStackFrame(false),
LRSpilledForFarJump(false), R3IsLiveIn(false),
FramePtrSpillOffset(0), GPRCS1Offset(0), GPRCS2Offset(0), DPRCSOffset(0),
@ -104,6 +111,9 @@ public:
bool isThumbFunction() const { return isThumb; }
unsigned getAlign() const { return Align; }
void setAlign(unsigned a) { Align = a; }
unsigned getVarArgsRegSaveSize() const { return VarArgsRegSaveSize; }
void setVarArgsRegSaveSize(unsigned s) { VarArgsRegSaveSize = s; }