//===- llvm/CodeGen/GlobalISel/GenericMachineInstrs.h -----------*- C++ -*-===// // // 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 // //===----------------------------------------------------------------------===// /// \file /// Declares convenience wrapper classes for interpreting MachineInstr instances /// as specific generic operations. /// //===----------------------------------------------------------------------===// #ifndef LLVM_CODEGEN_GLOBALISEL_GENERICMACHINEINSTRS_H #define LLVM_CODEGEN_GLOBALISEL_GENERICMACHINEINSTRS_H #include "llvm/ADT/APInt.h" #include "llvm/CodeGen/MachineInstr.h" #include "llvm/CodeGen/MachineMemOperand.h" #include "llvm/CodeGen/TargetOpcodes.h" #include "llvm/IR/Constants.h" #include "llvm/IR/Instructions.h" #include "llvm/Support/Casting.h" namespace llvm { /// A base class for all GenericMachineInstrs. class GenericMachineInstr : public MachineInstr { … }; /// Provides common memory operand functionality. class GMemOperation : public GenericMachineInstr { … }; /// Represents any type of generic load or store. /// G_LOAD, G_STORE, G_ZEXTLOAD, G_SEXTLOAD. class GLoadStore : public GMemOperation { … }; /// Represents indexed loads. These are different enough from regular loads /// that they get their own class. Including them in GAnyLoad would probably /// make a footgun for someone. class GIndexedLoad : public GMemOperation { … }; /// Represents a G_INDEX_ZEXTLOAD/G_INDEXED_SEXTLOAD. class GIndexedExtLoad : public GIndexedLoad { … }; /// Represents either G_INDEXED_LOAD, G_INDEXED_ZEXTLOAD or G_INDEXED_SEXTLOAD. class GIndexedAnyExtLoad : public GIndexedLoad { … }; /// Represents a G_ZEXTLOAD. class GIndexedZExtLoad : GIndexedExtLoad { … }; /// Represents a G_SEXTLOAD. class GIndexedSExtLoad : GIndexedExtLoad { … }; /// Represents indexed stores. class GIndexedStore : public GMemOperation { … }; /// Represents any generic load, including sign/zero extending variants. class GAnyLoad : public GLoadStore { … }; /// Represents a G_LOAD. class GLoad : public GAnyLoad { … }; /// Represents either a G_SEXTLOAD or G_ZEXTLOAD. class GExtLoad : public GAnyLoad { … }; /// Represents a G_SEXTLOAD. class GSExtLoad : public GExtLoad { … }; /// Represents a G_ZEXTLOAD. class GZExtLoad : public GExtLoad { … }; /// Represents a G_STORE. class GStore : public GLoadStore { … }; /// Represents a G_UNMERGE_VALUES. class GUnmerge : public GenericMachineInstr { … }; /// Represents G_BUILD_VECTOR, G_CONCAT_VECTORS or G_MERGE_VALUES. /// All these have the common property of generating a single value from /// multiple sources. class GMergeLikeInstr : public GenericMachineInstr { … }; /// Represents a G_MERGE_VALUES. class GMerge : public GMergeLikeInstr { … }; /// Represents a G_CONCAT_VECTORS. class GConcatVectors : public GMergeLikeInstr { … }; /// Represents a G_BUILD_VECTOR. class GBuildVector : public GMergeLikeInstr { … }; /// Represents a G_BUILD_VECTOR_TRUNC. class GBuildVectorTrunc : public GMergeLikeInstr { … }; /// Represents a G_SHUFFLE_VECTOR. class GShuffleVector : public GenericMachineInstr { … }; /// Represents a G_PTR_ADD. class GPtrAdd : public GenericMachineInstr { … }; /// Represents a G_IMPLICIT_DEF. class GImplicitDef : public GenericMachineInstr { … }; /// Represents a G_SELECT. class GSelect : public GenericMachineInstr { … }; /// Represent a G_ICMP or G_FCMP. class GAnyCmp : public GenericMachineInstr { … }; /// Represent a G_ICMP. class GICmp : public GAnyCmp { … }; /// Represent a G_FCMP. class GFCmp : public GAnyCmp { … }; /// Represents overflowing binary operations. /// Only carry-out: /// G_UADDO, G_SADDO, G_USUBO, G_SSUBO, G_UMULO, G_SMULO /// Carry-in and carry-out: /// G_UADDE, G_SADDE, G_USUBE, G_SSUBE class GBinOpCarryOut : public GenericMachineInstr { … }; /// Represents overflowing add/sub operations. /// Only carry-out: /// G_UADDO, G_SADDO, G_USUBO, G_SSUBO /// Carry-in and carry-out: /// G_UADDE, G_SADDE, G_USUBE, G_SSUBE class GAddSubCarryOut : public GBinOpCarryOut { … }; /// Represents overflowing add operations. /// G_UADDO, G_SADDO class GAddCarryOut : public GBinOpCarryOut { … }; /// Represents overflowing add/sub operations that also consume a carry-in. /// G_UADDE, G_SADDE, G_USUBE, G_SSUBE class GAddSubCarryInOut : public GAddSubCarryOut { … }; /// Represents a call to an intrinsic. class GIntrinsic final : public GenericMachineInstr { … }; // Represents a (non-sequential) vector reduction operation. class GVecReduce : public GenericMachineInstr { … }; /// Represents a G_PHI. class GPhi : public GenericMachineInstr { … }; /// Represents a binary operation, i.e, x = y op z. class GBinOp : public GenericMachineInstr { … }; /// Represents an integer binary operation. class GIntBinOp : public GBinOp { … }; /// Represents a floating point binary operation. class GFBinOp : public GBinOp { … }; /// Represents a logical binary operation. class GLogicalBinOp : public GBinOp { … }; /// Represents an integer addition. class GAdd : public GIntBinOp { … }; /// Represents a logical and. class GAnd : public GLogicalBinOp { … }; /// Represents a logical or. class GOr : public GLogicalBinOp { … }; /// Represents an extract vector element. class GExtractVectorElement : public GenericMachineInstr { … }; /// Represents an insert vector element. class GInsertVectorElement : public GenericMachineInstr { … }; /// Represents an extract subvector. class GExtractSubvector : public GenericMachineInstr { … }; /// Represents a freeze. class GFreeze : public GenericMachineInstr { … }; /// Represents a cast operation. /// It models the llvm::CastInst concept. /// The exception is bitcast. class GCastOp : public GenericMachineInstr { … }; /// Represents a sext. class GSext : public GCastOp { … }; /// Represents a zext. class GZext : public GCastOp { … }; /// Represents a trunc. class GTrunc : public GCastOp { … }; /// Represents a vscale. class GVScale : public GenericMachineInstr { … }; /// Represents an integer subtraction. class GSub : public GIntBinOp { … }; /// Represents an integer multiplication. class GMul : public GIntBinOp { … }; /// Represents a shift left. class GShl : public GenericMachineInstr { … }; /// Represents a threeway compare. class GSUCmp : public GenericMachineInstr { … }; /// Represents an integer-like extending operation. class GExtOp : public GCastOp { … }; /// Represents an integer-like extending or truncating operation. class GExtOrTruncOp : public GCastOp { … }; /// Represents a splat vector. class GSplatVector : public GenericMachineInstr { … }; } // namespace llvm #endif // LLVM_CODEGEN_GLOBALISEL_GENERICMACHINEINSTRS_H