//===- CodeGenInstruction.cpp - CodeGen Instruction Class Wrapper ---------===// // // 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 // //===----------------------------------------------------------------------===// // // This file implements the CodeGenInstruction class. // //===----------------------------------------------------------------------===// #include "CodeGenInstruction.h" #include "CodeGenTarget.h" #include "llvm/ADT/StringExtras.h" #include "llvm/TableGen/Error.h" #include "llvm/TableGen/Record.h" #include <set> usingnamespacellvm; //===----------------------------------------------------------------------===// // CGIOperandList Implementation //===----------------------------------------------------------------------===// CGIOperandList::CGIOperandList(Record *R) : … { … } /// getOperandNamed - Return the index of the operand with the specified /// non-empty name. If the instruction does not have an operand with the /// specified name, abort. /// unsigned CGIOperandList::getOperandNamed(StringRef Name) const { … } /// hasOperandNamed - Query whether the instruction has an operand of the /// given name. If so, return true and set OpIdx to the index of the /// operand. Otherwise, return false. bool CGIOperandList::hasOperandNamed(StringRef Name, unsigned &OpIdx) const { … } bool CGIOperandList::hasSubOperandAlias( StringRef Name, std::pair<unsigned, unsigned> &SubOp) const { … } std::pair<unsigned, unsigned> CGIOperandList::ParseOperandName(StringRef Op, bool AllowWholeOp) { … } static void ParseConstraint(StringRef CStr, CGIOperandList &Ops, Record *Rec) { … } static void ParseConstraints(StringRef CStr, CGIOperandList &Ops, Record *Rec) { … } void CGIOperandList::ProcessDisableEncoding(StringRef DisableEncoding) { … } //===----------------------------------------------------------------------===// // CodeGenInstruction Implementation //===----------------------------------------------------------------------===// CodeGenInstruction::CodeGenInstruction(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( const CodeGenTarget &TargetInfo) const { … } /// FlattenAsmStringVariants - Flatten the specified AsmString to only /// include text from the specified variant, returning the new string. std::string CodeGenInstruction::FlattenAsmStringVariants(StringRef Cur, unsigned Variant) { … } bool CodeGenInstruction::isOperandImpl(StringRef OpListName, unsigned i, StringRef PropertyName) const { … }