Skip to content

Instantly share code, notes, and snippets.

@colemancda
Created March 6, 2022 03:34
Show Gist options
  • Save colemancda/47fdb34616d10d45490a87fa2305a48d to your computer and use it in GitHub Desktop.
Save colemancda/47fdb34616d10d45490a87fa2305a48d to your computer and use it in GitHub Desktop.
LLVM 5.5.3 patched for MIPS
diff --git a/clang/lib/CodeGen/TargetInfo.cpp b/clang/lib/CodeGen/TargetInfo.cpp
index c6d8942208e8..0840ea48bba4 100644
--- a/clang/lib/CodeGen/TargetInfo.cpp
+++ b/clang/lib/CodeGen/TargetInfo.cpp
@@ -7624,7 +7624,7 @@ void MSP430TargetCodeGenInfo::setTargetAttributes(
//===----------------------------------------------------------------------===//
namespace {
-class MipsABIInfo : public ABIInfo {
+class MipsABIInfo : public SwiftABIInfo {
bool IsO32;
unsigned MinABIStackAlignInBytes, StackAlignInBytes;
void CoerceToIntArgs(uint64_t TySize,
@@ -7634,7 +7634,7 @@ class MipsABIInfo : public ABIInfo {
llvm::Type* getPaddingType(uint64_t Align, uint64_t Offset) const;
public:
MipsABIInfo(CodeGenTypes &CGT, bool _IsO32) :
- ABIInfo(CGT), IsO32(_IsO32), MinABIStackAlignInBytes(IsO32 ? 4 : 8),
+ SwiftABIInfo(CGT), IsO32(_IsO32), MinABIStackAlignInBytes(IsO32 ? 4 : 8),
StackAlignInBytes(IsO32 ? 8 : 16) {}
ABIArgInfo classifyReturnType(QualType RetTy) const;
@@ -7643,6 +7643,15 @@ public:
Address EmitVAArg(CodeGenFunction &CGF, Address VAListAddr,
QualType Ty) const override;
ABIArgInfo extendType(QualType Ty) const;
+private:
+ bool shouldPassIndirectlyForSwift(ArrayRef<llvm::Type*> scalars,
+ bool asReturnValue) const override {
+ return occupiesMoreThan(CGT, scalars, /*total*/ 4);
+ }
+
+ bool isSwiftErrorInRegister() const override {
+ return false;
+ }
};
class MIPSTargetCodeGenInfo : public TargetCodeGenInfo {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment