1 //===-- MachineFrameInfo.cpp-----------------------------------------------===//
3 // Interface to layout of stack frame on target machine. Most functions of
4 // class MachineFrameInfo have to be machine-specific so there is little code
7 //===----------------------------------------------------------------------===//
9 #include "llvm/Target/MachineFrameInfo.h"
10 #include "llvm/CodeGen/MachineFunction.h"
13 MachineFrameInfo::getIncomingArgOffset(MachineFunction& mcInfo,
14 unsigned argNum) const
16 assert(argsOnStackHaveFixedSize());
18 unsigned relativeOffset = argNum * getSizeOfEachArgOnStack();
19 bool growUp; // do args grow up or down
20 int firstArg = getFirstIncomingArgOffset(mcInfo, growUp);
21 int offset = growUp? firstArg + relativeOffset
22 : firstArg - relativeOffset;
28 MachineFrameInfo::getOutgoingArgOffset(MachineFunction& mcInfo,
29 unsigned argNum) const
31 assert(argsOnStackHaveFixedSize());
32 assert(((int) argNum - this->getNumFixedOutgoingArgs())
33 <= (int) mcInfo.getMaxOptionalNumArgs());
35 unsigned relativeOffset = argNum * getSizeOfEachArgOnStack();
36 bool growUp; // do args grow up or down
37 int firstArg = getFirstOutgoingArgOffset(mcInfo, growUp);
38 int offset = growUp? firstArg + relativeOffset
39 : firstArg - relativeOffset;