Use -Wl,-x instead of -s: it is more portable, and in particular,
[oota-llvm.git] / lib / Target / MachineFrameInfo.cpp
1 //===-- MachineFrameInfo.cpp-----------------------------------------------===//
2 // 
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
5 // here.
6 // 
7 //===----------------------------------------------------------------------===//
8
9 #include "llvm/Target/MachineFrameInfo.h"
10 #include "llvm/CodeGen/MachineFunction.h"
11
12 int
13 MachineFrameInfo::getIncomingArgOffset(MachineFunction& mcInfo,
14                                        unsigned argNum) const
15 {
16   assert(argsOnStackHaveFixedSize()); 
17   
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; 
23   return offset; 
24 }
25
26
27 int
28 MachineFrameInfo::getOutgoingArgOffset(MachineFunction& mcInfo,
29                                        unsigned argNum) const
30 {
31   assert(argsOnStackHaveFixedSize()); 
32   assert(((int) argNum - this->getNumFixedOutgoingArgs())
33          <= (int) mcInfo.getMaxOptionalNumArgs());
34   
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; 
40   
41   return offset; 
42 }