mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-12-26 21:47:07 +00:00
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. llvm-svn: 28703
This commit is contained in:
parent
62a09f32c7
commit
2da9d803a4
@ -15,6 +15,7 @@
|
|||||||
#include "X86.h"
|
#include "X86.h"
|
||||||
#include "X86InstrBuilder.h"
|
#include "X86InstrBuilder.h"
|
||||||
#include "X86ISelLowering.h"
|
#include "X86ISelLowering.h"
|
||||||
|
#include "X86MachineFunctionInfo.h"
|
||||||
#include "X86TargetMachine.h"
|
#include "X86TargetMachine.h"
|
||||||
#include "llvm/CallingConv.h"
|
#include "llvm/CallingConv.h"
|
||||||
#include "llvm/Constants.h"
|
#include "llvm/Constants.h"
|
||||||
@ -3409,6 +3410,13 @@ SDOperand X86TargetLowering::LowerRET(SDOperand Op, SelectionDAG &DAG) {
|
|||||||
|
|
||||||
SDOperand
|
SDOperand
|
||||||
X86TargetLowering::LowerFORMAL_ARGUMENTS(SDOperand Op, SelectionDAG &DAG) {
|
X86TargetLowering::LowerFORMAL_ARGUMENTS(SDOperand Op, SelectionDAG &DAG) {
|
||||||
|
MachineFunction &MF = DAG.getMachineFunction();
|
||||||
|
const Function* Fn = MF.getFunction();
|
||||||
|
if (Fn->hasExternalLinkage() &&
|
||||||
|
Fn->getName() == "main" &&
|
||||||
|
Subtarget->TargetType == X86Subtarget::isCygwin)
|
||||||
|
MF.getInfo<X86FunctionInfo>()->setForceFramePointer(true);
|
||||||
|
|
||||||
unsigned CC = cast<ConstantSDNode>(Op.getOperand(1))->getValue();
|
unsigned CC = cast<ConstantSDNode>(Op.getOperand(1))->getValue();
|
||||||
if (CC == CallingConv::Fast && EnableFastCC)
|
if (CC == CallingConv::Fast && EnableFastCC)
|
||||||
return LowerFastCCArguments(Op, DAG);
|
return LowerFastCCArguments(Op, DAG);
|
||||||
|
30
lib/Target/X86/X86MachineFunctionInfo.h
Normal file
30
lib/Target/X86/X86MachineFunctionInfo.h
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
//====- X86MachineFuctionInfo.h - X86 machine function info -----*- C++ -*-===//
|
||||||
|
//
|
||||||
|
// The LLVM Compiler Infrastructure
|
||||||
|
//
|
||||||
|
// This file was developed by the Evan Cheng and is distributed under
|
||||||
|
// the University of Illinois Open Source License. See LICENSE.TXT for details.
|
||||||
|
//
|
||||||
|
//===----------------------------------------------------------------------===//
|
||||||
|
//
|
||||||
|
// This file declares X86-specific per-machine-function information.
|
||||||
|
//
|
||||||
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
|
#ifndef X86MACHINEFUNCTIONINFO_H
|
||||||
|
#define X86MACHINEFUNCTIONINFO_H
|
||||||
|
|
||||||
|
#include "llvm/CodeGen/MachineFunction.h"
|
||||||
|
|
||||||
|
namespace llvm {
|
||||||
|
|
||||||
|
class X86FunctionInfo : public MachineFunctionInfo {
|
||||||
|
bool ForceFramePointer; // Function requires use of frame pointer.
|
||||||
|
public:
|
||||||
|
X86FunctionInfo(MachineFunction& MF) : ForceFramePointer(false) {}
|
||||||
|
bool getForceFramePointer() const { return ForceFramePointer;}
|
||||||
|
void setForceFramePointer(bool forceFP) { ForceFramePointer = forceFP; }
|
||||||
|
};
|
||||||
|
} // End llvm namespace
|
||||||
|
|
||||||
|
#endif
|
@ -15,8 +15,9 @@
|
|||||||
#include "X86.h"
|
#include "X86.h"
|
||||||
#include "X86RegisterInfo.h"
|
#include "X86RegisterInfo.h"
|
||||||
#include "X86Subtarget.h"
|
#include "X86Subtarget.h"
|
||||||
#include "X86TargetMachine.h"
|
|
||||||
#include "X86InstrBuilder.h"
|
#include "X86InstrBuilder.h"
|
||||||
|
#include "X86MachineFunctionInfo.h"
|
||||||
|
#include "X86TargetMachine.h"
|
||||||
#include "llvm/Constants.h"
|
#include "llvm/Constants.h"
|
||||||
#include "llvm/Type.h"
|
#include "llvm/Type.h"
|
||||||
#include "llvm/Function.h"
|
#include "llvm/Function.h"
|
||||||
@ -638,14 +639,9 @@ X86RegisterInfo::getCalleeSaveRegClasses() const {
|
|||||||
// if frame pointer elimination is disabled.
|
// if frame pointer elimination is disabled.
|
||||||
//
|
//
|
||||||
static bool hasFP(MachineFunction &MF) {
|
static bool hasFP(MachineFunction &MF) {
|
||||||
const Function* Fn = MF.getFunction();
|
|
||||||
const X86Subtarget* Subtarget = &MF.getTarget().getSubtarget<X86Subtarget>();
|
|
||||||
|
|
||||||
return (NoFramePointerElim ||
|
return (NoFramePointerElim ||
|
||||||
MF.getFrameInfo()->hasVarSizedObjects() ||
|
MF.getFrameInfo()->hasVarSizedObjects() ||
|
||||||
(Fn->hasExternalLinkage() &&
|
MF.getInfo<X86FunctionInfo>()->getForceFramePointer());
|
||||||
Fn->getName() == "main" &&
|
|
||||||
Subtarget->TargetType == X86Subtarget::isCygwin));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void X86RegisterInfo::
|
void X86RegisterInfo::
|
||||||
|
Loading…
Reference in New Issue
Block a user