forked from OSchip/llvm-project
Remove some accidentaly duplicated code. This needs urgent cleanup :(
llvm-svn: 172248
This commit is contained in:
parent
d1a46f23b4
commit
fb3c009b52
|
@ -33,226 +33,6 @@
|
|||
#include <cctype>
|
||||
using namespace llvm;
|
||||
|
||||
/// getFPEXT - Return the FPEXT_*_* value for the given types, or
|
||||
/// UNKNOWN_LIBCALL if there is none.
|
||||
RTLIB::Libcall RTLIB::getFPEXT(EVT OpVT, EVT RetVT) {
|
||||
if (OpVT == MVT::f32) {
|
||||
if (RetVT == MVT::f64)
|
||||
return FPEXT_F32_F64;
|
||||
if (RetVT == MVT::f128)
|
||||
return FPEXT_F32_F128;
|
||||
} else if (OpVT == MVT::f64) {
|
||||
if (RetVT == MVT::f128)
|
||||
return FPEXT_F64_F128;
|
||||
}
|
||||
|
||||
return UNKNOWN_LIBCALL;
|
||||
}
|
||||
|
||||
/// getFPROUND - Return the FPROUND_*_* value for the given types, or
|
||||
/// UNKNOWN_LIBCALL if there is none.
|
||||
RTLIB::Libcall RTLIB::getFPROUND(EVT OpVT, EVT RetVT) {
|
||||
if (RetVT == MVT::f32) {
|
||||
if (OpVT == MVT::f64)
|
||||
return FPROUND_F64_F32;
|
||||
if (OpVT == MVT::f80)
|
||||
return FPROUND_F80_F32;
|
||||
if (OpVT == MVT::f128)
|
||||
return FPROUND_F128_F32;
|
||||
if (OpVT == MVT::ppcf128)
|
||||
return FPROUND_PPCF128_F32;
|
||||
} else if (RetVT == MVT::f64) {
|
||||
if (OpVT == MVT::f80)
|
||||
return FPROUND_F80_F64;
|
||||
if (OpVT == MVT::f128)
|
||||
return FPROUND_F128_F64;
|
||||
if (OpVT == MVT::ppcf128)
|
||||
return FPROUND_PPCF128_F64;
|
||||
}
|
||||
|
||||
return UNKNOWN_LIBCALL;
|
||||
}
|
||||
|
||||
/// getFPTOSINT - Return the FPTOSINT_*_* value for the given types, or
|
||||
/// UNKNOWN_LIBCALL if there is none.
|
||||
RTLIB::Libcall RTLIB::getFPTOSINT(EVT OpVT, EVT RetVT) {
|
||||
if (OpVT == MVT::f32) {
|
||||
if (RetVT == MVT::i8)
|
||||
return FPTOSINT_F32_I8;
|
||||
if (RetVT == MVT::i16)
|
||||
return FPTOSINT_F32_I16;
|
||||
if (RetVT == MVT::i32)
|
||||
return FPTOSINT_F32_I32;
|
||||
if (RetVT == MVT::i64)
|
||||
return FPTOSINT_F32_I64;
|
||||
if (RetVT == MVT::i128)
|
||||
return FPTOSINT_F32_I128;
|
||||
} else if (OpVT == MVT::f64) {
|
||||
if (RetVT == MVT::i8)
|
||||
return FPTOSINT_F64_I8;
|
||||
if (RetVT == MVT::i16)
|
||||
return FPTOSINT_F64_I16;
|
||||
if (RetVT == MVT::i32)
|
||||
return FPTOSINT_F64_I32;
|
||||
if (RetVT == MVT::i64)
|
||||
return FPTOSINT_F64_I64;
|
||||
if (RetVT == MVT::i128)
|
||||
return FPTOSINT_F64_I128;
|
||||
} else if (OpVT == MVT::f80) {
|
||||
if (RetVT == MVT::i32)
|
||||
return FPTOSINT_F80_I32;
|
||||
if (RetVT == MVT::i64)
|
||||
return FPTOSINT_F80_I64;
|
||||
if (RetVT == MVT::i128)
|
||||
return FPTOSINT_F80_I128;
|
||||
} else if (OpVT == MVT::f128) {
|
||||
if (RetVT == MVT::i32)
|
||||
return FPTOSINT_F128_I32;
|
||||
if (RetVT == MVT::i64)
|
||||
return FPTOSINT_F128_I64;
|
||||
if (RetVT == MVT::i128)
|
||||
return FPTOSINT_F128_I128;
|
||||
} else if (OpVT == MVT::ppcf128) {
|
||||
if (RetVT == MVT::i32)
|
||||
return FPTOSINT_PPCF128_I32;
|
||||
if (RetVT == MVT::i64)
|
||||
return FPTOSINT_PPCF128_I64;
|
||||
if (RetVT == MVT::i128)
|
||||
return FPTOSINT_PPCF128_I128;
|
||||
}
|
||||
return UNKNOWN_LIBCALL;
|
||||
}
|
||||
|
||||
/// getFPTOUINT - Return the FPTOUINT_*_* value for the given types, or
|
||||
/// UNKNOWN_LIBCALL if there is none.
|
||||
RTLIB::Libcall RTLIB::getFPTOUINT(EVT OpVT, EVT RetVT) {
|
||||
if (OpVT == MVT::f32) {
|
||||
if (RetVT == MVT::i8)
|
||||
return FPTOUINT_F32_I8;
|
||||
if (RetVT == MVT::i16)
|
||||
return FPTOUINT_F32_I16;
|
||||
if (RetVT == MVT::i32)
|
||||
return FPTOUINT_F32_I32;
|
||||
if (RetVT == MVT::i64)
|
||||
return FPTOUINT_F32_I64;
|
||||
if (RetVT == MVT::i128)
|
||||
return FPTOUINT_F32_I128;
|
||||
} else if (OpVT == MVT::f64) {
|
||||
if (RetVT == MVT::i8)
|
||||
return FPTOUINT_F64_I8;
|
||||
if (RetVT == MVT::i16)
|
||||
return FPTOUINT_F64_I16;
|
||||
if (RetVT == MVT::i32)
|
||||
return FPTOUINT_F64_I32;
|
||||
if (RetVT == MVT::i64)
|
||||
return FPTOUINT_F64_I64;
|
||||
if (RetVT == MVT::i128)
|
||||
return FPTOUINT_F64_I128;
|
||||
} else if (OpVT == MVT::f80) {
|
||||
if (RetVT == MVT::i32)
|
||||
return FPTOUINT_F80_I32;
|
||||
if (RetVT == MVT::i64)
|
||||
return FPTOUINT_F80_I64;
|
||||
if (RetVT == MVT::i128)
|
||||
return FPTOUINT_F80_I128;
|
||||
} else if (OpVT == MVT::f128) {
|
||||
if (RetVT == MVT::i32)
|
||||
return FPTOUINT_F128_I32;
|
||||
if (RetVT == MVT::i64)
|
||||
return FPTOUINT_F128_I64;
|
||||
if (RetVT == MVT::i128)
|
||||
return FPTOUINT_F128_I128;
|
||||
} else if (OpVT == MVT::ppcf128) {
|
||||
if (RetVT == MVT::i32)
|
||||
return FPTOUINT_PPCF128_I32;
|
||||
if (RetVT == MVT::i64)
|
||||
return FPTOUINT_PPCF128_I64;
|
||||
if (RetVT == MVT::i128)
|
||||
return FPTOUINT_PPCF128_I128;
|
||||
}
|
||||
return UNKNOWN_LIBCALL;
|
||||
}
|
||||
|
||||
/// getSINTTOFP - Return the SINTTOFP_*_* value for the given types, or
|
||||
/// UNKNOWN_LIBCALL if there is none.
|
||||
RTLIB::Libcall RTLIB::getSINTTOFP(EVT OpVT, EVT RetVT) {
|
||||
if (OpVT == MVT::i32) {
|
||||
if (RetVT == MVT::f32)
|
||||
return SINTTOFP_I32_F32;
|
||||
if (RetVT == MVT::f64)
|
||||
return SINTTOFP_I32_F64;
|
||||
if (RetVT == MVT::f80)
|
||||
return SINTTOFP_I32_F80;
|
||||
if (RetVT == MVT::f128)
|
||||
return SINTTOFP_I32_F128;
|
||||
if (RetVT == MVT::ppcf128)
|
||||
return SINTTOFP_I32_PPCF128;
|
||||
} else if (OpVT == MVT::i64) {
|
||||
if (RetVT == MVT::f32)
|
||||
return SINTTOFP_I64_F32;
|
||||
if (RetVT == MVT::f64)
|
||||
return SINTTOFP_I64_F64;
|
||||
if (RetVT == MVT::f80)
|
||||
return SINTTOFP_I64_F80;
|
||||
if (RetVT == MVT::f128)
|
||||
return SINTTOFP_I64_F128;
|
||||
if (RetVT == MVT::ppcf128)
|
||||
return SINTTOFP_I64_PPCF128;
|
||||
} else if (OpVT == MVT::i128) {
|
||||
if (RetVT == MVT::f32)
|
||||
return SINTTOFP_I128_F32;
|
||||
if (RetVT == MVT::f64)
|
||||
return SINTTOFP_I128_F64;
|
||||
if (RetVT == MVT::f80)
|
||||
return SINTTOFP_I128_F80;
|
||||
if (RetVT == MVT::f128)
|
||||
return SINTTOFP_I128_F128;
|
||||
if (RetVT == MVT::ppcf128)
|
||||
return SINTTOFP_I128_PPCF128;
|
||||
}
|
||||
return UNKNOWN_LIBCALL;
|
||||
}
|
||||
|
||||
/// getUINTTOFP - Return the UINTTOFP_*_* value for the given types, or
|
||||
/// UNKNOWN_LIBCALL if there is none.
|
||||
RTLIB::Libcall RTLIB::getUINTTOFP(EVT OpVT, EVT RetVT) {
|
||||
if (OpVT == MVT::i32) {
|
||||
if (RetVT == MVT::f32)
|
||||
return UINTTOFP_I32_F32;
|
||||
if (RetVT == MVT::f64)
|
||||
return UINTTOFP_I32_F64;
|
||||
if (RetVT == MVT::f80)
|
||||
return UINTTOFP_I32_F80;
|
||||
if (RetVT == MVT::f128)
|
||||
return UINTTOFP_I32_F128;
|
||||
if (RetVT == MVT::ppcf128)
|
||||
return UINTTOFP_I32_PPCF128;
|
||||
} else if (OpVT == MVT::i64) {
|
||||
if (RetVT == MVT::f32)
|
||||
return UINTTOFP_I64_F32;
|
||||
if (RetVT == MVT::f64)
|
||||
return UINTTOFP_I64_F64;
|
||||
if (RetVT == MVT::f80)
|
||||
return UINTTOFP_I64_F80;
|
||||
if (RetVT == MVT::f128)
|
||||
return UINTTOFP_I64_F128;
|
||||
if (RetVT == MVT::ppcf128)
|
||||
return UINTTOFP_I64_PPCF128;
|
||||
} else if (OpVT == MVT::i128) {
|
||||
if (RetVT == MVT::f32)
|
||||
return UINTTOFP_I128_F32;
|
||||
if (RetVT == MVT::f64)
|
||||
return UINTTOFP_I128_F64;
|
||||
if (RetVT == MVT::f80)
|
||||
return UINTTOFP_I128_F80;
|
||||
if (RetVT == MVT::f128)
|
||||
return UINTTOFP_I128_F128;
|
||||
if (RetVT == MVT::ppcf128)
|
||||
return UINTTOFP_I128_PPCF128;
|
||||
}
|
||||
return UNKNOWN_LIBCALL;
|
||||
}
|
||||
|
||||
/// NOTE: The constructor takes ownership of TLOF.
|
||||
TargetLowering::TargetLowering(const TargetMachine &tm,
|
||||
const TargetLoweringObjectFile *tlof)
|
||||
|
@ -417,56 +197,6 @@ void TargetLowering::softenSetCCOperands(SelectionDAG &DAG, EVT VT,
|
|||
}
|
||||
}
|
||||
|
||||
/// Get the EVTs and ArgFlags collections that represent the legalized return
|
||||
/// type of the given function. This does not require a DAG or a return value,
|
||||
/// and is suitable for use before any DAGs for the function are constructed.
|
||||
/// TODO: Move this out of TargetLowering.cpp.
|
||||
void llvm::GetReturnInfo(Type* ReturnType, AttributeSet attr,
|
||||
SmallVectorImpl<ISD::OutputArg> &Outs,
|
||||
const TargetLowering &TLI) {
|
||||
SmallVector<EVT, 4> ValueVTs;
|
||||
ComputeValueVTs(TLI, ReturnType, ValueVTs);
|
||||
unsigned NumValues = ValueVTs.size();
|
||||
if (NumValues == 0) return;
|
||||
|
||||
for (unsigned j = 0, f = NumValues; j != f; ++j) {
|
||||
EVT VT = ValueVTs[j];
|
||||
ISD::NodeType ExtendKind = ISD::ANY_EXTEND;
|
||||
|
||||
if (attr.hasAttribute(AttributeSet::ReturnIndex, Attribute::SExt))
|
||||
ExtendKind = ISD::SIGN_EXTEND;
|
||||
else if (attr.hasAttribute(AttributeSet::ReturnIndex, Attribute::ZExt))
|
||||
ExtendKind = ISD::ZERO_EXTEND;
|
||||
|
||||
// FIXME: C calling convention requires the return type to be promoted to
|
||||
// at least 32-bit. But this is not necessary for non-C calling
|
||||
// conventions. The frontend should mark functions whose return values
|
||||
// require promoting with signext or zeroext attributes.
|
||||
if (ExtendKind != ISD::ANY_EXTEND && VT.isInteger()) {
|
||||
MVT MinVT = TLI.getRegisterType(ReturnType->getContext(), MVT::i32);
|
||||
if (VT.bitsLT(MinVT))
|
||||
VT = MinVT;
|
||||
}
|
||||
|
||||
unsigned NumParts = TLI.getNumRegisters(ReturnType->getContext(), VT);
|
||||
MVT PartVT = TLI.getRegisterType(ReturnType->getContext(), VT);
|
||||
|
||||
// 'inreg' on function refers to return value
|
||||
ISD::ArgFlagsTy Flags = ISD::ArgFlagsTy();
|
||||
if (attr.hasAttribute(AttributeSet::ReturnIndex, Attribute::InReg))
|
||||
Flags.setInReg();
|
||||
|
||||
// Propagate extension type if any
|
||||
if (attr.hasAttribute(AttributeSet::ReturnIndex, Attribute::SExt))
|
||||
Flags.setSExt();
|
||||
else if (attr.hasAttribute(AttributeSet::ReturnIndex, Attribute::ZExt))
|
||||
Flags.setZExt();
|
||||
|
||||
for (unsigned i = 0; i < NumParts; ++i)
|
||||
Outs.push_back(ISD::OutputArg(Flags, PartVT, /*isFixed=*/true, 0, 0));
|
||||
}
|
||||
}
|
||||
|
||||
/// getJumpTableEncoding - Return the entry encoding for a jump table in the
|
||||
/// current function. The returned value is a member of the
|
||||
/// MachineJumpTableInfo::JTEntryKind enum.
|
||||
|
|
Loading…
Reference in New Issue