Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions llvm/utils/TableGen/CallingConvEmitter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -271,9 +271,9 @@ void CallingConvEmitter::emitAction(const Record *Action, indent Indent,
O << Indent << "return false;\n";
} else if (Action->isSubClassOf("CCPromoteToType")) {
const Record *DestTy = Action->getValueAsDef("DestTy");
MVT::SimpleValueType DestVT = getValueType(DestTy);
MVT DestVT = getValueType(DestTy);
O << Indent << "LocVT = " << getEnumName(DestVT) << ";\n";
if (MVT(DestVT).isFloatingPoint()) {
if (DestVT.isFloatingPoint()) {
O << Indent << "LocInfo = CCValAssign::FPExt;\n";
} else {
O << Indent << "if (ArgFlags.isSExt())\n"
Expand All @@ -285,9 +285,9 @@ void CallingConvEmitter::emitAction(const Record *Action, indent Indent,
}
} else if (Action->isSubClassOf("CCPromoteToUpperBitsInType")) {
const Record *DestTy = Action->getValueAsDef("DestTy");
MVT::SimpleValueType DestVT = getValueType(DestTy);
MVT DestVT = getValueType(DestTy);
O << Indent << "LocVT = " << getEnumName(DestVT) << ";\n";
if (MVT(DestVT).isFloatingPoint()) {
if (DestVT.isFloatingPoint()) {
PrintFatalError(Action->getLoc(),
"CCPromoteToUpperBitsInType does not handle floating "
"point");
Expand Down
14 changes: 6 additions & 8 deletions llvm/utils/TableGen/Common/CodeGenDAGPatterns.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1921,8 +1921,8 @@ SDNodeInfo::SDNodeInfo(const Record *R, const CodeGenHwModes &CGH) : Def(R) {

/// getKnownType - If the type constraints on this node imply a fixed type
/// (e.g. all stores return void, etc), then return it as an
/// MVT::SimpleValueType. Otherwise, return EEVT::Other.
MVT::SimpleValueType SDNodeInfo::getKnownType(unsigned ResNo) const {
/// MVT. Otherwise, return EEVT::Other.
MVT SDNodeInfo::getKnownType(unsigned ResNo) const {
unsigned NumResults = getNumResults();
assert(NumResults <= 1 &&
"We only work with nodes with zero or one result so far!");
Expand Down Expand Up @@ -2585,14 +2585,14 @@ bool TreePatternNode::ApplyTypeConstraints(TreePattern &TP, bool NotRegisters) {

ValueTypeByHwMode VVT = TP.getInfer().getConcrete(Types[0], false);
for (auto &P : VVT) {
MVT::SimpleValueType VT = P.second.SimpleTy;
MVT VT = P.second;
// Can only check for types of a known size
if (VT == MVT::iPTR)
continue;

// Check that the value doesn't use more bits than we have. It must
// either be a sign- or zero-extended equivalent of the original.
unsigned Width = MVT(VT).getFixedSizeInBits();
unsigned Width = VT.getFixedSizeInBits();
int64_t Val = II->getValue();
if (!isIntN(Width, Val) && !isUIntN(Width, Val)) {
TP.error("Integer value '" + Twine(Val) +
Expand Down Expand Up @@ -2629,8 +2629,7 @@ bool TreePatternNode::ApplyTypeConstraints(TreePattern &TP, bool NotRegisters) {
for (unsigned i = 0, e = getNumChildren() - 1; i != e; ++i) {
MadeChange |= getChild(i + 1).ApplyTypeConstraints(TP, NotRegisters);

MVT::SimpleValueType OpVT =
getValueType(Int->IS.ParamTys[i]->getValueAsDef("VT"));
MVT OpVT = getValueType(Int->IS.ParamTys[i]->getValueAsDef("VT"));
assert(getChild(i + 1).getNumTypes() == 1 && "Unhandled case");
MadeChange |= getChild(i + 1).UpdateNodeType(0, OpVT, TP);
}
Expand Down Expand Up @@ -2676,8 +2675,7 @@ bool TreePatternNode::ApplyTypeConstraints(TreePattern &TP, bool NotRegisters) {

// FIXME: Generalize to multiple possible types and multiple possible
// ImplicitDefs.
MVT::SimpleValueType VT =
InstInfo.HasOneImplicitDefWithKnownVT(CDP.getTargetInfo());
MVT VT = InstInfo.HasOneImplicitDefWithKnownVT(CDP.getTargetInfo());

if (VT != MVT::Other)
MadeChange |= UpdateNodeType(ResNo, VT, TP);
Expand Down
19 changes: 8 additions & 11 deletions llvm/utils/TableGen/Common/CodeGenDAGPatterns.h
Original file line number Diff line number Diff line change
Expand Up @@ -191,8 +191,7 @@ struct TypeSetByHwMode : public InfoByHwMode<MachineValueTypeSet> {
TypeSetByHwMode() = default;
TypeSetByHwMode(const TypeSetByHwMode &VTS) = default;
TypeSetByHwMode &operator=(const TypeSetByHwMode &) = default;
TypeSetByHwMode(MVT::SimpleValueType VT)
: TypeSetByHwMode(ValueTypeByHwMode(VT)) {}
TypeSetByHwMode(MVT VT) : TypeSetByHwMode(ValueTypeByHwMode(VT)) {}
TypeSetByHwMode(ArrayRef<ValueTypeByHwMode> VTList);

SetType &getOrCreate(unsigned Mode) { return Map[Mode]; }
Expand Down Expand Up @@ -259,7 +258,7 @@ struct TypeInfer {
/// otherwise.

bool MergeInTypeInfo(TypeSetByHwMode &Out, const TypeSetByHwMode &In) const;
bool MergeInTypeInfo(TypeSetByHwMode &Out, MVT::SimpleValueType InVT) const {
bool MergeInTypeInfo(TypeSetByHwMode &Out, MVT InVT) const {
return MergeInTypeInfo(Out, TypeSetByHwMode(InVT));
}
bool MergeInTypeInfo(TypeSetByHwMode &Out,
Expand Down Expand Up @@ -451,8 +450,8 @@ class SDNodeInfo {

/// getKnownType - If the type constraints on this node imply a fixed type
/// (e.g. all stores return void, etc), then return it as an
/// MVT::SimpleValueType. Otherwise, return MVT::Other.
MVT::SimpleValueType getKnownType(unsigned ResNo) const;
/// MVT. Otherwise, return MVT::Other.
MVT getKnownType(unsigned ResNo) const;

unsigned getProperties() const { return Properties; }

Expand Down Expand Up @@ -698,8 +697,8 @@ class TreePatternNode : public RefCountedBase<TreePatternNode> {
}
TypeSetByHwMode &getExtType(unsigned ResNo) { return Types[ResNo]; }
void setType(unsigned ResNo, const TypeSetByHwMode &T) { Types[ResNo] = T; }
MVT::SimpleValueType getSimpleType(unsigned ResNo) const {
return Types[ResNo].getMachineValueType().SimpleTy;
MVT getSimpleType(unsigned ResNo) const {
return Types[ResNo].getMachineValueType();
}

bool hasConcreteType(unsigned ResNo) const {
Expand Down Expand Up @@ -850,8 +849,7 @@ class TreePatternNode : public RefCountedBase<TreePatternNode> {
///
bool UpdateNodeType(unsigned ResNo, const TypeSetByHwMode &InTy,
TreePattern &TP);
bool UpdateNodeType(unsigned ResNo, MVT::SimpleValueType InTy,
TreePattern &TP);
bool UpdateNodeType(unsigned ResNo, MVT InTy, TreePattern &TP);
bool UpdateNodeType(unsigned ResNo, const ValueTypeByHwMode &InTy,
TreePattern &TP);

Expand Down Expand Up @@ -1001,8 +999,7 @@ inline bool TreePatternNode::UpdateNodeType(unsigned ResNo,
return TP.getInfer().MergeInTypeInfo(Types[ResNo], VTS);
}

inline bool TreePatternNode::UpdateNodeType(unsigned ResNo,
MVT::SimpleValueType InTy,
inline bool TreePatternNode::UpdateNodeType(unsigned ResNo, MVT InTy,
TreePattern &TP) {
TypeSetByHwMode VTS(InTy);
TP.getInfer().expandOverloads(VTS);
Expand Down
4 changes: 2 additions & 2 deletions llvm/utils/TableGen/Common/CodeGenInstruction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -499,7 +499,7 @@ CodeGenInstruction::CodeGenInstruction(const Record *R)
/// HasOneImplicitDefWithKnownVT - If the instruction has at least one
/// implicit def and it has a known VT, return the VT, otherwise return
/// MVT::Other.
MVT::SimpleValueType CodeGenInstruction::HasOneImplicitDefWithKnownVT(
MVT CodeGenInstruction::HasOneImplicitDefWithKnownVT(
const CodeGenTarget &TargetInfo) const {
if (ImplicitDefs.empty())
return MVT::Other;
Expand All @@ -510,7 +510,7 @@ MVT::SimpleValueType CodeGenInstruction::HasOneImplicitDefWithKnownVT(
const std::vector<ValueTypeByHwMode> &RegVTs =
TargetInfo.getRegisterVTs(FirstImplicitDef);
if (RegVTs.size() == 1 && RegVTs[0].isSimple())
return RegVTs[0].getSimple().SimpleTy;
return RegVTs[0].getSimple();
return MVT::Other;
}

Expand Down
3 changes: 1 addition & 2 deletions llvm/utils/TableGen/Common/CodeGenInstruction.h
Original file line number Diff line number Diff line change
Expand Up @@ -289,8 +289,7 @@ class CodeGenInstruction {
/// HasOneImplicitDefWithKnownVT - If the instruction has at least one
/// implicit def and it has a known VT, return the VT, otherwise return
/// MVT::Other.
MVT::SimpleValueType
HasOneImplicitDefWithKnownVT(const CodeGenTarget &TargetInfo) const;
MVT HasOneImplicitDefWithKnownVT(const CodeGenTarget &TargetInfo) const;

/// FlattenAsmStringVariants - Flatten the specified AsmString to only
/// include text from the specified variant, returning the new string.
Expand Down
8 changes: 4 additions & 4 deletions llvm/utils/TableGen/Common/CodeGenTarget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,15 @@ static cl::opt<unsigned>
cl::desc("Make -gen-asm-writer emit assembly writer #N"),
cl::cat(AsmWriterCat));

/// getValueType - Return the MVT::SimpleValueType that the specified TableGen
/// Returns the MVT that the specified TableGen
/// record corresponds to.
MVT::SimpleValueType llvm::getValueType(const Record *Rec) {
MVT llvm::getValueType(const Record *Rec) {
return (MVT::SimpleValueType)Rec->getValueAsInt("Value");
}

StringRef llvm::getEnumName(MVT::SimpleValueType T) {
StringRef llvm::getEnumName(MVT T) {
// clang-format off
switch (T) {
switch (T.SimpleTy) {
#define GET_VT_ATTR(Ty, N, Sz, Any, Int, FP, Vec, Sc, Tup, NF, NElem, EltTy) \
case MVT::Ty: return "MVT::" # Ty;
#include "llvm/CodeGen/GenVT.inc"
Expand Down
6 changes: 3 additions & 3 deletions llvm/utils/TableGen/Common/CodeGenTarget.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,11 @@ class CodeGenRegisterClass;
class CodeGenSchedModels;
class CodeGenSubRegIndex;

/// getValueType - Return the MVT::SimpleValueType that the specified TableGen
/// Returns the MVT that the specified TableGen
/// record corresponds to.
MVT::SimpleValueType getValueType(const Record *Rec);
MVT getValueType(const Record *Rec);

StringRef getEnumName(MVT::SimpleValueType T);
StringRef getEnumName(MVT T);

/// getQualifiedName - Return the name of the specified record, with a
/// namespace qualifier if the record contains one.
Expand Down
15 changes: 7 additions & 8 deletions llvm/utils/TableGen/Common/DAGISelMatcher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ void EmitNodeMatcherCommon::printImpl(raw_ostream &OS, indent Indent) const {
OS << (isa<MorphNodeToMatcher>(this) ? "MorphNodeTo: " : "EmitNode: ")
<< CGI.Namespace << "::" << CGI.getName() << ": <todo flags> ";

for (MVT::SimpleValueType VT : VTs)
for (MVT VT : VTs)
OS << ' ' << getEnumName(VT);
OS << '(';
for (unsigned Operand : Operands)
Expand Down Expand Up @@ -321,8 +321,7 @@ void MorphNodeToMatcher::anchor() {}

// isContradictoryImpl Implementations.

static bool TypesAreContradictory(MVT::SimpleValueType T1,
MVT::SimpleValueType T2) {
static bool TypesAreContradictory(MVT T1, MVT T2) {
// If the two types are the same, then they are the same, so they don't
// contradict.
if (T1 == T2)
Expand All @@ -339,16 +338,16 @@ static bool TypesAreContradictory(MVT::SimpleValueType T1,
// If either type is about iPtr, then they don't conflict unless the other
// one is not a scalar integer type.
if (T1 == MVT::iPTR)
return !MVT(T2).isInteger() || MVT(T2).isVector();
return !T2.isInteger() || T2.isVector();

if (T2 == MVT::iPTR)
return !MVT(T1).isInteger() || MVT(T1).isVector();
return !T1.isInteger() || T1.isVector();

if (T1 == MVT::cPTR)
return !MVT(T2).isCheriCapability() || MVT(T2).isVector();
return !T2.isCheriCapability() || T2.isVector();

if (T2 == MVT::cPTR)
return !MVT(T1).isCheriCapability() || MVT(T1).isVector();
return !T1.isCheriCapability() || T1.isVector();

// Otherwise, they are two different non-iPTR/cPTR types, they conflict.
return true;
Expand All @@ -370,7 +369,7 @@ bool CheckOpcodeMatcher::isContradictoryImpl(const Matcher *M) const {
if (CT->getResNo() >= getOpcode().getNumResults())
return true;

MVT::SimpleValueType NodeType = getOpcode().getKnownType(CT->getResNo());
MVT NodeType = getOpcode().getKnownType(CT->getResNo());
if (NodeType != MVT::Other)
return TypesAreContradictory(NodeType, CT->getType());
}
Expand Down
Loading