2014-11-07 22:24:31 +08:00
|
|
|
//===---- MipsCCState.h - CCState with Mips specific extensions -----------===//
|
|
|
|
//
|
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
|
2014-11-07 22:24:31 +08:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#ifndef MIPSCCSTATE_H
|
|
|
|
#define MIPSCCSTATE_H
|
|
|
|
|
2015-01-14 19:23:27 +08:00
|
|
|
#include "MipsISelLowering.h"
|
2014-11-07 22:24:31 +08:00
|
|
|
#include "llvm/ADT/SmallVector.h"
|
|
|
|
#include "llvm/CodeGen/CallingConvLower.h"
|
|
|
|
|
|
|
|
namespace llvm {
|
|
|
|
class SDNode;
|
|
|
|
class MipsSubtarget;
|
|
|
|
|
|
|
|
class MipsCCState : public CCState {
|
|
|
|
public:
|
|
|
|
enum SpecialCallingConvType { Mips16RetHelperConv, NoSpecialCallingConv };
|
|
|
|
|
|
|
|
/// Determine the SpecialCallingConvType for the given callee
|
|
|
|
static SpecialCallingConvType
|
|
|
|
getSpecialCallingConvForCallee(const SDNode *Callee,
|
|
|
|
const MipsSubtarget &Subtarget);
|
|
|
|
|
|
|
|
private:
|
|
|
|
/// Identify lowered values that originated from f128 arguments and record
|
|
|
|
/// this for use by RetCC_MipsN.
|
|
|
|
void PreAnalyzeCallResultForF128(const SmallVectorImpl<ISD::InputArg> &Ins,
|
2017-04-26 19:10:38 +08:00
|
|
|
const Type *RetTy, const char * Func);
|
2014-11-07 22:24:31 +08:00
|
|
|
|
|
|
|
/// Identify lowered values that originated from f128 arguments and record
|
|
|
|
/// this for use by RetCC_MipsN.
|
|
|
|
void PreAnalyzeReturnForF128(const SmallVectorImpl<ISD::OutputArg> &Outs);
|
|
|
|
|
|
|
|
/// Identify lowered values that originated from f128 arguments and record
|
|
|
|
/// this.
|
|
|
|
void
|
|
|
|
PreAnalyzeCallOperands(const SmallVectorImpl<ISD::OutputArg> &Outs,
|
|
|
|
std::vector<TargetLowering::ArgListEntry> &FuncArgs,
|
2017-04-26 19:10:38 +08:00
|
|
|
const char *Func);
|
2014-11-07 22:24:31 +08:00
|
|
|
|
|
|
|
/// Identify lowered values that originated from f128 arguments and record
|
Reland "[SelectionDAG] Enable target specific vector scalarization of calls and returns"
By target hookifying getRegisterType, getNumRegisters, getVectorBreakdown,
backends can request that LLVM to scalarize vector types for calls
and returns.
The MIPS vector ABI requires that vector arguments and returns are passed in
integer registers. With SelectionDAG's new hooks, the MIPS backend can now
handle LLVM-IR with vector types in calls and returns. E.g.
'call @foo(<4 x i32> %4)'.
Previously these cases would be scalarized for the MIPS O32/N32/N64 ABI for
calls and returns if vector types were not legal. If vector types were legal,
a single 128bit vector argument would be assigned to a single 32 bit / 64 bit
integer register.
By teaching the MIPS backend to inspect the original types, it can now
implement the MIPS vector ABI which requires a particular method of
scalarizing vectors.
Previously, the MIPS backend relied on clang to scalarize types such as "call
@foo(<4 x float> %a) into "call @foo(i32 inreg %1, i32 inreg %2, i32 inreg %3,
i32 inreg %4)".
This patch enables the MIPS backend to take either form for vector types.
The previous version of this patch had a "conditional move or jump depends on
uninitialized value".
Reviewers: zoran.jovanovic, jaydeep, vkalintiris, slthakur
Differential Revision: https://reviews.llvm.org/D27845
llvm-svn: 305083
2017-06-09 22:37:08 +08:00
|
|
|
/// this for use by RetCC_MipsN.
|
2014-11-07 22:24:31 +08:00
|
|
|
void
|
|
|
|
PreAnalyzeFormalArgumentsForF128(const SmallVectorImpl<ISD::InputArg> &Ins);
|
|
|
|
|
Reland "[SelectionDAG] Enable target specific vector scalarization of calls and returns"
By target hookifying getRegisterType, getNumRegisters, getVectorBreakdown,
backends can request that LLVM to scalarize vector types for calls
and returns.
The MIPS vector ABI requires that vector arguments and returns are passed in
integer registers. With SelectionDAG's new hooks, the MIPS backend can now
handle LLVM-IR with vector types in calls and returns. E.g.
'call @foo(<4 x i32> %4)'.
Previously these cases would be scalarized for the MIPS O32/N32/N64 ABI for
calls and returns if vector types were not legal. If vector types were legal,
a single 128bit vector argument would be assigned to a single 32 bit / 64 bit
integer register.
By teaching the MIPS backend to inspect the original types, it can now
implement the MIPS vector ABI which requires a particular method of
scalarizing vectors.
Previously, the MIPS backend relied on clang to scalarize types such as "call
@foo(<4 x float> %a) into "call @foo(i32 inreg %1, i32 inreg %2, i32 inreg %3,
i32 inreg %4)".
This patch enables the MIPS backend to take either form for vector types.
The previous version of this patch had a "conditional move or jump depends on
uninitialized value".
Reviewers: zoran.jovanovic, jaydeep, vkalintiris, slthakur
Differential Revision: https://reviews.llvm.org/D27845
llvm-svn: 305083
2017-06-09 22:37:08 +08:00
|
|
|
void
|
|
|
|
PreAnalyzeCallResultForVectorFloat(const SmallVectorImpl<ISD::InputArg> &Ins,
|
|
|
|
const Type *RetTy);
|
|
|
|
|
|
|
|
void PreAnalyzeFormalArgumentsForVectorFloat(
|
|
|
|
const SmallVectorImpl<ISD::InputArg> &Ins);
|
|
|
|
|
|
|
|
void
|
|
|
|
PreAnalyzeReturnForVectorFloat(const SmallVectorImpl<ISD::OutputArg> &Outs);
|
|
|
|
|
2014-11-07 22:24:31 +08:00
|
|
|
/// Records whether the value has been lowered from an f128.
|
|
|
|
SmallVector<bool, 4> OriginalArgWasF128;
|
|
|
|
|
2014-11-08 00:54:21 +08:00
|
|
|
/// Records whether the value has been lowered from float.
|
|
|
|
SmallVector<bool, 4> OriginalArgWasFloat;
|
|
|
|
|
Reland "[SelectionDAG] Enable target specific vector scalarization of calls and returns"
By target hookifying getRegisterType, getNumRegisters, getVectorBreakdown,
backends can request that LLVM to scalarize vector types for calls
and returns.
The MIPS vector ABI requires that vector arguments and returns are passed in
integer registers. With SelectionDAG's new hooks, the MIPS backend can now
handle LLVM-IR with vector types in calls and returns. E.g.
'call @foo(<4 x i32> %4)'.
Previously these cases would be scalarized for the MIPS O32/N32/N64 ABI for
calls and returns if vector types were not legal. If vector types were legal,
a single 128bit vector argument would be assigned to a single 32 bit / 64 bit
integer register.
By teaching the MIPS backend to inspect the original types, it can now
implement the MIPS vector ABI which requires a particular method of
scalarizing vectors.
Previously, the MIPS backend relied on clang to scalarize types such as "call
@foo(<4 x float> %a) into "call @foo(i32 inreg %1, i32 inreg %2, i32 inreg %3,
i32 inreg %4)".
This patch enables the MIPS backend to take either form for vector types.
The previous version of this patch had a "conditional move or jump depends on
uninitialized value".
Reviewers: zoran.jovanovic, jaydeep, vkalintiris, slthakur
Differential Revision: https://reviews.llvm.org/D27845
llvm-svn: 305083
2017-06-09 22:37:08 +08:00
|
|
|
/// Records whether the value has been lowered from a floating point vector.
|
|
|
|
SmallVector<bool, 4> OriginalArgWasFloatVector;
|
|
|
|
|
|
|
|
/// Records whether the return value has been lowered from a floating point
|
|
|
|
/// vector.
|
|
|
|
SmallVector<bool, 4> OriginalRetWasFloatVector;
|
|
|
|
|
2014-11-07 22:24:31 +08:00
|
|
|
/// Records whether the value was a fixed argument.
|
|
|
|
/// See ISD::OutputArg::IsFixed,
|
|
|
|
SmallVector<bool, 4> CallOperandIsFixed;
|
|
|
|
|
|
|
|
// Used to handle MIPS16-specific calling convention tweaks.
|
|
|
|
// FIXME: This should probably be a fully fledged calling convention.
|
|
|
|
SpecialCallingConvType SpecialCallingConv;
|
|
|
|
|
|
|
|
public:
|
|
|
|
MipsCCState(CallingConv::ID CC, bool isVarArg, MachineFunction &MF,
|
|
|
|
SmallVectorImpl<CCValAssign> &locs, LLVMContext &C,
|
|
|
|
SpecialCallingConvType SpecialCC = NoSpecialCallingConv)
|
|
|
|
: CCState(CC, isVarArg, MF, locs, C), SpecialCallingConv(SpecialCC) {}
|
|
|
|
|
|
|
|
void
|
|
|
|
AnalyzeCallOperands(const SmallVectorImpl<ISD::OutputArg> &Outs,
|
|
|
|
CCAssignFn Fn,
|
|
|
|
std::vector<TargetLowering::ArgListEntry> &FuncArgs,
|
2017-04-26 19:10:38 +08:00
|
|
|
const char *Func) {
|
|
|
|
PreAnalyzeCallOperands(Outs, FuncArgs, Func);
|
2014-11-07 22:24:31 +08:00
|
|
|
CCState::AnalyzeCallOperands(Outs, Fn);
|
|
|
|
OriginalArgWasF128.clear();
|
2014-11-08 00:54:21 +08:00
|
|
|
OriginalArgWasFloat.clear();
|
Reland "[SelectionDAG] Enable target specific vector scalarization of calls and returns"
By target hookifying getRegisterType, getNumRegisters, getVectorBreakdown,
backends can request that LLVM to scalarize vector types for calls
and returns.
The MIPS vector ABI requires that vector arguments and returns are passed in
integer registers. With SelectionDAG's new hooks, the MIPS backend can now
handle LLVM-IR with vector types in calls and returns. E.g.
'call @foo(<4 x i32> %4)'.
Previously these cases would be scalarized for the MIPS O32/N32/N64 ABI for
calls and returns if vector types were not legal. If vector types were legal,
a single 128bit vector argument would be assigned to a single 32 bit / 64 bit
integer register.
By teaching the MIPS backend to inspect the original types, it can now
implement the MIPS vector ABI which requires a particular method of
scalarizing vectors.
Previously, the MIPS backend relied on clang to scalarize types such as "call
@foo(<4 x float> %a) into "call @foo(i32 inreg %1, i32 inreg %2, i32 inreg %3,
i32 inreg %4)".
This patch enables the MIPS backend to take either form for vector types.
The previous version of this patch had a "conditional move or jump depends on
uninitialized value".
Reviewers: zoran.jovanovic, jaydeep, vkalintiris, slthakur
Differential Revision: https://reviews.llvm.org/D27845
llvm-svn: 305083
2017-06-09 22:37:08 +08:00
|
|
|
OriginalArgWasFloatVector.clear();
|
2014-11-07 22:24:31 +08:00
|
|
|
CallOperandIsFixed.clear();
|
|
|
|
}
|
|
|
|
|
|
|
|
// The AnalyzeCallOperands in the base class is not usable since we must
|
|
|
|
// provide a means of accessing ArgListEntry::IsFixed. Delete them from this
|
|
|
|
// class. This doesn't stop them being used via the base class though.
|
|
|
|
void AnalyzeCallOperands(const SmallVectorImpl<ISD::OutputArg> &Outs,
|
2015-02-16 06:54:22 +08:00
|
|
|
CCAssignFn Fn) = delete;
|
2014-11-07 22:24:31 +08:00
|
|
|
void AnalyzeCallOperands(const SmallVectorImpl<MVT> &Outs,
|
|
|
|
SmallVectorImpl<ISD::ArgFlagsTy> &Flags,
|
2015-02-16 06:54:22 +08:00
|
|
|
CCAssignFn Fn) = delete;
|
2014-11-07 22:24:31 +08:00
|
|
|
|
|
|
|
void AnalyzeFormalArguments(const SmallVectorImpl<ISD::InputArg> &Ins,
|
|
|
|
CCAssignFn Fn) {
|
|
|
|
PreAnalyzeFormalArgumentsForF128(Ins);
|
|
|
|
CCState::AnalyzeFormalArguments(Ins, Fn);
|
2014-11-08 00:54:21 +08:00
|
|
|
OriginalArgWasFloat.clear();
|
2014-11-07 22:24:31 +08:00
|
|
|
OriginalArgWasF128.clear();
|
Reland "[SelectionDAG] Enable target specific vector scalarization of calls and returns"
By target hookifying getRegisterType, getNumRegisters, getVectorBreakdown,
backends can request that LLVM to scalarize vector types for calls
and returns.
The MIPS vector ABI requires that vector arguments and returns are passed in
integer registers. With SelectionDAG's new hooks, the MIPS backend can now
handle LLVM-IR with vector types in calls and returns. E.g.
'call @foo(<4 x i32> %4)'.
Previously these cases would be scalarized for the MIPS O32/N32/N64 ABI for
calls and returns if vector types were not legal. If vector types were legal,
a single 128bit vector argument would be assigned to a single 32 bit / 64 bit
integer register.
By teaching the MIPS backend to inspect the original types, it can now
implement the MIPS vector ABI which requires a particular method of
scalarizing vectors.
Previously, the MIPS backend relied on clang to scalarize types such as "call
@foo(<4 x float> %a) into "call @foo(i32 inreg %1, i32 inreg %2, i32 inreg %3,
i32 inreg %4)".
This patch enables the MIPS backend to take either form for vector types.
The previous version of this patch had a "conditional move or jump depends on
uninitialized value".
Reviewers: zoran.jovanovic, jaydeep, vkalintiris, slthakur
Differential Revision: https://reviews.llvm.org/D27845
llvm-svn: 305083
2017-06-09 22:37:08 +08:00
|
|
|
OriginalArgWasFloatVector.clear();
|
2014-11-07 22:24:31 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void AnalyzeCallResult(const SmallVectorImpl<ISD::InputArg> &Ins,
|
2017-04-26 19:10:38 +08:00
|
|
|
CCAssignFn Fn, const Type *RetTy,
|
|
|
|
const char *Func) {
|
|
|
|
PreAnalyzeCallResultForF128(Ins, RetTy, Func);
|
Reland "[SelectionDAG] Enable target specific vector scalarization of calls and returns"
By target hookifying getRegisterType, getNumRegisters, getVectorBreakdown,
backends can request that LLVM to scalarize vector types for calls
and returns.
The MIPS vector ABI requires that vector arguments and returns are passed in
integer registers. With SelectionDAG's new hooks, the MIPS backend can now
handle LLVM-IR with vector types in calls and returns. E.g.
'call @foo(<4 x i32> %4)'.
Previously these cases would be scalarized for the MIPS O32/N32/N64 ABI for
calls and returns if vector types were not legal. If vector types were legal,
a single 128bit vector argument would be assigned to a single 32 bit / 64 bit
integer register.
By teaching the MIPS backend to inspect the original types, it can now
implement the MIPS vector ABI which requires a particular method of
scalarizing vectors.
Previously, the MIPS backend relied on clang to scalarize types such as "call
@foo(<4 x float> %a) into "call @foo(i32 inreg %1, i32 inreg %2, i32 inreg %3,
i32 inreg %4)".
This patch enables the MIPS backend to take either form for vector types.
The previous version of this patch had a "conditional move or jump depends on
uninitialized value".
Reviewers: zoran.jovanovic, jaydeep, vkalintiris, slthakur
Differential Revision: https://reviews.llvm.org/D27845
llvm-svn: 305083
2017-06-09 22:37:08 +08:00
|
|
|
PreAnalyzeCallResultForVectorFloat(Ins, RetTy);
|
2014-11-07 22:24:31 +08:00
|
|
|
CCState::AnalyzeCallResult(Ins, Fn);
|
2014-11-08 00:54:21 +08:00
|
|
|
OriginalArgWasFloat.clear();
|
2014-11-07 22:24:31 +08:00
|
|
|
OriginalArgWasF128.clear();
|
Reland "[SelectionDAG] Enable target specific vector scalarization of calls and returns"
By target hookifying getRegisterType, getNumRegisters, getVectorBreakdown,
backends can request that LLVM to scalarize vector types for calls
and returns.
The MIPS vector ABI requires that vector arguments and returns are passed in
integer registers. With SelectionDAG's new hooks, the MIPS backend can now
handle LLVM-IR with vector types in calls and returns. E.g.
'call @foo(<4 x i32> %4)'.
Previously these cases would be scalarized for the MIPS O32/N32/N64 ABI for
calls and returns if vector types were not legal. If vector types were legal,
a single 128bit vector argument would be assigned to a single 32 bit / 64 bit
integer register.
By teaching the MIPS backend to inspect the original types, it can now
implement the MIPS vector ABI which requires a particular method of
scalarizing vectors.
Previously, the MIPS backend relied on clang to scalarize types such as "call
@foo(<4 x float> %a) into "call @foo(i32 inreg %1, i32 inreg %2, i32 inreg %3,
i32 inreg %4)".
This patch enables the MIPS backend to take either form for vector types.
The previous version of this patch had a "conditional move or jump depends on
uninitialized value".
Reviewers: zoran.jovanovic, jaydeep, vkalintiris, slthakur
Differential Revision: https://reviews.llvm.org/D27845
llvm-svn: 305083
2017-06-09 22:37:08 +08:00
|
|
|
OriginalArgWasFloatVector.clear();
|
2014-11-07 22:24:31 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void AnalyzeReturn(const SmallVectorImpl<ISD::OutputArg> &Outs,
|
|
|
|
CCAssignFn Fn) {
|
|
|
|
PreAnalyzeReturnForF128(Outs);
|
Reland "[SelectionDAG] Enable target specific vector scalarization of calls and returns"
By target hookifying getRegisterType, getNumRegisters, getVectorBreakdown,
backends can request that LLVM to scalarize vector types for calls
and returns.
The MIPS vector ABI requires that vector arguments and returns are passed in
integer registers. With SelectionDAG's new hooks, the MIPS backend can now
handle LLVM-IR with vector types in calls and returns. E.g.
'call @foo(<4 x i32> %4)'.
Previously these cases would be scalarized for the MIPS O32/N32/N64 ABI for
calls and returns if vector types were not legal. If vector types were legal,
a single 128bit vector argument would be assigned to a single 32 bit / 64 bit
integer register.
By teaching the MIPS backend to inspect the original types, it can now
implement the MIPS vector ABI which requires a particular method of
scalarizing vectors.
Previously, the MIPS backend relied on clang to scalarize types such as "call
@foo(<4 x float> %a) into "call @foo(i32 inreg %1, i32 inreg %2, i32 inreg %3,
i32 inreg %4)".
This patch enables the MIPS backend to take either form for vector types.
The previous version of this patch had a "conditional move or jump depends on
uninitialized value".
Reviewers: zoran.jovanovic, jaydeep, vkalintiris, slthakur
Differential Revision: https://reviews.llvm.org/D27845
llvm-svn: 305083
2017-06-09 22:37:08 +08:00
|
|
|
PreAnalyzeReturnForVectorFloat(Outs);
|
2014-11-07 22:24:31 +08:00
|
|
|
CCState::AnalyzeReturn(Outs, Fn);
|
2014-11-08 00:54:21 +08:00
|
|
|
OriginalArgWasFloat.clear();
|
2014-11-07 22:24:31 +08:00
|
|
|
OriginalArgWasF128.clear();
|
Reland "[SelectionDAG] Enable target specific vector scalarization of calls and returns"
By target hookifying getRegisterType, getNumRegisters, getVectorBreakdown,
backends can request that LLVM to scalarize vector types for calls
and returns.
The MIPS vector ABI requires that vector arguments and returns are passed in
integer registers. With SelectionDAG's new hooks, the MIPS backend can now
handle LLVM-IR with vector types in calls and returns. E.g.
'call @foo(<4 x i32> %4)'.
Previously these cases would be scalarized for the MIPS O32/N32/N64 ABI for
calls and returns if vector types were not legal. If vector types were legal,
a single 128bit vector argument would be assigned to a single 32 bit / 64 bit
integer register.
By teaching the MIPS backend to inspect the original types, it can now
implement the MIPS vector ABI which requires a particular method of
scalarizing vectors.
Previously, the MIPS backend relied on clang to scalarize types such as "call
@foo(<4 x float> %a) into "call @foo(i32 inreg %1, i32 inreg %2, i32 inreg %3,
i32 inreg %4)".
This patch enables the MIPS backend to take either form for vector types.
The previous version of this patch had a "conditional move or jump depends on
uninitialized value".
Reviewers: zoran.jovanovic, jaydeep, vkalintiris, slthakur
Differential Revision: https://reviews.llvm.org/D27845
llvm-svn: 305083
2017-06-09 22:37:08 +08:00
|
|
|
OriginalArgWasFloatVector.clear();
|
2014-11-07 22:24:31 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
bool CheckReturn(const SmallVectorImpl<ISD::OutputArg> &ArgsFlags,
|
|
|
|
CCAssignFn Fn) {
|
|
|
|
PreAnalyzeReturnForF128(ArgsFlags);
|
Reland "[SelectionDAG] Enable target specific vector scalarization of calls and returns"
By target hookifying getRegisterType, getNumRegisters, getVectorBreakdown,
backends can request that LLVM to scalarize vector types for calls
and returns.
The MIPS vector ABI requires that vector arguments and returns are passed in
integer registers. With SelectionDAG's new hooks, the MIPS backend can now
handle LLVM-IR with vector types in calls and returns. E.g.
'call @foo(<4 x i32> %4)'.
Previously these cases would be scalarized for the MIPS O32/N32/N64 ABI for
calls and returns if vector types were not legal. If vector types were legal,
a single 128bit vector argument would be assigned to a single 32 bit / 64 bit
integer register.
By teaching the MIPS backend to inspect the original types, it can now
implement the MIPS vector ABI which requires a particular method of
scalarizing vectors.
Previously, the MIPS backend relied on clang to scalarize types such as "call
@foo(<4 x float> %a) into "call @foo(i32 inreg %1, i32 inreg %2, i32 inreg %3,
i32 inreg %4)".
This patch enables the MIPS backend to take either form for vector types.
The previous version of this patch had a "conditional move or jump depends on
uninitialized value".
Reviewers: zoran.jovanovic, jaydeep, vkalintiris, slthakur
Differential Revision: https://reviews.llvm.org/D27845
llvm-svn: 305083
2017-06-09 22:37:08 +08:00
|
|
|
PreAnalyzeReturnForVectorFloat(ArgsFlags);
|
2014-11-07 22:24:31 +08:00
|
|
|
bool Return = CCState::CheckReturn(ArgsFlags, Fn);
|
2014-11-08 00:54:21 +08:00
|
|
|
OriginalArgWasFloat.clear();
|
2014-11-07 22:24:31 +08:00
|
|
|
OriginalArgWasF128.clear();
|
Reland "[SelectionDAG] Enable target specific vector scalarization of calls and returns"
By target hookifying getRegisterType, getNumRegisters, getVectorBreakdown,
backends can request that LLVM to scalarize vector types for calls
and returns.
The MIPS vector ABI requires that vector arguments and returns are passed in
integer registers. With SelectionDAG's new hooks, the MIPS backend can now
handle LLVM-IR with vector types in calls and returns. E.g.
'call @foo(<4 x i32> %4)'.
Previously these cases would be scalarized for the MIPS O32/N32/N64 ABI for
calls and returns if vector types were not legal. If vector types were legal,
a single 128bit vector argument would be assigned to a single 32 bit / 64 bit
integer register.
By teaching the MIPS backend to inspect the original types, it can now
implement the MIPS vector ABI which requires a particular method of
scalarizing vectors.
Previously, the MIPS backend relied on clang to scalarize types such as "call
@foo(<4 x float> %a) into "call @foo(i32 inreg %1, i32 inreg %2, i32 inreg %3,
i32 inreg %4)".
This patch enables the MIPS backend to take either form for vector types.
The previous version of this patch had a "conditional move or jump depends on
uninitialized value".
Reviewers: zoran.jovanovic, jaydeep, vkalintiris, slthakur
Differential Revision: https://reviews.llvm.org/D27845
llvm-svn: 305083
2017-06-09 22:37:08 +08:00
|
|
|
OriginalArgWasFloatVector.clear();
|
2014-11-07 22:24:31 +08:00
|
|
|
return Return;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool WasOriginalArgF128(unsigned ValNo) { return OriginalArgWasF128[ValNo]; }
|
2014-11-08 00:54:21 +08:00
|
|
|
bool WasOriginalArgFloat(unsigned ValNo) {
|
|
|
|
return OriginalArgWasFloat[ValNo];
|
|
|
|
}
|
Reland "[SelectionDAG] Enable target specific vector scalarization of calls and returns"
By target hookifying getRegisterType, getNumRegisters, getVectorBreakdown,
backends can request that LLVM to scalarize vector types for calls
and returns.
The MIPS vector ABI requires that vector arguments and returns are passed in
integer registers. With SelectionDAG's new hooks, the MIPS backend can now
handle LLVM-IR with vector types in calls and returns. E.g.
'call @foo(<4 x i32> %4)'.
Previously these cases would be scalarized for the MIPS O32/N32/N64 ABI for
calls and returns if vector types were not legal. If vector types were legal,
a single 128bit vector argument would be assigned to a single 32 bit / 64 bit
integer register.
By teaching the MIPS backend to inspect the original types, it can now
implement the MIPS vector ABI which requires a particular method of
scalarizing vectors.
Previously, the MIPS backend relied on clang to scalarize types such as "call
@foo(<4 x float> %a) into "call @foo(i32 inreg %1, i32 inreg %2, i32 inreg %3,
i32 inreg %4)".
This patch enables the MIPS backend to take either form for vector types.
The previous version of this patch had a "conditional move or jump depends on
uninitialized value".
Reviewers: zoran.jovanovic, jaydeep, vkalintiris, slthakur
Differential Revision: https://reviews.llvm.org/D27845
llvm-svn: 305083
2017-06-09 22:37:08 +08:00
|
|
|
bool WasOriginalArgVectorFloat(unsigned ValNo) const {
|
|
|
|
return OriginalArgWasFloatVector[ValNo];
|
|
|
|
}
|
|
|
|
bool WasOriginalRetVectorFloat(unsigned ValNo) const {
|
|
|
|
return OriginalRetWasFloatVector[ValNo];
|
|
|
|
}
|
2014-11-07 22:24:31 +08:00
|
|
|
bool IsCallOperandFixed(unsigned ValNo) { return CallOperandIsFixed[ValNo]; }
|
|
|
|
SpecialCallingConvType getSpecialCallingConv() { return SpecialCallingConv; }
|
|
|
|
};
|
2015-06-23 17:49:53 +08:00
|
|
|
}
|
2014-11-07 22:24:31 +08:00
|
|
|
|
|
|
|
#endif
|