forked from OSchip/llvm-project
parent
20662e39f1
commit
dc74520432
|
@ -796,7 +796,7 @@ class X86_32ABIInfo : public ABIInfo {
|
|||
static const unsigned MinABIStackAlignInBytes = 4;
|
||||
|
||||
bool IsDarwinVectorABI;
|
||||
bool IsSmallStructInRegABI;
|
||||
bool IsRetSmallStructInRegABI;
|
||||
bool IsWin32StructABI;
|
||||
unsigned DefaultNumRegisterParameters;
|
||||
|
||||
|
@ -845,17 +845,23 @@ public:
|
|||
Address EmitVAArg(CodeGenFunction &CGF, Address VAListAddr,
|
||||
QualType Ty) const override;
|
||||
|
||||
X86_32ABIInfo(CodeGen::CodeGenTypes &CGT, bool d, bool p, bool w,
|
||||
unsigned r)
|
||||
: ABIInfo(CGT), IsDarwinVectorABI(d), IsSmallStructInRegABI(p),
|
||||
IsWin32StructABI(w), DefaultNumRegisterParameters(r) {}
|
||||
X86_32ABIInfo(CodeGen::CodeGenTypes &CGT, bool DarwinVectorABI,
|
||||
bool RetSmallStructInRegABI, bool Win32StructABI,
|
||||
unsigned NumRegisterParameters)
|
||||
: ABIInfo(CGT), IsDarwinVectorABI(DarwinVectorABI),
|
||||
IsRetSmallStructInRegABI(RetSmallStructInRegABI),
|
||||
IsWin32StructABI(Win32StructABI),
|
||||
DefaultNumRegisterParameters(NumRegisterParameters) {}
|
||||
};
|
||||
|
||||
class X86_32TargetCodeGenInfo : public TargetCodeGenInfo {
|
||||
public:
|
||||
X86_32TargetCodeGenInfo(CodeGen::CodeGenTypes &CGT,
|
||||
bool d, bool p, bool w, unsigned r)
|
||||
:TargetCodeGenInfo(new X86_32ABIInfo(CGT, d, p, w, r)) {}
|
||||
X86_32TargetCodeGenInfo(CodeGen::CodeGenTypes &CGT, bool DarwinVectorABI,
|
||||
bool RetSmallStructInRegABI, bool Win32StructABI,
|
||||
unsigned NumRegisterParameters)
|
||||
: TargetCodeGenInfo(
|
||||
new X86_32ABIInfo(CGT, DarwinVectorABI, RetSmallStructInRegABI,
|
||||
Win32StructABI, NumRegisterParameters)) {}
|
||||
|
||||
static bool isStructReturnInRegABI(
|
||||
const llvm::Triple &Triple, const CodeGenOptions &Opts);
|
||||
|
@ -978,7 +984,7 @@ void X86_32TargetCodeGenInfo::addReturnRegisterOutputs(
|
|||
}
|
||||
|
||||
/// shouldReturnTypeInRegister - Determine if the given type should be
|
||||
/// passed in a register (for the Darwin ABI).
|
||||
/// returned in a register (for the Darwin ABI).
|
||||
bool X86_32ABIInfo::shouldReturnTypeInRegister(QualType Ty,
|
||||
ASTContext &Context) const {
|
||||
uint64_t Size = Context.getTypeSize(Ty);
|
||||
|
@ -1083,7 +1089,7 @@ ABIArgInfo X86_32ABIInfo::classifyReturnType(QualType RetTy,
|
|||
}
|
||||
|
||||
// If specified, structs and unions are always indirect.
|
||||
if (!IsSmallStructInRegABI && !RetTy->isAnyComplexType())
|
||||
if (!IsRetSmallStructInRegABI && !RetTy->isAnyComplexType())
|
||||
return getIndirectReturnResult(RetTy, State);
|
||||
|
||||
// Small structures which are register sized are generally returned
|
||||
|
@ -1876,8 +1882,10 @@ static std::string qualifyWindowsLibrary(llvm::StringRef Lib) {
|
|||
class WinX86_32TargetCodeGenInfo : public X86_32TargetCodeGenInfo {
|
||||
public:
|
||||
WinX86_32TargetCodeGenInfo(CodeGen::CodeGenTypes &CGT,
|
||||
bool d, bool p, bool w, unsigned RegParms)
|
||||
: X86_32TargetCodeGenInfo(CGT, d, p, w, RegParms) {}
|
||||
bool DarwinVectorABI, bool RetSmallStructInRegABI, bool Win32StructABI,
|
||||
unsigned NumRegisterParameters)
|
||||
: X86_32TargetCodeGenInfo(CGT, DarwinVectorABI, RetSmallStructInRegABI,
|
||||
Win32StructABI, NumRegisterParameters) {}
|
||||
|
||||
void setTargetAttributes(const Decl *D, llvm::GlobalValue *GV,
|
||||
CodeGen::CodeGenModule &CGM) const override;
|
||||
|
@ -7378,17 +7386,17 @@ const TargetCodeGenInfo &CodeGenModule::getTargetCodeGenInfo() {
|
|||
|
||||
case llvm::Triple::x86: {
|
||||
bool IsDarwinVectorABI = Triple.isOSDarwin();
|
||||
bool IsSmallStructInRegABI =
|
||||
bool RetSmallStructInRegABI =
|
||||
X86_32TargetCodeGenInfo::isStructReturnInRegABI(Triple, CodeGenOpts);
|
||||
bool IsWin32FloatStructABI = Triple.isOSWindows() && !Triple.isOSCygMing();
|
||||
|
||||
if (Triple.getOS() == llvm::Triple::Win32) {
|
||||
return *(TheTargetCodeGenInfo = new WinX86_32TargetCodeGenInfo(
|
||||
Types, IsDarwinVectorABI, IsSmallStructInRegABI,
|
||||
Types, IsDarwinVectorABI, RetSmallStructInRegABI,
|
||||
IsWin32FloatStructABI, CodeGenOpts.NumRegisterParameters));
|
||||
} else {
|
||||
return *(TheTargetCodeGenInfo = new X86_32TargetCodeGenInfo(
|
||||
Types, IsDarwinVectorABI, IsSmallStructInRegABI,
|
||||
Types, IsDarwinVectorABI, RetSmallStructInRegABI,
|
||||
IsWin32FloatStructABI, CodeGenOpts.NumRegisterParameters));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue