Skip to content

Commit 0c5e906

Browse files
committed
[X86] getSingleConstraintMatchWeight - cleanup variable names. NFCI.
Fix variable style warnings (case, indentation, etc.)
1 parent f27f22b commit 0c5e906

File tree

2 files changed

+69
-78
lines changed

2 files changed

+69
-78
lines changed

llvm/lib/Target/X86/X86ISelLowering.cpp

Lines changed: 67 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -56194,19 +56194,19 @@ X86TargetLowering::getConstraintType(StringRef Constraint) const {
5619456194
/// This object must already have been set up with the operand type
5619556195
/// and the current alternative constraint selected.
5619656196
TargetLowering::ConstraintWeight
56197-
X86TargetLowering::getSingleConstraintMatchWeight(
56198-
AsmOperandInfo &info, const char *constraint) const {
56199-
ConstraintWeight weight = CW_Invalid;
56200-
Value *CallOperandVal = info.CallOperandVal;
56201-
// If we don't have a value, we can't do a match,
56202-
// but allow it at the lowest weight.
56197+
X86TargetLowering::getSingleConstraintMatchWeight(
56198+
AsmOperandInfo &Info, const char *Constraint) const {
56199+
ConstraintWeight Wt = CW_Invalid;
56200+
Value *CallOperandVal = Info.CallOperandVal;
56201+
// If we don't have a value, we can't do a match,
56202+
// but allow it at the lowest weight.
5620356203
if (!CallOperandVal)
5620456204
return CW_Default;
56205-
Type *type = CallOperandVal->getType();
56205+
Type *Ty = CallOperandVal->getType();
5620656206
// Look at the constraint type.
56207-
switch (*constraint) {
56207+
switch (*Constraint) {
5620856208
default:
56209-
weight = TargetLowering::getSingleConstraintMatchWeight(info, constraint);
56209+
Wt = TargetLowering::getSingleConstraintMatchWeight(Info, Constraint);
5621056210
[[fallthrough]];
5621156211
case 'R':
5621256212
case 'q':
@@ -56219,121 +56219,112 @@ TargetLowering::ConstraintWeight
5621956219
case 'D':
5622056220
case 'A':
5622156221
if (CallOperandVal->getType()->isIntegerTy())
56222-
weight = CW_SpecificReg;
56222+
Wt = CW_SpecificReg;
5622356223
break;
5622456224
case 'f':
5622556225
case 't':
5622656226
case 'u':
56227-
if (type->isFloatingPointTy())
56228-
weight = CW_SpecificReg;
56227+
if (Ty->isFloatingPointTy())
56228+
Wt = CW_SpecificReg;
5622956229
break;
5623056230
case 'y':
56231-
if (type->isX86_MMXTy() && Subtarget.hasMMX())
56232-
weight = CW_SpecificReg;
56231+
if (Ty->isX86_MMXTy() && Subtarget.hasMMX())
56232+
Wt = CW_SpecificReg;
5623356233
break;
5623456234
case 'Y':
56235-
if (StringRef(constraint).size() != 2)
56235+
if (StringRef(Constraint).size() != 2)
5623656236
break;
56237-
switch (constraint[1]) {
56238-
default:
56239-
return CW_Invalid;
56240-
// XMM0
56241-
case 'z':
56242-
if (((type->getPrimitiveSizeInBits() == 128) && Subtarget.hasSSE1()) ||
56243-
((type->getPrimitiveSizeInBits() == 256) && Subtarget.hasAVX()) ||
56244-
((type->getPrimitiveSizeInBits() == 512) && Subtarget.hasAVX512()))
56245-
return CW_SpecificReg;
56246-
return CW_Invalid;
56247-
// Conditional OpMask regs (AVX512)
56248-
case 'k':
56249-
if ((type->getPrimitiveSizeInBits() == 64) && Subtarget.hasAVX512())
56250-
return CW_Register;
56251-
return CW_Invalid;
56252-
// Any MMX reg
56253-
case 'm':
56254-
if (type->isX86_MMXTy() && Subtarget.hasMMX())
56255-
return weight;
56237+
switch (Constraint[1]) {
56238+
default:
56239+
return CW_Invalid;
56240+
// XMM0
56241+
case 'z':
56242+
if (((Ty->getPrimitiveSizeInBits() == 128) && Subtarget.hasSSE1()) ||
56243+
((Ty->getPrimitiveSizeInBits() == 256) && Subtarget.hasAVX()) ||
56244+
((Ty->getPrimitiveSizeInBits() == 512) && Subtarget.hasAVX512()))
56245+
return CW_SpecificReg;
56246+
return CW_Invalid;
56247+
// Conditional OpMask regs (AVX512)
56248+
case 'k':
56249+
if ((Ty->getPrimitiveSizeInBits() == 64) && Subtarget.hasAVX512())
56250+
return CW_Register;
56251+
return CW_Invalid;
56252+
// Any MMX reg
56253+
case 'm':
56254+
if (Ty->isX86_MMXTy() && Subtarget.hasMMX())
56255+
return Wt;
56256+
return CW_Invalid;
56257+
// Any SSE reg when ISA >= SSE2, same as 'x'
56258+
case 'i':
56259+
case 't':
56260+
case '2':
56261+
if (!Subtarget.hasSSE2())
5625656262
return CW_Invalid;
56257-
// Any SSE reg when ISA >= SSE2, same as 'x'
56258-
case 'i':
56259-
case 't':
56260-
case '2':
56261-
if (!Subtarget.hasSSE2())
56262-
return CW_Invalid;
56263-
break;
56263+
break;
5626456264
}
5626556265
break;
5626656266
case 'v':
56267-
if ((type->getPrimitiveSizeInBits() == 512) && Subtarget.hasAVX512())
56268-
weight = CW_Register;
56267+
if ((Ty->getPrimitiveSizeInBits() == 512) && Subtarget.hasAVX512())
56268+
Wt = CW_Register;
5626956269
[[fallthrough]];
5627056270
case 'x':
56271-
if (((type->getPrimitiveSizeInBits() == 128) && Subtarget.hasSSE1()) ||
56272-
((type->getPrimitiveSizeInBits() == 256) && Subtarget.hasAVX()))
56273-
weight = CW_Register;
56271+
if (((Ty->getPrimitiveSizeInBits() == 128) && Subtarget.hasSSE1()) ||
56272+
((Ty->getPrimitiveSizeInBits() == 256) && Subtarget.hasAVX()))
56273+
Wt = CW_Register;
5627456274
break;
5627556275
case 'k':
5627656276
// Enable conditional vector operations using %k<#> registers.
56277-
if ((type->getPrimitiveSizeInBits() == 64) && Subtarget.hasAVX512())
56278-
weight = CW_Register;
56277+
if ((Ty->getPrimitiveSizeInBits() == 64) && Subtarget.hasAVX512())
56278+
Wt = CW_Register;
5627956279
break;
5628056280
case 'I':
56281-
if (auto *C = dyn_cast<ConstantInt>(info.CallOperandVal)) {
56281+
if (auto *C = dyn_cast<ConstantInt>(Info.CallOperandVal))
5628256282
if (C->getZExtValue() <= 31)
56283-
weight = CW_Constant;
56284-
}
56283+
Wt = CW_Constant;
5628556284
break;
5628656285
case 'J':
56287-
if (auto *C = dyn_cast<ConstantInt>(CallOperandVal)) {
56286+
if (auto *C = dyn_cast<ConstantInt>(CallOperandVal))
5628856287
if (C->getZExtValue() <= 63)
56289-
weight = CW_Constant;
56290-
}
56288+
Wt = CW_Constant;
5629156289
break;
5629256290
case 'K':
56293-
if (auto *C = dyn_cast<ConstantInt>(CallOperandVal)) {
56291+
if (auto *C = dyn_cast<ConstantInt>(CallOperandVal))
5629456292
if ((C->getSExtValue() >= -0x80) && (C->getSExtValue() <= 0x7f))
56295-
weight = CW_Constant;
56296-
}
56293+
Wt = CW_Constant;
5629756294
break;
5629856295
case 'L':
56299-
if (auto *C = dyn_cast<ConstantInt>(CallOperandVal)) {
56296+
if (auto *C = dyn_cast<ConstantInt>(CallOperandVal))
5630056297
if ((C->getZExtValue() == 0xff) || (C->getZExtValue() == 0xffff))
56301-
weight = CW_Constant;
56302-
}
56298+
Wt = CW_Constant;
5630356299
break;
5630456300
case 'M':
56305-
if (auto *C = dyn_cast<ConstantInt>(CallOperandVal)) {
56301+
if (auto *C = dyn_cast<ConstantInt>(CallOperandVal))
5630656302
if (C->getZExtValue() <= 3)
56307-
weight = CW_Constant;
56308-
}
56303+
Wt = CW_Constant;
5630956304
break;
5631056305
case 'N':
56311-
if (auto *C = dyn_cast<ConstantInt>(CallOperandVal)) {
56306+
if (auto *C = dyn_cast<ConstantInt>(CallOperandVal))
5631256307
if (C->getZExtValue() <= 0xff)
56313-
weight = CW_Constant;
56314-
}
56308+
Wt = CW_Constant;
5631556309
break;
5631656310
case 'G':
5631756311
case 'C':
56318-
if (isa<ConstantFP>(CallOperandVal)) {
56319-
weight = CW_Constant;
56320-
}
56312+
if (isa<ConstantFP>(CallOperandVal))
56313+
Wt = CW_Constant;
5632156314
break;
5632256315
case 'e':
56323-
if (auto *C = dyn_cast<ConstantInt>(CallOperandVal)) {
56316+
if (auto *C = dyn_cast<ConstantInt>(CallOperandVal))
5632456317
if ((C->getSExtValue() >= -0x80000000LL) &&
5632556318
(C->getSExtValue() <= 0x7fffffffLL))
56326-
weight = CW_Constant;
56327-
}
56319+
Wt = CW_Constant;
5632856320
break;
5632956321
case 'Z':
56330-
if (auto *C = dyn_cast<ConstantInt>(CallOperandVal)) {
56322+
if (auto *C = dyn_cast<ConstantInt>(CallOperandVal))
5633156323
if (C->getZExtValue() <= 0xffffffff)
56332-
weight = CW_Constant;
56333-
}
56324+
Wt = CW_Constant;
5633456325
break;
5633556326
}
56336-
return weight;
56327+
return Wt;
5633756328
}
5633856329

5633956330
/// Try to replace an X constraint, which matches anything, with another that

llvm/lib/Target/X86/X86ISelLowering.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1260,8 +1260,8 @@ namespace llvm {
12601260
/// Examine constraint string and operand type and determine a weight value.
12611261
/// The operand object must already have been set up with the operand type.
12621262
ConstraintWeight
1263-
getSingleConstraintMatchWeight(AsmOperandInfo &info,
1264-
const char *constraint) const override;
1263+
getSingleConstraintMatchWeight(AsmOperandInfo &Info,
1264+
const char *Constraint) const override;
12651265

12661266
const char *LowerXConstraint(EVT ConstraintVT) const override;
12671267

0 commit comments

Comments
 (0)