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"; O << Directive << CurrentFnName << "\n";
if (AFI->isThumbFunction()) { if (AFI->isThumbFunction()) {
EmitAlignment(1, F); EmitAlignment(AFI->getAlign(), F);
O << "\t.code\t16\n"; O << "\t.code\t16\n";
O << "\t.thumb_func"; O << "\t.thumb_func";
if (Subtarget->isTargetDarwin()) if (Subtarget->isTargetDarwin())

View File

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