diff options
author | Tim Northover <tnorthover@apple.com> | 2014-03-29 10:18:08 +0000 |
---|---|---|
committer | Tim Northover <tnorthover@apple.com> | 2014-03-29 10:18:08 +0000 |
commit | 7b837d8c75f78fe55c9b348b9ec2281169a48d2a (patch) | |
tree | e8e01e73cf4d0723a13e49e4b5d8a66f896d184f /lib/Target/ARM64/ARM64MachineFunctionInfo.h | |
parent | 69bd9577fc423edea13479eaacf7b1844faa6c6a (diff) | |
download | llvm-7b837d8c75f78fe55c9b348b9ec2281169a48d2a.tar.gz llvm-7b837d8c75f78fe55c9b348b9ec2281169a48d2a.tar.bz2 llvm-7b837d8c75f78fe55c9b348b9ec2281169a48d2a.tar.xz |
ARM64: initial backend import
This adds a second implementation of the AArch64 architecture to LLVM,
accessible in parallel via the "arm64" triple. The plan over the
coming weeks & months is to merge the two into a single backend,
during which time thorough code review should naturally occur.
Everything will be easier with the target in-tree though, hence this
commit.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@205090 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/ARM64/ARM64MachineFunctionInfo.h')
-rw-r--r-- | lib/Target/ARM64/ARM64MachineFunctionInfo.h | 126 |
1 files changed, 126 insertions, 0 deletions
diff --git a/lib/Target/ARM64/ARM64MachineFunctionInfo.h b/lib/Target/ARM64/ARM64MachineFunctionInfo.h new file mode 100644 index 0000000000..59538ea40e --- /dev/null +++ b/lib/Target/ARM64/ARM64MachineFunctionInfo.h @@ -0,0 +1,126 @@ +//===- ARM64MachineFuctionInfo.h - ARM64 machine function info --*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This file declares ARM64-specific per-machine-function information. +// +//===----------------------------------------------------------------------===// + +#ifndef ARM64MACHINEFUNCTIONINFO_H +#define ARM64MACHINEFUNCTIONINFO_H + +#include "llvm/ADT/SmallPtrSet.h" +#include "llvm/ADT/SmallVector.h" +#include "llvm/CodeGen/MachineFunction.h" +#include "llvm/MC/MCLinkerOptimizationHint.h" + +namespace llvm { + +/// ARM64FunctionInfo - This class is derived from MachineFunctionInfo and +/// contains private ARM64-specific information for each MachineFunction. +class ARM64FunctionInfo : public MachineFunctionInfo { + + /// HasStackFrame - True if this function has a stack frame. Set by + /// processFunctionBeforeCalleeSavedScan(). + bool HasStackFrame; + + /// \brief Amount of stack frame size, not including callee-saved registers. + unsigned LocalStackSize; + + /// \brief Number of TLS accesses using the special (combinable) + /// _TLS_MODULE_BASE_ symbol. + unsigned NumLocalDynamicTLSAccesses; + + /// \brief FrameIndex for start of varargs area for arguments passed on the + /// stack. + int VarArgsStackIndex; + + /// \brief FrameIndex for start of varargs area for arguments passed in + /// general purpose registers. + int VarArgsGPRIndex; + + /// \brief Size of the varargs area for arguments passed in general purpose + /// registers. + unsigned VarArgsGPRSize; + + /// \brief FrameIndex for start of varargs area for arguments passed in + /// floating-point registers. + int VarArgsFPRIndex; + + /// \brief Size of the varargs area for arguments passed in floating-point + /// registers. + unsigned VarArgsFPRSize; + +public: + ARM64FunctionInfo() + : HasStackFrame(false), NumLocalDynamicTLSAccesses(0), + VarArgsStackIndex(0), VarArgsGPRIndex(0), VarArgsGPRSize(0), + VarArgsFPRIndex(0), VarArgsFPRSize(0) {} + + explicit ARM64FunctionInfo(MachineFunction &MF) + : HasStackFrame(false), NumLocalDynamicTLSAccesses(0), + VarArgsStackIndex(0), VarArgsGPRIndex(0), VarArgsGPRSize(0), + VarArgsFPRIndex(0), VarArgsFPRSize(0) { + (void)MF; + } + + bool hasStackFrame() const { return HasStackFrame; } + void setHasStackFrame(bool s) { HasStackFrame = s; } + + void setLocalStackSize(unsigned Size) { LocalStackSize = Size; } + unsigned getLocalStackSize() const { return LocalStackSize; } + + void incNumLocalDynamicTLSAccesses() { ++NumLocalDynamicTLSAccesses; } + unsigned getNumLocalDynamicTLSAccesses() const { + return NumLocalDynamicTLSAccesses; + } + + int getVarArgsStackIndex() const { return VarArgsStackIndex; } + void setVarArgsStackIndex(int Index) { VarArgsStackIndex = Index; } + + int getVarArgsGPRIndex() const { return VarArgsGPRIndex; } + void setVarArgsGPRIndex(int Index) { VarArgsGPRIndex = Index; } + + unsigned getVarArgsGPRSize() const { return VarArgsGPRSize; } + void setVarArgsGPRSize(unsigned Size) { VarArgsGPRSize = Size; } + + int getVarArgsFPRIndex() const { return VarArgsFPRIndex; } + void setVarArgsFPRIndex(int Index) { VarArgsFPRIndex = Index; } + + unsigned getVarArgsFPRSize() const { return VarArgsFPRSize; } + void setVarArgsFPRSize(unsigned Size) { VarArgsFPRSize = Size; } + + typedef SmallPtrSet<const MachineInstr *, 16> SetOfInstructions; + + const SetOfInstructions &getLOHRelated() const { return LOHRelated; } + + // Shortcuts for LOH related types. + typedef LOHDirective<const MachineInstr> MILOHDirective; + typedef MILOHDirective::LOHArgs MILOHArgs; + + typedef LOHContainer<const MachineInstr> MILOHContainer; + typedef MILOHContainer::LOHDirectives MILOHDirectives; + + const MILOHContainer &getLOHContainer() const { return LOHContainerSet; } + + /// Add a LOH directive of this @p Kind and this @p Args. + void addLOHDirective(MCLOHType Kind, const MILOHArgs &Args) { + LOHContainerSet.addDirective(Kind, Args); + for (MILOHArgs::const_iterator It = Args.begin(), EndIt = Args.end(); + It != EndIt; ++It) + LOHRelated.insert(*It); + } + +private: + // Hold the lists of LOHs. + MILOHContainer LOHContainerSet; + SetOfInstructions LOHRelated; +}; +} // End llvm namespace + +#endif // ARM64MACHINEFUNCTIONINFO_H |