[llvm-commits] CVS: llvm/lib/Target/ARM/ARMFrameInfo.h ARMISelDAGToDAG.cpp ARMInstrInfo.td ARMRegisterInfo.cpp ARMTargetMachine.cpp ARMTargetMachine.h
Rafael Espindola
rafael.espindola at gmail.com
Wed Aug 16 07:43:47 PDT 2006
Changes in directory llvm/lib/Target/ARM:
ARMFrameInfo.h added (r1.1)
ARMISelDAGToDAG.cpp updated: 1.29 -> 1.30
ARMInstrInfo.td updated: 1.14 -> 1.15
ARMRegisterInfo.cpp updated: 1.14 -> 1.15
ARMTargetMachine.cpp updated: 1.4 -> 1.5
ARMTargetMachine.h updated: 1.1 -> 1.2
---
Log message:
Declare the callee saved regs
Remove the hard coded store and load of the link register
Implement ARMFrameInfo
---
Diffs of the changes: (+60 -14)
ARMFrameInfo.h | 43 +++++++++++++++++++++++++++++++++++++++++++
ARMISelDAGToDAG.cpp | 5 ++---
ARMInstrInfo.td | 2 +-
ARMRegisterInfo.cpp | 18 ++++++++++--------
ARMTargetMachine.cpp | 3 ++-
ARMTargetMachine.h | 3 ++-
6 files changed, 60 insertions(+), 14 deletions(-)
Index: llvm/lib/Target/ARM/ARMFrameInfo.h
diff -c /dev/null llvm/lib/Target/ARM/ARMFrameInfo.h:1.1
*** /dev/null Wed Aug 16 09:43:43 2006
--- llvm/lib/Target/ARM/ARMFrameInfo.h Wed Aug 16 09:43:33 2006
***************
*** 0 ****
--- 1,43 ----
+ //===-- ARMTargetFrameInfo.h - Define TargetFrameInfo for ARM ---*- C++ -*-===//
+ //
+ // The LLVM Compiler Infrastructure
+ //
+ // This file was developed by the "Instituto Nokia de Tecnologia" and
+ // is distributed under the University of Illinois Open Source
+ // License. See LICENSE.TXT for details.
+ //
+ //===----------------------------------------------------------------------===//
+ //
+ //
+ //
+ //===----------------------------------------------------------------------===//
+
+ #ifndef ARM_FRAMEINFO_H
+ #define ARM_FRAMEINFO_H
+
+ #include "ARM.h"
+ #include "llvm/Target/TargetFrameInfo.h"
+ #include "llvm/Target/TargetMachine.h"
+
+ namespace llvm {
+
+ class ARMFrameInfo: public TargetFrameInfo {
+ std::pair<unsigned, int> LR[1];
+
+ public:
+ ARMFrameInfo()
+ : TargetFrameInfo(TargetFrameInfo::StackGrowsDown, 8, 0) {
+ LR[0].first = ARM::R14;
+ LR[0].second = -4;
+ }
+
+ const std::pair<unsigned, int> *
+ getCalleeSaveSpillSlots(unsigned &NumEntries) const {
+ NumEntries = 1;
+ return &LR[0];
+ }
+ };
+
+ } // End llvm namespace
+
+ #endif
Index: llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp
diff -u llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp:1.29 llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp:1.30
--- llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp:1.29 Mon Aug 14 14:01:24 2006
+++ llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp Wed Aug 16 09:43:33 2006
@@ -84,9 +84,8 @@
SDOperand Callee = Op.getOperand(4);
unsigned NumOps = (Op.getNumOperands() - 5) / 2;
- // Count how many bytes are to be pushed on the stack. Initially
- // only the link register.
- unsigned NumBytes = 4;
+ // Count how many bytes are to be pushed on the stack.
+ unsigned NumBytes = 0;
// Add up all the space actually used.
for (unsigned i = 4; i < NumOps; ++i)
Index: llvm/lib/Target/ARM/ARMInstrInfo.td
diff -u llvm/lib/Target/ARM/ARMInstrInfo.td:1.14 llvm/lib/Target/ARM/ARMInstrInfo.td:1.15
--- llvm/lib/Target/ARM/ARMInstrInfo.td:1.14 Fri Aug 11 04:01:08 2006
+++ llvm/lib/Target/ARM/ARMInstrInfo.td Wed Aug 16 09:43:33 2006
@@ -61,7 +61,7 @@
def bx: InstARM<(ops), "bx r14", [(retflag)]>;
}
-let Defs = [R0, R1, R2, R3] in {
+let Defs = [R0, R1, R2, R3, R14] in {
def bl: InstARM<(ops i32imm:$func, variable_ops), "bl $func", [(ARMcall tglobaladdr:$func)]>;
}
Index: llvm/lib/Target/ARM/ARMRegisterInfo.cpp
diff -u llvm/lib/Target/ARM/ARMRegisterInfo.cpp:1.14 llvm/lib/Target/ARM/ARMRegisterInfo.cpp:1.15
--- llvm/lib/Target/ARM/ARMRegisterInfo.cpp:1.14 Wed Aug 9 12:37:45 2006
+++ llvm/lib/Target/ARM/ARMRegisterInfo.cpp Wed Aug 16 09:43:33 2006
@@ -58,13 +58,21 @@
}
const unsigned* ARMRegisterInfo::getCalleeSaveRegs() const {
- static const unsigned CalleeSaveRegs[] = { 0 };
+ static const unsigned CalleeSaveRegs[] = {
+ ARM::R4, ARM::R5, ARM::R6, ARM::R7,
+ ARM::R8, ARM::R9, ARM::R10, ARM::R11,
+ ARM::R14, 0
+ };
return CalleeSaveRegs;
}
const TargetRegisterClass* const *
ARMRegisterInfo::getCalleeSaveRegClasses() const {
- static const TargetRegisterClass * const CalleeSaveRegClasses[] = { 0 };
+ static const TargetRegisterClass * const CalleeSaveRegClasses[] = {
+ &ARM::IntRegsRegClass, &ARM::IntRegsRegClass, &ARM::IntRegsRegClass, &ARM::IntRegsRegClass,
+ &ARM::IntRegsRegClass, &ARM::IntRegsRegClass, &ARM::IntRegsRegClass, &ARM::IntRegsRegClass,
+ &ARM::IntRegsRegClass, 0
+ };
return CalleeSaveRegClasses;
}
@@ -126,16 +134,12 @@
// entry to the current function. This eliminates the need for add/sub
// brackets around call sites.
NumBytes += MFI->getMaxCallFrameSize();
- } else {
- NumBytes += 4;
}
MFI->setStackSize(NumBytes);
//sub sp, sp, #NumBytes
BuildMI(MBB, MBBI, ARM::subri, 2, ARM::R13).addReg(ARM::R13).addImm(NumBytes);
- //str lr, [sp, #NumBytes - 4]
- BuildMI(MBB, MBBI, ARM::str, 2, ARM::R14).addImm(NumBytes - 4).addReg(ARM::R13);
}
void ARMRegisterInfo::emitEpilogue(MachineFunction &MF,
@@ -147,8 +151,6 @@
MachineFrameInfo *MFI = MF.getFrameInfo();
int NumBytes = (int) MFI->getStackSize();
- //ldr lr, [sp]
- BuildMI(MBB, MBBI, ARM::ldr, 2, ARM::R14).addImm(NumBytes - 4).addReg(ARM::R13);
//add sp, sp, #NumBytes
BuildMI(MBB, MBBI, ARM::addri, 2, ARM::R13).addReg(ARM::R13).addImm(NumBytes);
}
Index: llvm/lib/Target/ARM/ARMTargetMachine.cpp
diff -u llvm/lib/Target/ARM/ARMTargetMachine.cpp:1.4 llvm/lib/Target/ARM/ARMTargetMachine.cpp:1.5
--- llvm/lib/Target/ARM/ARMTargetMachine.cpp:1.4 Wed Aug 9 12:37:45 2006
+++ llvm/lib/Target/ARM/ARMTargetMachine.cpp Wed Aug 16 09:43:33 2006
@@ -12,6 +12,7 @@
//===----------------------------------------------------------------------===//
#include "ARMTargetMachine.h"
+#include "ARMFrameInfo.h"
#include "ARM.h"
#include "llvm/Assembly/PrintModulePass.h"
#include "llvm/Module.h"
@@ -33,7 +34,7 @@
///
ARMTargetMachine::ARMTargetMachine(const Module &M, const std::string &FS)
: TargetMachine("ARM"), DataLayout("E-p:32:32"),
- FrameInfo(TargetFrameInfo::StackGrowsDown, 8, -4) {
+ FrameInfo() {
}
unsigned ARMTargetMachine::getModuleMatchQuality(const Module &M) {
Index: llvm/lib/Target/ARM/ARMTargetMachine.h
diff -u llvm/lib/Target/ARM/ARMTargetMachine.h:1.1 llvm/lib/Target/ARM/ARMTargetMachine.h:1.2
--- llvm/lib/Target/ARM/ARMTargetMachine.h:1.1 Sun May 14 17:18:28 2006
+++ llvm/lib/Target/ARM/ARMTargetMachine.h Wed Aug 16 09:43:33 2006
@@ -20,6 +20,7 @@
#include "llvm/Target/TargetFrameInfo.h"
#include "llvm/PassManager.h"
#include "ARMInstrInfo.h"
+#include "ARMFrameInfo.h"
namespace llvm {
@@ -28,7 +29,7 @@
class ARMTargetMachine : public TargetMachine {
const TargetData DataLayout; // Calculates type size & alignment
ARMInstrInfo InstrInfo;
- TargetFrameInfo FrameInfo;
+ ARMFrameInfo FrameInfo;
public:
ARMTargetMachine(const Module &M, const std::string &FS);
More information about the llvm-commits
mailing list