summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorDale Johannesen <dalej@apple.com>2007-04-23 20:07:25 +0000
committerDale Johannesen <dalej@apple.com>2007-04-23 20:07:25 +0000
commited0ecdb7ff1dbb836a94e30af1794fbced1a9f26 (patch)
treeef466c6912ec26a7116fc6a636d4d421bc190f84 /llvm/lib
parent8eb9bff493d3553bc72f4e45de7948d3afb86f19 (diff)
downloadbcm5719-llvm-ed0ecdb7ff1dbb836a94e30af1794fbced1a9f26.tar.gz
bcm5719-llvm-ed0ecdb7ff1dbb836a94e30af1794fbced1a9f26.zip
add Align field, and use when generating function alignment
llvm-svn: 36371
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Target/ARM/ARMAsmPrinter.cpp2
-rw-r--r--llvm/lib/Target/ARM/ARMMachineFunctionInfo.h14
2 files changed, 13 insertions, 3 deletions
diff --git a/llvm/lib/Target/ARM/ARMAsmPrinter.cpp b/llvm/lib/Target/ARM/ARMAsmPrinter.cpp
index 625dd9d8856..6822e632824 100644
--- a/llvm/lib/Target/ARM/ARMAsmPrinter.cpp
+++ b/llvm/lib/Target/ARM/ARMAsmPrinter.cpp
@@ -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())
diff --git a/llvm/lib/Target/ARM/ARMMachineFunctionInfo.h b/llvm/lib/Target/ARM/ARMMachineFunctionInfo.h
index f943cb75657..665c5e39292 100644
--- a/llvm/lib/Target/ARM/ARMMachineFunctionInfo.h
+++ b/llvm/lib/Target/ARM/ARMMachineFunctionInfo.h
@@ -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; }
OpenPOWER on IntegriCloud