2015-07-30 06:32:47 +08:00
|
|
|
//===-- X86MachineFunctionInfo.h - X86 machine function info ----*- C++ -*-===//
|
2012-02-18 20:03:15 +08:00
|
|
|
//
|
2019-01-19 16:50:56 +08:00
|
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
2012-02-18 20:03:15 +08:00
|
|
|
//
|
2006-06-07 07:30:24 +08:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// This file declares X86-specific per-machine-function information.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2014-08-14 00:26:38 +08:00
|
|
|
#ifndef LLVM_LIB_TARGET_X86_X86MACHINEFUNCTIONINFO_H
|
|
|
|
#define LLVM_LIB_TARGET_X86_X86MACHINEFUNCTIONINFO_H
|
2006-06-07 07:30:24 +08:00
|
|
|
|
2014-12-23 07:58:37 +08:00
|
|
|
#include "llvm/CodeGen/CallingConvLower.h"
|
2006-06-07 07:30:24 +08:00
|
|
|
#include "llvm/CodeGen/MachineFunction.h"
|
2018-03-24 07:58:25 +08:00
|
|
|
#include "llvm/Support/MachineValueType.h"
|
2006-06-07 07:30:24 +08:00
|
|
|
|
|
|
|
namespace llvm {
|
|
|
|
|
2009-04-15 09:20:18 +08:00
|
|
|
/// X86MachineFunctionInfo - This class is derived from MachineFunction and
|
|
|
|
/// contains private X86 target-specific information for each MachineFunction.
|
2007-04-18 01:21:52 +08:00
|
|
|
class X86MachineFunctionInfo : public MachineFunctionInfo {
|
2011-12-20 10:50:00 +08:00
|
|
|
virtual void anchor();
|
|
|
|
|
2006-09-21 06:03:51 +08:00
|
|
|
/// ForceFramePointer - True if the function is required to use of frame
|
2012-08-02 02:39:17 +08:00
|
|
|
/// pointer for reasons other than it containing dynamic allocation or
|
2006-09-21 06:03:51 +08:00
|
|
|
/// that FP eliminatation is turned off. For example, Cygwin main function
|
|
|
|
/// contains stack pointer re-alignment code which requires FP.
|
2015-07-08 02:12:06 +08:00
|
|
|
bool ForceFramePointer = false;
|
2006-09-21 06:03:51 +08:00
|
|
|
|
2014-12-04 13:20:33 +08:00
|
|
|
/// RestoreBasePointerOffset - Non-zero if the function has base pointer
|
|
|
|
/// and makes call to llvm.eh.sjlj.setjmp. When non-zero, the value is a
|
|
|
|
/// displacement from the frame pointer to a slot where the base pointer
|
|
|
|
/// is stashed.
|
2015-07-08 02:12:06 +08:00
|
|
|
signed char RestoreBasePointerOffset = 0;
|
2014-12-04 13:20:33 +08:00
|
|
|
|
2007-07-17 15:59:08 +08:00
|
|
|
/// CalleeSavedFrameSize - Size of the callee-saved register portion of the
|
|
|
|
/// stack frame in bytes.
|
2015-07-08 02:12:06 +08:00
|
|
|
unsigned CalleeSavedFrameSize = 0;
|
2007-07-17 15:59:08 +08:00
|
|
|
|
2010-04-17 22:41:14 +08:00
|
|
|
/// BytesToPopOnReturn - Number of bytes function pops on return (in addition
|
|
|
|
/// to the space used by the return address).
|
2006-09-21 06:03:51 +08:00
|
|
|
/// Used on windows platform for stdcall & fastcall name decoration
|
2015-07-08 02:12:06 +08:00
|
|
|
unsigned BytesToPopOnReturn = 0;
|
2006-09-21 06:03:51 +08:00
|
|
|
|
2008-01-05 08:41:47 +08:00
|
|
|
/// ReturnAddrIndex - FrameIndex for return slot.
|
2015-07-08 02:12:06 +08:00
|
|
|
int ReturnAddrIndex = 0;
|
2007-10-12 03:40:01 +08:00
|
|
|
|
2018-05-01 23:54:18 +08:00
|
|
|
/// FrameIndex for return slot.
|
2015-07-08 02:12:06 +08:00
|
|
|
int FrameAddrIndex = 0;
|
2015-02-11 05:22:05 +08:00
|
|
|
|
2010-02-06 11:28:46 +08:00
|
|
|
/// TailCallReturnAddrDelta - The number of bytes by which return address
|
|
|
|
/// stack slot is moved as the result of tail call optimization.
|
2015-07-08 02:12:06 +08:00
|
|
|
int TailCallReturnAddrDelta = 0;
|
2007-10-12 03:40:01 +08:00
|
|
|
|
2008-04-22 07:59:07 +08:00
|
|
|
/// SRetReturnReg - Some subtargets require that sret lowering includes
|
|
|
|
/// returning the value of the returned struct in a register. This field
|
|
|
|
/// holds the virtual register into which the sret argument is passed.
|
2015-07-08 02:12:06 +08:00
|
|
|
unsigned SRetReturnReg = 0;
|
2008-04-22 07:59:07 +08:00
|
|
|
|
2008-10-03 23:45:36 +08:00
|
|
|
/// GlobalBaseReg - keeps track of the virtual register initialized for
|
|
|
|
/// use as the global base register. This is used for PIC in some PIC
|
|
|
|
/// relocation models.
|
2015-07-08 02:12:06 +08:00
|
|
|
unsigned GlobalBaseReg = 0;
|
2008-09-30 08:58:23 +08:00
|
|
|
|
2010-04-17 22:41:14 +08:00
|
|
|
/// VarArgsFrameIndex - FrameIndex for start of varargs area.
|
2015-07-08 02:12:06 +08:00
|
|
|
int VarArgsFrameIndex = 0;
|
2010-04-17 22:41:14 +08:00
|
|
|
/// RegSaveFrameIndex - X86-64 vararg func register save area.
|
2015-07-08 02:12:06 +08:00
|
|
|
int RegSaveFrameIndex = 0;
|
2010-04-17 22:41:14 +08:00
|
|
|
/// VarArgsGPOffset - X86-64 vararg func int reg offset.
|
2015-07-08 02:12:06 +08:00
|
|
|
unsigned VarArgsGPOffset = 0;
|
2010-04-17 22:41:14 +08:00
|
|
|
/// VarArgsFPOffset - X86-64 vararg func fp reg offset.
|
2015-07-08 02:12:06 +08:00
|
|
|
unsigned VarArgsFPOffset = 0;
|
2011-08-31 03:39:58 +08:00
|
|
|
/// ArgumentStackSize - The number of bytes on stack consumed by the arguments
|
|
|
|
/// being passed on the stack.
|
2015-07-08 02:12:06 +08:00
|
|
|
unsigned ArgumentStackSize = 0;
|
2012-06-02 00:27:21 +08:00
|
|
|
/// NumLocalDynamics - Number of local-dynamic TLS accesses.
|
2015-07-08 02:12:06 +08:00
|
|
|
unsigned NumLocalDynamics = 0;
|
2015-02-02 00:56:04 +08:00
|
|
|
/// HasPushSequences - Keeps track of whether this function uses sequences
|
|
|
|
/// of pushes to pass function parameters.
|
2015-07-08 02:12:06 +08:00
|
|
|
bool HasPushSequences = false;
|
2010-04-17 22:41:14 +08:00
|
|
|
|
2015-12-16 05:41:34 +08:00
|
|
|
/// True if the function recovers from an SEH exception, and therefore needs
|
|
|
|
/// to spill and restore the frame pointer.
|
2015-07-08 07:45:58 +08:00
|
|
|
bool HasSEHFramePtrSave = false;
|
|
|
|
|
|
|
|
/// The frame index of a stack object containing the original frame pointer
|
|
|
|
/// used to address arguments in a function using a base pointer.
|
|
|
|
int SEHFramePtrSaveIndex = 0;
|
|
|
|
|
2016-01-12 09:08:46 +08:00
|
|
|
/// True if this function has a subset of CSRs that is handled explicitly via
|
|
|
|
/// copies.
|
|
|
|
bool IsSplitCSR = false;
|
|
|
|
|
2016-03-25 09:10:56 +08:00
|
|
|
/// True if this function uses the red zone.
|
|
|
|
bool UsesRedZone = false;
|
|
|
|
|
2016-05-19 00:10:17 +08:00
|
|
|
/// True if this function has WIN_ALLOCA instructions.
|
|
|
|
bool HasWinAlloca = false;
|
|
|
|
|
2014-08-30 05:42:08 +08:00
|
|
|
private:
|
|
|
|
/// ForwardedMustTailRegParms - A list of virtual and physical registers
|
|
|
|
/// that must be forwarded to every musttail call.
|
2014-12-23 07:58:37 +08:00
|
|
|
SmallVector<ForwardedRegister, 1> ForwardedMustTailRegParms;
|
2014-08-30 05:42:08 +08:00
|
|
|
|
2006-06-07 07:30:24 +08:00
|
|
|
public:
|
2015-07-08 02:12:06 +08:00
|
|
|
X86MachineFunctionInfo() = default;
|
|
|
|
|
2015-07-23 04:46:11 +08:00
|
|
|
explicit X86MachineFunctionInfo(MachineFunction &MF) {}
|
2012-07-11 02:27:15 +08:00
|
|
|
|
2012-08-02 02:39:17 +08:00
|
|
|
bool getForceFramePointer() const { return ForceFramePointer;}
|
2006-06-07 07:30:24 +08:00
|
|
|
void setForceFramePointer(bool forceFP) { ForceFramePointer = forceFP; }
|
2006-09-21 06:03:51 +08:00
|
|
|
|
2015-02-02 00:56:04 +08:00
|
|
|
bool getHasPushSequences() const { return HasPushSequences; }
|
|
|
|
void setHasPushSequences(bool HasPush) { HasPushSequences = HasPush; }
|
|
|
|
|
2014-12-04 08:56:38 +08:00
|
|
|
bool getRestoreBasePointer() const { return RestoreBasePointerOffset!=0; }
|
|
|
|
void setRestoreBasePointer(const MachineFunction *MF);
|
|
|
|
int getRestoreBasePointerOffset() const {return RestoreBasePointerOffset; }
|
|
|
|
|
2007-07-17 15:59:08 +08:00
|
|
|
unsigned getCalleeSavedFrameSize() const { return CalleeSavedFrameSize; }
|
|
|
|
void setCalleeSavedFrameSize(unsigned bytes) { CalleeSavedFrameSize = bytes; }
|
|
|
|
|
2006-09-21 06:03:51 +08:00
|
|
|
unsigned getBytesToPopOnReturn() const { return BytesToPopOnReturn; }
|
|
|
|
void setBytesToPopOnReturn (unsigned bytes) { BytesToPopOnReturn = bytes;}
|
|
|
|
|
2007-08-16 01:12:32 +08:00
|
|
|
int getRAIndex() const { return ReturnAddrIndex; }
|
|
|
|
void setRAIndex(int Index) { ReturnAddrIndex = Index; }
|
2007-10-12 03:40:01 +08:00
|
|
|
|
2015-02-11 05:22:05 +08:00
|
|
|
int getFAIndex() const { return FrameAddrIndex; }
|
|
|
|
void setFAIndex(int Index) { FrameAddrIndex = Index; }
|
|
|
|
|
2007-10-12 03:40:01 +08:00
|
|
|
int getTCReturnAddrDelta() const { return TailCallReturnAddrDelta; }
|
|
|
|
void setTCReturnAddrDelta(int delta) {TailCallReturnAddrDelta = delta;}
|
2008-04-22 07:59:07 +08:00
|
|
|
|
|
|
|
unsigned getSRetReturnReg() const { return SRetReturnReg; }
|
|
|
|
void setSRetReturnReg(unsigned Reg) { SRetReturnReg = Reg; }
|
2008-09-30 08:58:23 +08:00
|
|
|
|
|
|
|
unsigned getGlobalBaseReg() const { return GlobalBaseReg; }
|
|
|
|
void setGlobalBaseReg(unsigned Reg) { GlobalBaseReg = Reg; }
|
2010-04-07 04:26:37 +08:00
|
|
|
|
2010-04-17 22:41:14 +08:00
|
|
|
int getVarArgsFrameIndex() const { return VarArgsFrameIndex; }
|
|
|
|
void setVarArgsFrameIndex(int Idx) { VarArgsFrameIndex = Idx; }
|
|
|
|
|
|
|
|
int getRegSaveFrameIndex() const { return RegSaveFrameIndex; }
|
|
|
|
void setRegSaveFrameIndex(int Idx) { RegSaveFrameIndex = Idx; }
|
|
|
|
|
|
|
|
unsigned getVarArgsGPOffset() const { return VarArgsGPOffset; }
|
|
|
|
void setVarArgsGPOffset(unsigned Offset) { VarArgsGPOffset = Offset; }
|
|
|
|
|
|
|
|
unsigned getVarArgsFPOffset() const { return VarArgsFPOffset; }
|
|
|
|
void setVarArgsFPOffset(unsigned Offset) { VarArgsFPOffset = Offset; }
|
2011-08-31 03:39:58 +08:00
|
|
|
|
|
|
|
unsigned getArgumentStackSize() const { return ArgumentStackSize; }
|
|
|
|
void setArgumentStackSize(unsigned size) { ArgumentStackSize = size; }
|
2012-06-02 00:27:21 +08:00
|
|
|
|
|
|
|
unsigned getNumLocalDynamicTLSAccesses() const { return NumLocalDynamics; }
|
|
|
|
void incNumLocalDynamicTLSAccesses() { ++NumLocalDynamics; }
|
2012-07-11 02:27:15 +08:00
|
|
|
|
2015-07-08 07:45:58 +08:00
|
|
|
bool getHasSEHFramePtrSave() const { return HasSEHFramePtrSave; }
|
|
|
|
void setHasSEHFramePtrSave(bool V) { HasSEHFramePtrSave = V; }
|
|
|
|
|
|
|
|
int getSEHFramePtrSaveIndex() const { return SEHFramePtrSaveIndex; }
|
|
|
|
void setSEHFramePtrSaveIndex(int Index) { SEHFramePtrSaveIndex = Index; }
|
|
|
|
|
2014-12-23 07:58:37 +08:00
|
|
|
SmallVectorImpl<ForwardedRegister> &getForwardedMustTailRegParms() {
|
2014-08-30 05:42:08 +08:00
|
|
|
return ForwardedMustTailRegParms;
|
|
|
|
}
|
2016-01-12 09:08:46 +08:00
|
|
|
|
|
|
|
bool isSplitCSR() const { return IsSplitCSR; }
|
|
|
|
void setIsSplitCSR(bool s) { IsSplitCSR = s; }
|
2016-03-25 09:10:56 +08:00
|
|
|
|
|
|
|
bool getUsesRedZone() const { return UsesRedZone; }
|
|
|
|
void setUsesRedZone(bool V) { UsesRedZone = V; }
|
2016-05-19 00:10:17 +08:00
|
|
|
|
|
|
|
bool hasWinAlloca() const { return HasWinAlloca; }
|
|
|
|
void setHasWinAlloca(bool v) { HasWinAlloca = v; }
|
2006-06-07 07:30:24 +08:00
|
|
|
};
|
2009-04-15 09:20:18 +08:00
|
|
|
|
2015-06-23 17:49:53 +08:00
|
|
|
} // End llvm namespace
|
2006-06-07 07:30:24 +08:00
|
|
|
|
|
|
|
#endif
|