mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-14 11:32:34 +00:00
Enumerate SDISel formal parameter attributes. Make use of new
enumeration. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34960 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
c6551ffdd5
commit
0db79d86de
@ -31,6 +31,20 @@ namespace llvm {
|
||||
class FunctionLoweringInfo;
|
||||
class HazardRecognizer;
|
||||
|
||||
namespace SDISelParamFlags {
|
||||
enum Flags {
|
||||
NoFlagSet = 0,
|
||||
Signed = 1<<0,
|
||||
SignedOffs = 0,
|
||||
InReg = 1<<1,
|
||||
InRegOffs = 1,
|
||||
StructReturn = 1<<2,
|
||||
StructReturnOffs = 2,
|
||||
OrigAlignment = 0x1F<<27,
|
||||
OrigAlignmentOffs = 27
|
||||
};
|
||||
}
|
||||
|
||||
/// SelectionDAGISel - This is the common base class used for SelectionDAG-based
|
||||
/// pattern-matching instruction selectors.
|
||||
class SelectionDAGISel : public FunctionPass {
|
||||
|
@ -3099,22 +3099,21 @@ TargetLowering::LowerArguments(Function &F, SelectionDAG &DAG) {
|
||||
for (Function::arg_iterator I = F.arg_begin(), E = F.arg_end();
|
||||
I != E; ++I, ++j) {
|
||||
MVT::ValueType VT = getValueType(I->getType());
|
||||
bool isInReg = FTy->paramHasAttr(j, FunctionType::InRegAttribute);
|
||||
bool isSRet = FTy->paramHasAttr(j, FunctionType::StructRetAttribute);
|
||||
unsigned Flags = SDISelParamFlags::NoFlagSet;
|
||||
unsigned OriginalAlignment =
|
||||
getTargetData()->getABITypeAlignment(I->getType());
|
||||
// Flags[31:27] -> OriginalAlignment
|
||||
// Flags[2] -> isSRet
|
||||
// Flags[1] -> isInReg
|
||||
// Flags[0] -> isSigned
|
||||
unsigned Flags = (isInReg << 1) | (isSRet << 2) | (OriginalAlignment << 27);
|
||||
|
||||
// FIXME: Distinguish between a formal with no [sz]ext attribute from one
|
||||
// that is zero extended!
|
||||
if (FTy->paramHasAttr(j, FunctionType::ZExtAttribute))
|
||||
Flags |= 0;
|
||||
Flags &= ~(SDISelParamFlags::Signed);
|
||||
if (FTy->paramHasAttr(j, FunctionType::SExtAttribute))
|
||||
Flags |= 1;
|
||||
Flags |= SDISelParamFlags::Signed;
|
||||
if (FTy->paramHasAttr(j, FunctionType::InRegAttribute))
|
||||
Flags |= SDISelParamFlags::InReg;
|
||||
if (FTy->paramHasAttr(j, FunctionType::StructRetAttribute))
|
||||
Flags |= SDISelParamFlags::StructReturn;
|
||||
Flags |= (OriginalAlignment << SDISelParamFlags::OrigAlignmentOffs);
|
||||
|
||||
switch (getTypeAction(VT)) {
|
||||
default: assert(0 && "Unknown type action!");
|
||||
@ -3136,7 +3135,9 @@ TargetLowering::LowerArguments(Function &F, SelectionDAG &DAG) {
|
||||
for (unsigned i = 0; i != NumVals; ++i) {
|
||||
RetVals.push_back(NVT);
|
||||
// if it isn't first piece, alignment must be 1
|
||||
if (i == 1) Flags = (Flags & 0x07ffffff) | (1 << 27);
|
||||
if (i > 0)
|
||||
Flags = (Flags & (~SDISelParamFlags::OrigAlignment)) |
|
||||
(1 << SDISelParamFlags::OrigAlignmentOffs);
|
||||
Ops.push_back(DAG.getConstant(Flags, MVT::i32));
|
||||
}
|
||||
} else {
|
||||
@ -3245,7 +3246,8 @@ static void ExpandScalarCallArgs(MVT::ValueType VT, SDOperand Arg,
|
||||
if (TLI.getTypeAction(VT) != TargetLowering::Expand) {
|
||||
// if it isn't first piece, alignment must be 1
|
||||
if (!isFirst)
|
||||
Flags = (Flags & 0x07ffffff) | (1 << 27);
|
||||
Flags = (Flags & (~SDISelParamFlags::OrigAlignment)) |
|
||||
(1 << SDISelParamFlags::OrigAlignmentOffs);
|
||||
Ops.push_back(Arg);
|
||||
Ops.push_back(DAG.getConstant(Flags, MVT::i32));
|
||||
return;
|
||||
@ -3292,18 +3294,18 @@ TargetLowering::LowerCallTo(SDOperand Chain, const Type *RetTy,
|
||||
for (unsigned i = 0, e = Args.size(); i != e; ++i) {
|
||||
MVT::ValueType VT = getValueType(Args[i].Ty);
|
||||
SDOperand Op = Args[i].Node;
|
||||
bool isSigned = Args[i].isSigned;
|
||||
bool isInReg = Args[i].isInReg;
|
||||
bool isSRet = Args[i].isSRet;
|
||||
unsigned Flags = SDISelParamFlags::NoFlagSet;
|
||||
unsigned OriginalAlignment =
|
||||
getTargetData()->getABITypeAlignment(Args[i].Ty);
|
||||
// Flags[31:27] -> OriginalAlignment
|
||||
// Flags[2] -> isSRet
|
||||
// Flags[1] -> isInReg
|
||||
// Flags[0] -> isSigned
|
||||
unsigned Flags = (isSRet << 2) | (isInReg << 1) | unsigned(isSigned) |
|
||||
(OriginalAlignment << 27);
|
||||
|
||||
|
||||
if (Args[i].isSigned)
|
||||
Flags |= SDISelParamFlags::Signed;
|
||||
if (Args[i].isInReg)
|
||||
Flags |= SDISelParamFlags::InReg;
|
||||
if (Args[i].isSRet)
|
||||
Flags |= SDISelParamFlags::StructReturn;
|
||||
Flags |= OriginalAlignment << SDISelParamFlags::OrigAlignmentOffs;
|
||||
|
||||
switch (getTypeAction(VT)) {
|
||||
default: assert(0 && "Unknown type action!");
|
||||
case Legal:
|
||||
@ -3312,7 +3314,7 @@ TargetLowering::LowerCallTo(SDOperand Chain, const Type *RetTy,
|
||||
break;
|
||||
case Promote:
|
||||
if (MVT::isInteger(VT)) {
|
||||
unsigned ExtOp = isSigned ? ISD::SIGN_EXTEND : ISD::ZERO_EXTEND;
|
||||
unsigned ExtOp = Args[i].isSigned ? ISD::SIGN_EXTEND : ISD::ZERO_EXTEND;
|
||||
Op = DAG.getNode(ExtOp, getTypeToTransformTo(VT), Op);
|
||||
} else {
|
||||
assert(MVT::isFloatingPoint(VT) && "Not int or FP?");
|
||||
|
Loading…
Reference in New Issue
Block a user