llvm.org GIT mirror llvm / e8bd0a3
Added X86FunctionInfo subclass of MachineFunction to record whether the function that is being lowered is forced to use FP. Currently this is only true for main() / Cygwin. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28703 91177308-0d34-0410-b5e6-96231b3b80d8 Evan Cheng 14 years ago
3 changed file(s) with 41 addition(s) and 7 deletion(s). Raw diff Collapse all Expand all
1414 #include "X86.h"
1515 #include "X86InstrBuilder.h"
1616 #include "X86ISelLowering.h"
17 #include "X86MachineFunctionInfo.h"
1718 #include "X86TargetMachine.h"
1819 #include "llvm/CallingConv.h"
1920 #include "llvm/Constants.h"
34083409
34093410 SDOperand
34103411 X86TargetLowering::LowerFORMAL_ARGUMENTS(SDOperand Op, SelectionDAG &DAG) {
3412 MachineFunction &MF = DAG.getMachineFunction();
3413 const Function* Fn = MF.getFunction();
3414 if (Fn->hasExternalLinkage() &&
3415 Fn->getName() == "main" &&
3416 Subtarget->TargetType == X86Subtarget::isCygwin)
3417 MF.getInfo()->setForceFramePointer(true);
3418
34113419 unsigned CC = cast(Op.getOperand(1))->getValue();
34123420 if (CC == CallingConv::Fast && EnableFastCC)
34133421 return LowerFastCCArguments(Op, DAG);
0 //====- X86MachineFuctionInfo.h - X86 machine function info -----*- C++ -*-===//
1 //
2 // The LLVM Compiler Infrastructure
3 //
4 // This file was developed by the Evan Cheng and is distributed under
5 // the University of Illinois Open Source License. See LICENSE.TXT for details.
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // This file declares X86-specific per-machine-function information.
10 //
11 //===----------------------------------------------------------------------===//
12
13 #ifndef X86MACHINEFUNCTIONINFO_H
14 #define X86MACHINEFUNCTIONINFO_H
15
16 #include "llvm/CodeGen/MachineFunction.h"
17
18 namespace llvm {
19
20 class X86FunctionInfo : public MachineFunctionInfo {
21 bool ForceFramePointer; // Function requires use of frame pointer.
22 public:
23 X86FunctionInfo(MachineFunction& MF) : ForceFramePointer(false) {}
24 bool getForceFramePointer() const { return ForceFramePointer;}
25 void setForceFramePointer(bool forceFP) { ForceFramePointer = forceFP; }
26 };
27 } // End llvm namespace
28
29 #endif
1414 #include "X86.h"
1515 #include "X86RegisterInfo.h"
1616 #include "X86Subtarget.h"
17 #include "X86InstrBuilder.h"
18 #include "X86MachineFunctionInfo.h"
1719 #include "X86TargetMachine.h"
18 #include "X86InstrBuilder.h"
1920 #include "llvm/Constants.h"
2021 #include "llvm/Type.h"
2122 #include "llvm/Function.h"
637638 // if frame pointer elimination is disabled.
638639 //
639640 static bool hasFP(MachineFunction &MF) {
640 const Function* Fn = MF.getFunction();
641 const X86Subtarget* Subtarget = &MF.getTarget().getSubtarget();
642
643641 return (NoFramePointerElim ||
644642 MF.getFrameInfo()->hasVarSizedObjects() ||
645 (Fn->hasExternalLinkage() &&
646 Fn->getName() == "main" &&
647 Subtarget->TargetType == X86Subtarget::isCygwin));
643 MF.getInfo()->getForceFramePointer());
648644 }
649645
650646 void X86RegisterInfo::