Skip to content
Snippets Groups Projects
Commit dd8fc7bd authored by Fabian Scheler's avatar Fabian Scheler
Browse files

added missing stuff

- TriCoreFrameLowering.cpp
- missing namespace
parent 223875ea
No related branches found
No related tags found
No related merge requests found
//===-- TriCoreFrameLowering.cpp - Frame info for TriCore Target --------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This file contains TriCore frame information that doesn't fit anywhere else
// cleanly...
//
//===----------------------------------------------------------------------===//
#define DEBUG_TYPE "target_tricore"
#include "TriCoreFrameLowering.h"
#include "TriCoreInstrInfo.h"
#include "TriCoreMisc.h"
#include "TriCore.h"
#include "llvm/Function.h"
#include "llvm/CodeGen/MachineInstrBuilder.h"
#include "llvm/CodeGen/RegisterScavenging.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/Target/TargetInstrInfo.h"
namespace llvm {
// Inserts prologue code into the function.
void TriCoreFrameLowering::emitPrologue(MachineFunction &mf) const {
DebugLoc dl;
MachineBasicBlock &mbb = mf.front();
MachineBasicBlock::iterator it = mbb.begin();
uint64_t stackSize = mf.getFrameInfo()->getStackSize();
const TargetFrameLowering *tfi = mf.getTarget().getFrameLowering();
const TargetInstrInfo *tii = mf.getTarget().getInstrInfo();
DEBUG(errs() << "TriCoreFrameLowering::emitPrologue(): mf = " << mf.getFunction()->getName() << "\n");
if (it != mbb.end())
dl = it->getDebugLoc();
// Set frame pointer if one is used; adjust stack pointer
if (tfi->hasFP(mf)) {
BuildMI(mbb, it, dl, tii->get(TriCore::MOV_AAsrr), FRAME_POINTER)
.addReg(STACK_POINTER);
}
adjustStackPointer(mf, mbb, it, -stackSize);
}
// Inserts epilogue code into the function.
void TriCoreFrameLowering::emitEpilogue(MachineFunction &mf,
MachineBasicBlock &mbb) const {
// Nothing to do - the ret instruction performs all cleanup automatically,
// including restoring stack pointer and frame pointer (being located in the
// upper context).
}
// This method is called immediately before PrologEpilogInserter scans the
// physical registers used to determine what callee saved registers should be
// spilled.
void TriCoreFrameLowering::processFunctionBeforeCalleeSavedScan(MachineFunction &mf, RegScavenger *rs) const {
// FIXME: This always leads to the generation of an emergency spill slot in
// the stack frame, whether we actually need one or not.
const TargetRegisterClass *rc = TriCore::IRRegisterClass;
int fi = mf.getFrameInfo()->CreateStackObject(rc->getSize(),
rc->getAlignment(), false);
rs->setScavengingFrameIndex(fi);
}
}
......@@ -26,7 +26,7 @@
#include "llvm/Target/TargetInstrInfo.h"
#include "llvm/Target/TargetMachine.h"
using namespace llvm;
namespace llvm {
// Increments or decrements the stack pointer by the given number of bytes.
void adjustStackPointer(MachineFunction &mf,
......@@ -57,3 +57,5 @@ void adjustStackPointer(MachineFunction &mf,
}
}
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment