Implementation of class MachineFrameInfo.

llvm-svn: 2313
This commit is contained in:
Vikram S. Adve 2002-04-25 04:35:27 +00:00
parent 7a4b381f80
commit b63c4886c4
1 changed files with 50 additions and 0 deletions

View File

@ -0,0 +1,50 @@
// $Id$ -*-c++-*-
//***************************************************************************
// File:
// MachineFrameInfo.cpp
//
// Purpose:
// Interface to layout of stack frame on target machine.
// Most functions of class MachineFrameInfo have to be machine-specific
// so there is little code here.
//
// History:
// 4/17/02 - Vikram Adve - Created
//**************************************************************************/
#include "llvm/Target/MachineFrameInfo.h"
#include "llvm/CodeGen/MachineCodeForMethod.h"
int
MachineFrameInfo::getIncomingArgOffset(MachineCodeForMethod& mcInfo,
unsigned argNum) const
{
assert(argsOnStackHaveFixedSize());
unsigned relativeOffset = argNum * getSizeOfEachArgOnStack();
bool growUp; // do args grow up or down
int firstArg = getFirstIncomingArgOffset(mcInfo, growUp);
int offset = growUp? firstArg + relativeOffset
: firstArg - relativeOffset;
return offset;
}
int
MachineFrameInfo::getOutgoingArgOffset(MachineCodeForMethod& mcInfo,
unsigned argNum) const
{
assert(argsOnStackHaveFixedSize());
assert(((int) argNum - this->getNumFixedOutgoingArgs())
<= (int) mcInfo.getMaxOptionalNumArgs());
unsigned relativeOffset = argNum * getSizeOfEachArgOnStack();
bool growUp; // do args grow up or down
int firstArg = getFirstOutgoingArgOffset(mcInfo, growUp);
int offset = growUp? firstArg + relativeOffset
: firstArg - relativeOffset;
return offset;
}