2 //***************************************************************************
4 // MachineFrameInfo.cpp
7 // Interface to layout of stack frame on target machine.
8 // Most functions of class MachineFrameInfo have to be machine-specific
9 // so there is little code here.
12 // 4/17/02 - Vikram Adve - Created
13 //**************************************************************************/
16 #include "llvm/Target/MachineFrameInfo.h"
17 #include "llvm/CodeGen/MachineCodeForMethod.h"
21 MachineFrameInfo::getIncomingArgOffset(MachineCodeForMethod& mcInfo,
22 unsigned argNum) const
24 assert(argsOnStackHaveFixedSize());
26 unsigned relativeOffset = argNum * getSizeOfEachArgOnStack();
27 bool growUp; // do args grow up or down
28 int firstArg = getFirstIncomingArgOffset(mcInfo, growUp);
29 int offset = growUp? firstArg + relativeOffset
30 : firstArg - relativeOffset;
36 MachineFrameInfo::getOutgoingArgOffset(MachineCodeForMethod& mcInfo,
37 unsigned argNum) const
39 assert(argsOnStackHaveFixedSize());
40 assert(((int) argNum - this->getNumFixedOutgoingArgs())
41 <= (int) mcInfo.getMaxOptionalNumArgs());
43 unsigned relativeOffset = argNum * getSizeOfEachArgOnStack();
44 bool growUp; // do args grow up or down
45 int firstArg = getFirstOutgoingArgOffset(mcInfo, growUp);
46 int offset = growUp? firstArg + relativeOffset
47 : firstArg - relativeOffset;