summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergei Barannikov <barannikov88@gmail.com>2023-05-18 04:28:31 +0300
committerSergei Barannikov <barannikov88@gmail.com>2023-05-18 04:29:16 +0300
commit7971d91bbf903b894936e663e67e03ffc0c29004 (patch)
tree7120622b37f1757af309df6c2099245f8cb21c6d
parente0466a7463ecbd6a3bbe3296f5f7c5ece749564f (diff)
downloadllvm-7971d91bbf903b894936e663e67e03ffc0c29004.tar.gz
[clang][CodeGen] Reformat ABIInfo.h (NFC)
Preparatory change for D148094.
-rw-r--r--clang/lib/CodeGen/ABIInfo.h239
1 files changed, 118 insertions, 121 deletions
diff --git a/clang/lib/CodeGen/ABIInfo.h b/clang/lib/CodeGen/ABIInfo.h
index 1dffa41c57c5..5ce9eab7fc87 100644
--- a/clang/lib/CodeGen/ABIInfo.h
+++ b/clang/lib/CodeGen/ABIInfo.h
@@ -15,131 +15,128 @@
#include "llvm/IR/Type.h"
namespace llvm {
- class Value;
- class LLVMContext;
- class DataLayout;
- class Type;
-}
+class Value;
+class LLVMContext;
+class DataLayout;
+class Type;
+} // namespace llvm
namespace clang {
- class ASTContext;
- class CodeGenOptions;
- class TargetInfo;
+class ASTContext;
+class CodeGenOptions;
+class TargetInfo;
namespace CodeGen {
- class ABIArgInfo;
- class Address;
- class CGCXXABI;
- class CGFunctionInfo;
- class CodeGenFunction;
- class CodeGenTypes;
-
- // FIXME: All of this stuff should be part of the target interface
- // somehow. It is currently here because it is not clear how to factor
- // the targets to support this, since the Targets currently live in a
- // layer below types n'stuff.
-
-
- /// ABIInfo - Target specific hooks for defining how a type should be
- /// passed or returned from functions.
- class ABIInfo {
- protected:
- CodeGen::CodeGenTypes &CGT;
- llvm::CallingConv::ID RuntimeCC;
- public:
- ABIInfo(CodeGen::CodeGenTypes &cgt)
- : CGT(cgt), RuntimeCC(llvm::CallingConv::C) {}
-
- virtual ~ABIInfo();
-
- virtual bool allowBFloatArgsAndRet() const { return false; }
-
- CodeGen::CGCXXABI &getCXXABI() const;
- ASTContext &getContext() const;
- llvm::LLVMContext &getVMContext() const;
- const llvm::DataLayout &getDataLayout() const;
- const TargetInfo &getTarget() const;
- const CodeGenOptions &getCodeGenOpts() const;
-
- /// Return the calling convention to use for system runtime
- /// functions.
- llvm::CallingConv::ID getRuntimeCC() const {
- return RuntimeCC;
- }
-
- virtual void computeInfo(CodeGen::CGFunctionInfo &FI) const = 0;
-
- /// EmitVAArg - Emit the target dependent code to load a value of
- /// \arg Ty from the va_list pointed to by \arg VAListAddr.
-
- // FIXME: This is a gaping layering violation if we wanted to drop
- // the ABI information any lower than CodeGen. Of course, for
- // VAArg handling it has to be at this level; there is no way to
- // abstract this out.
- virtual CodeGen::Address EmitVAArg(CodeGen::CodeGenFunction &CGF,
+class ABIArgInfo;
+class Address;
+class CGCXXABI;
+class CGFunctionInfo;
+class CodeGenFunction;
+class CodeGenTypes;
+
+// FIXME: All of this stuff should be part of the target interface
+// somehow. It is currently here because it is not clear how to factor
+// the targets to support this, since the Targets currently live in a
+// layer below types n'stuff.
+
+/// ABIInfo - Target specific hooks for defining how a type should be
+/// passed or returned from functions.
+class ABIInfo {
+protected:
+ CodeGen::CodeGenTypes &CGT;
+ llvm::CallingConv::ID RuntimeCC;
+
+public:
+ ABIInfo(CodeGen::CodeGenTypes &cgt)
+ : CGT(cgt), RuntimeCC(llvm::CallingConv::C) {}
+
+ virtual ~ABIInfo();
+
+ virtual bool allowBFloatArgsAndRet() const { return false; }
+
+ CodeGen::CGCXXABI &getCXXABI() const;
+ ASTContext &getContext() const;
+ llvm::LLVMContext &getVMContext() const;
+ const llvm::DataLayout &getDataLayout() const;
+ const TargetInfo &getTarget() const;
+ const CodeGenOptions &getCodeGenOpts() const;
+
+ /// Return the calling convention to use for system runtime
+ /// functions.
+ llvm::CallingConv::ID getRuntimeCC() const { return RuntimeCC; }
+
+ virtual void computeInfo(CodeGen::CGFunctionInfo &FI) const = 0;
+
+ /// EmitVAArg - Emit the target dependent code to load a value of
+ /// \arg Ty from the va_list pointed to by \arg VAListAddr.
+
+ // FIXME: This is a gaping layering violation if we wanted to drop
+ // the ABI information any lower than CodeGen. Of course, for
+ // VAArg handling it has to be at this level; there is no way to
+ // abstract this out.
+ virtual CodeGen::Address EmitVAArg(CodeGen::CodeGenFunction &CGF,
+ CodeGen::Address VAListAddr,
+ QualType Ty) const = 0;
+
+ bool isAndroid() const;
+ bool isOHOSFamily() const;
+
+ /// Emit the target dependent code to load a value of
+ /// \arg Ty from the \c __builtin_ms_va_list pointed to by \arg VAListAddr.
+ virtual CodeGen::Address EmitMSVAArg(CodeGen::CodeGenFunction &CGF,
CodeGen::Address VAListAddr,
- QualType Ty) const = 0;
-
- bool isAndroid() const;
- bool isOHOSFamily() const;
-
- /// Emit the target dependent code to load a value of
- /// \arg Ty from the \c __builtin_ms_va_list pointed to by \arg VAListAddr.
- virtual CodeGen::Address EmitMSVAArg(CodeGen::CodeGenFunction &CGF,
- CodeGen::Address VAListAddr,
- QualType Ty) const;
-
- virtual bool isHomogeneousAggregateBaseType(QualType Ty) const;
-
- virtual bool isHomogeneousAggregateSmallEnough(const Type *Base,
- uint64_t Members) const;
- virtual bool isZeroLengthBitfieldPermittedInHomogeneousAggregate() const;
-
- bool isHomogeneousAggregate(QualType Ty, const Type *&Base,
- uint64_t &Members) const;
-
- // Implement the Type::IsPromotableIntegerType for ABI specific needs. The
- // only difference is that this considers bit-precise integer types as well.
- bool isPromotableIntegerTypeForABI(QualType Ty) const;
-
- /// A convenience method to return an indirect ABIArgInfo with an
- /// expected alignment equal to the ABI alignment of the given type.
- CodeGen::ABIArgInfo
- getNaturalAlignIndirect(QualType Ty, bool ByVal = true,
- bool Realign = false,
- llvm::Type *Padding = nullptr) const;
-
- CodeGen::ABIArgInfo
- getNaturalAlignIndirectInReg(QualType Ty, bool Realign = false) const;
- };
-
- /// Target specific hooks for defining how a type should be passed or returned
- /// from functions with one of the Swift calling conventions.
- class SwiftABIInfo {
- protected:
- CodeGenTypes &CGT;
- bool SwiftErrorInRegister;
-
- public:
- SwiftABIInfo(CodeGen::CodeGenTypes &CGT, bool SwiftErrorInRegister)
- : CGT(CGT), SwiftErrorInRegister(SwiftErrorInRegister) {}
-
- virtual ~SwiftABIInfo();
-
- /// Returns true if an aggregate which expands to the given type sequence
- /// should be passed / returned indirectly.
- virtual bool shouldPassIndirectly(ArrayRef<llvm::Type *> ComponentTys,
- bool AsReturnValue) const;
-
- /// Returns true if the given vector type is legal from Swift's calling
- /// convention perspective.
- virtual bool isLegalVectorType(CharUnits VectorSize, llvm::Type *EltTy,
- unsigned NumElts) const;
-
- /// Returns true if swifterror is lowered to a register by the target ABI.
- bool isSwiftErrorInRegister() const { return SwiftErrorInRegister; };
- };
-} // end namespace CodeGen
-} // end namespace clang
+ QualType Ty) const;
+
+ virtual bool isHomogeneousAggregateBaseType(QualType Ty) const;
+
+ virtual bool isHomogeneousAggregateSmallEnough(const Type *Base,
+ uint64_t Members) const;
+ virtual bool isZeroLengthBitfieldPermittedInHomogeneousAggregate() const;
+
+ bool isHomogeneousAggregate(QualType Ty, const Type *&Base,
+ uint64_t &Members) const;
+
+ // Implement the Type::IsPromotableIntegerType for ABI specific needs. The
+ // only difference is that this considers bit-precise integer types as well.
+ bool isPromotableIntegerTypeForABI(QualType Ty) const;
+
+ /// A convenience method to return an indirect ABIArgInfo with an
+ /// expected alignment equal to the ABI alignment of the given type.
+ CodeGen::ABIArgInfo
+ getNaturalAlignIndirect(QualType Ty, bool ByVal = true, bool Realign = false,
+ llvm::Type *Padding = nullptr) const;
+
+ CodeGen::ABIArgInfo getNaturalAlignIndirectInReg(QualType Ty,
+ bool Realign = false) const;
+};
+
+/// Target specific hooks for defining how a type should be passed or returned
+/// from functions with one of the Swift calling conventions.
+class SwiftABIInfo {
+protected:
+ CodeGenTypes &CGT;
+ bool SwiftErrorInRegister;
+
+public:
+ SwiftABIInfo(CodeGen::CodeGenTypes &CGT, bool SwiftErrorInRegister)
+ : CGT(CGT), SwiftErrorInRegister(SwiftErrorInRegister) {}
+
+ virtual ~SwiftABIInfo();
+
+ /// Returns true if an aggregate which expands to the given type sequence
+ /// should be passed / returned indirectly.
+ virtual bool shouldPassIndirectly(ArrayRef<llvm::Type *> ComponentTys,
+ bool AsReturnValue) const;
+
+ /// Returns true if the given vector type is legal from Swift's calling
+ /// convention perspective.
+ virtual bool isLegalVectorType(CharUnits VectorSize, llvm::Type *EltTy,
+ unsigned NumElts) const;
+
+ /// Returns true if swifterror is lowered to a register by the target ABI.
+ bool isSwiftErrorInRegister() const { return SwiftErrorInRegister; };
+};
+} // end namespace CodeGen
+} // end namespace clang
#endif