mirror of
https://github.com/RPCSX/llvm.git
synced 2024-12-02 08:46:23 +00:00
179cdfb5c8
* Fixed file headers to be consistent with the rest of LLVM * Other minor fixes git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3277 91177308-0d34-0410-b5e6-96231b3b80d8
43 lines
1.5 KiB
C++
43 lines
1.5 KiB
C++
//===-- MachineFrameInfo.cpp-----------------------------------------------===//
|
|
//
|
|
// 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.
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#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;
|
|
}
|