1*700637cbSDimitry Andric//===--- Opcodes.td - Opcode defitions for the constexpr VM -----*- C++ -*-===// 2*700637cbSDimitry Andric// 3*700637cbSDimitry Andric// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4*700637cbSDimitry Andric// See https://llvm.org/LICENSE.txt for license information. 5*700637cbSDimitry Andric// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6*700637cbSDimitry Andric// 7*700637cbSDimitry Andric//===----------------------------------------------------------------------===// 8*700637cbSDimitry Andric// 9*700637cbSDimitry Andric// Helper file used to generate opcodes, the interpreter and the disassembler. 10*700637cbSDimitry Andric// 11*700637cbSDimitry Andric//===----------------------------------------------------------------------===// 12*700637cbSDimitry Andric 13*700637cbSDimitry Andric 14*700637cbSDimitry Andric//===----------------------------------------------------------------------===// 15*700637cbSDimitry Andric// Types evaluated by the interpreter. 16*700637cbSDimitry Andric//===----------------------------------------------------------------------===// 17*700637cbSDimitry Andric 18*700637cbSDimitry Andricclass Type; 19*700637cbSDimitry Andricdef Bool : Type; 20*700637cbSDimitry Andricdef Sint8 : Type; 21*700637cbSDimitry Andricdef Uint8 : Type; 22*700637cbSDimitry Andricdef Sint16 : Type; 23*700637cbSDimitry Andricdef Uint16 : Type; 24*700637cbSDimitry Andricdef Sint32 : Type; 25*700637cbSDimitry Andricdef Uint32 : Type; 26*700637cbSDimitry Andricdef Sint64 : Type; 27*700637cbSDimitry Andricdef Uint64 : Type; 28*700637cbSDimitry Andricdef IntAP : Type; 29*700637cbSDimitry Andricdef IntAPS : Type; 30*700637cbSDimitry Andricdef Float : Type; 31*700637cbSDimitry Andricdef Ptr : Type; 32*700637cbSDimitry Andricdef MemberPtr : Type; 33*700637cbSDimitry Andricdef FixedPoint : Type; 34*700637cbSDimitry Andric 35*700637cbSDimitry Andric//===----------------------------------------------------------------------===// 36*700637cbSDimitry Andric// Types transferred to the interpreter. 37*700637cbSDimitry Andric//===----------------------------------------------------------------------===// 38*700637cbSDimitry Andric 39*700637cbSDimitry Andricclass ArgType { string Name = ?; bit AsRef = false; } 40*700637cbSDimitry Andricdef ArgSint8 : ArgType { let Name = "int8_t"; } 41*700637cbSDimitry Andricdef ArgUint8 : ArgType { let Name = "uint8_t"; } 42*700637cbSDimitry Andricdef ArgSint16 : ArgType { let Name = "int16_t"; } 43*700637cbSDimitry Andricdef ArgUint16 : ArgType { let Name = "uint16_t"; } 44*700637cbSDimitry Andricdef ArgSint32 : ArgType { let Name = "int32_t"; } 45*700637cbSDimitry Andricdef ArgUint32 : ArgType { let Name = "uint32_t"; } 46*700637cbSDimitry Andricdef ArgSint64 : ArgType { let Name = "int64_t"; } 47*700637cbSDimitry Andricdef ArgUint64 : ArgType { let Name = "uint64_t"; } 48*700637cbSDimitry Andricdef ArgIntAP : ArgType { let Name = "IntegralAP<false>"; let AsRef = true; } 49*700637cbSDimitry Andricdef ArgIntAPS : ArgType { let Name = "IntegralAP<true>"; let AsRef = true; } 50*700637cbSDimitry Andricdef ArgFloat : ArgType { let Name = "Floating"; let AsRef = true; } 51*700637cbSDimitry Andric 52*700637cbSDimitry Andricdef ArgBool : ArgType { let Name = "bool"; } 53*700637cbSDimitry Andricdef ArgFixedPoint : ArgType { let Name = "FixedPoint"; let AsRef = true; } 54*700637cbSDimitry Andric 55*700637cbSDimitry Andricdef ArgFunction : ArgType { let Name = "const Function *"; } 56*700637cbSDimitry Andricdef ArgRecordDecl : ArgType { let Name = "const RecordDecl *"; } 57*700637cbSDimitry Andricdef ArgRecordField : ArgType { let Name = "const Record::Field *"; } 58*700637cbSDimitry Andricdef ArgFltSemantics : ArgType { let Name = "const llvm::fltSemantics *"; } 59*700637cbSDimitry Andricdef ArgRoundingMode : ArgType { let Name = "llvm::RoundingMode"; } 60*700637cbSDimitry Andricdef ArgLETD: ArgType { let Name = "const LifetimeExtendedTemporaryDecl *"; } 61*700637cbSDimitry Andricdef ArgCastKind : ArgType { let Name = "interp::CastKind"; } 62*700637cbSDimitry Andricdef ArgCallExpr : ArgType { let Name = "const CallExpr *"; } 63*700637cbSDimitry Andricdef ArgExpr : ArgType { let Name = "const Expr *"; } 64*700637cbSDimitry Andricdef ArgOffsetOfExpr : ArgType { let Name = "const OffsetOfExpr *"; } 65*700637cbSDimitry Andricdef ArgDeclRef : ArgType { let Name = "const DeclRefExpr *"; } 66*700637cbSDimitry Andricdef ArgCCI : ArgType { let Name = "const ComparisonCategoryInfo *"; } 67*700637cbSDimitry Andricdef ArgValueDecl : ArgType { let Name = "const ValueDecl*"; } 68*700637cbSDimitry Andricdef ArgVarDecl : ArgType { let Name = "const VarDecl*"; } 69*700637cbSDimitry Andricdef ArgDesc : ArgType { let Name = "const Descriptor *"; } 70*700637cbSDimitry Andricdef ArgPrimType : ArgType { let Name = "PrimType"; } 71*700637cbSDimitry Andricdef ArgEnumDecl : ArgType { let Name = "const EnumDecl *"; } 72*700637cbSDimitry Andricdef ArgTypePtr : ArgType { let Name = "const Type *"; } 73*700637cbSDimitry Andric 74*700637cbSDimitry Andric//===----------------------------------------------------------------------===// 75*700637cbSDimitry Andric// Classes of types instructions operate on. 76*700637cbSDimitry Andric//===----------------------------------------------------------------------===// 77*700637cbSDimitry Andric 78*700637cbSDimitry Andricclass TypeClass { 79*700637cbSDimitry Andric list<Type> Types; 80*700637cbSDimitry Andric} 81*700637cbSDimitry Andric 82*700637cbSDimitry Andricdef IntegerTypeClass : TypeClass { 83*700637cbSDimitry Andric let Types = [Sint8, Uint8, Sint16, Uint16, Sint32, 84*700637cbSDimitry Andric Uint32, Sint64, Uint64, IntAP, IntAPS]; 85*700637cbSDimitry Andric} 86*700637cbSDimitry Andric 87*700637cbSDimitry Andricdef IntegerAndFixedTypeClass : TypeClass { 88*700637cbSDimitry Andric let Types = [Sint8, Uint8, Sint16, Uint16, Sint32, 89*700637cbSDimitry Andric Uint32, Sint64, Uint64, IntAP, IntAPS, FixedPoint]; 90*700637cbSDimitry Andric} 91*700637cbSDimitry Andric 92*700637cbSDimitry Andricdef IntegralTypeClass : TypeClass { 93*700637cbSDimitry Andric let Types = !listconcat(IntegerTypeClass.Types, [Bool]); 94*700637cbSDimitry Andric} 95*700637cbSDimitry Andricdef FixedSizeIntegralTypeClass : TypeClass { 96*700637cbSDimitry Andric let Types = [Sint8, Uint8, Sint16, Uint16, Sint32, 97*700637cbSDimitry Andric Uint32, Sint64, Uint64, Bool]; 98*700637cbSDimitry Andric} 99*700637cbSDimitry Andric 100*700637cbSDimitry Andricdef FixedSizeIntegralNoBoolTypeClass : TypeClass { 101*700637cbSDimitry Andric let Types = [Sint8, Uint8, Sint16, Uint16, Sint32, Uint32, Sint64, Uint64]; 102*700637cbSDimitry Andric} 103*700637cbSDimitry Andric 104*700637cbSDimitry Andricdef NumberTypeClass : TypeClass { 105*700637cbSDimitry Andric let Types = !listconcat(IntegerTypeClass.Types, [Float]); 106*700637cbSDimitry Andric} 107*700637cbSDimitry Andric 108*700637cbSDimitry Andricdef FloatTypeClass : TypeClass { 109*700637cbSDimitry Andric let Types = [Float]; 110*700637cbSDimitry Andric} 111*700637cbSDimitry Andric 112*700637cbSDimitry Andricdef AluTypeClass : TypeClass { 113*700637cbSDimitry Andric let Types = !listconcat(IntegerTypeClass.Types, [Bool], [FixedPoint]); 114*700637cbSDimitry Andric} 115*700637cbSDimitry Andric 116*700637cbSDimitry Andricdef PtrTypeClass : TypeClass { let Types = [Ptr, MemberPtr]; } 117*700637cbSDimitry Andric 118*700637cbSDimitry Andricdef NonPtrTypeClass : TypeClass { 119*700637cbSDimitry Andric let Types = !listconcat(IntegerTypeClass.Types, [Bool], [Float], [FixedPoint]); 120*700637cbSDimitry Andric} 121*700637cbSDimitry Andric 122*700637cbSDimitry Andricdef AllTypeClass : TypeClass { 123*700637cbSDimitry Andric let Types = !listconcat(AluTypeClass.Types, PtrTypeClass.Types, FloatTypeClass.Types); 124*700637cbSDimitry Andric} 125*700637cbSDimitry Andric 126*700637cbSDimitry Andricdef ComparableTypeClass : TypeClass { 127*700637cbSDimitry Andric let Types = !listconcat(AluTypeClass.Types, [Ptr], [Float]); 128*700637cbSDimitry Andric} 129*700637cbSDimitry Andric 130*700637cbSDimitry Andricclass SingletonTypeClass<Type Ty> : TypeClass { 131*700637cbSDimitry Andric let Types = [Ty]; 132*700637cbSDimitry Andric} 133*700637cbSDimitry Andric 134*700637cbSDimitry Andric//===----------------------------------------------------------------------===// 135*700637cbSDimitry Andric// Record describing all opcodes. 136*700637cbSDimitry Andric//===----------------------------------------------------------------------===// 137*700637cbSDimitry Andric 138*700637cbSDimitry Andricclass Opcode { 139*700637cbSDimitry Andric list<TypeClass> Types = []; 140*700637cbSDimitry Andric list<ArgType> Args = []; 141*700637cbSDimitry Andric string Name = ""; 142*700637cbSDimitry Andric bit CanReturn = 0; 143*700637cbSDimitry Andric bit ChangesPC = 0; 144*700637cbSDimitry Andric bit HasCustomLink = 0; 145*700637cbSDimitry Andric bit HasCustomEval = 0; 146*700637cbSDimitry Andric bit HasGroup = 0; 147*700637cbSDimitry Andric} 148*700637cbSDimitry Andric 149*700637cbSDimitry Andricclass AluOpcode : Opcode { 150*700637cbSDimitry Andric let Types = [AluTypeClass]; 151*700637cbSDimitry Andric let HasGroup = 1; 152*700637cbSDimitry Andric} 153*700637cbSDimitry Andric 154*700637cbSDimitry Andricclass FloatOpcode : Opcode { 155*700637cbSDimitry Andric let Args = [ArgUint32]; 156*700637cbSDimitry Andric} 157*700637cbSDimitry Andric 158*700637cbSDimitry Andricclass IntegerOpcode : Opcode { 159*700637cbSDimitry Andric let Types = [IntegerAndFixedTypeClass]; 160*700637cbSDimitry Andric let HasGroup = 1; 161*700637cbSDimitry Andric} 162*700637cbSDimitry Andric 163*700637cbSDimitry Andric//===----------------------------------------------------------------------===// 164*700637cbSDimitry Andric// Jump opcodes 165*700637cbSDimitry Andric//===----------------------------------------------------------------------===// 166*700637cbSDimitry Andric 167*700637cbSDimitry Andricclass JumpOpcode : Opcode { 168*700637cbSDimitry Andric let Args = [ArgSint32]; 169*700637cbSDimitry Andric let ChangesPC = 1; 170*700637cbSDimitry Andric let HasCustomEval = 1; 171*700637cbSDimitry Andric} 172*700637cbSDimitry Andric 173*700637cbSDimitry Andric// [] -> [] 174*700637cbSDimitry Andricdef Jmp : JumpOpcode; 175*700637cbSDimitry Andric// [Bool] -> [], jumps if true. 176*700637cbSDimitry Andricdef Jt : JumpOpcode; 177*700637cbSDimitry Andric// [Bool] -> [], jumps if false. 178*700637cbSDimitry Andricdef Jf : JumpOpcode; 179*700637cbSDimitry Andric 180*700637cbSDimitry Andricdef StartSpeculation : Opcode; 181*700637cbSDimitry Andricdef EndSpeculation : Opcode; 182*700637cbSDimitry Andricdef BCP : Opcode { 183*700637cbSDimitry Andric let ChangesPC = 1; 184*700637cbSDimitry Andric let HasCustomEval = 1; 185*700637cbSDimitry Andric let Args = [ArgSint32, ArgPrimType]; 186*700637cbSDimitry Andric} 187*700637cbSDimitry Andric 188*700637cbSDimitry Andric//===----------------------------------------------------------------------===// 189*700637cbSDimitry Andric// Returns 190*700637cbSDimitry Andric//===----------------------------------------------------------------------===// 191*700637cbSDimitry Andric 192*700637cbSDimitry Andric// [Value] -> [] 193*700637cbSDimitry Andricdef Ret : Opcode { 194*700637cbSDimitry Andric let Types = [AllTypeClass]; 195*700637cbSDimitry Andric let ChangesPC = 1; 196*700637cbSDimitry Andric let CanReturn = 1; 197*700637cbSDimitry Andric let HasGroup = 1; 198*700637cbSDimitry Andric let HasCustomEval = 1; 199*700637cbSDimitry Andric} 200*700637cbSDimitry Andric// [] -> [] 201*700637cbSDimitry Andricdef RetVoid : Opcode { 202*700637cbSDimitry Andric let CanReturn = 1; 203*700637cbSDimitry Andric let ChangesPC = 1; 204*700637cbSDimitry Andric let HasCustomEval = 1; 205*700637cbSDimitry Andric} 206*700637cbSDimitry Andric// [Value] -> [] 207*700637cbSDimitry Andricdef RetValue : Opcode { 208*700637cbSDimitry Andric let CanReturn = 1; 209*700637cbSDimitry Andric let ChangesPC = 1; 210*700637cbSDimitry Andric let HasCustomEval = 1; 211*700637cbSDimitry Andric} 212*700637cbSDimitry Andric// [] -> EXIT 213*700637cbSDimitry Andricdef NoRet : Opcode {} 214*700637cbSDimitry Andric 215*700637cbSDimitry Andric 216*700637cbSDimitry Andricdef Call : Opcode { 217*700637cbSDimitry Andric let Args = [ArgFunction, ArgUint32]; 218*700637cbSDimitry Andric} 219*700637cbSDimitry Andric 220*700637cbSDimitry Andricdef CallVirt : Opcode { 221*700637cbSDimitry Andric let Args = [ArgFunction, ArgUint32]; 222*700637cbSDimitry Andric} 223*700637cbSDimitry Andric 224*700637cbSDimitry Andricdef CallBI : Opcode { let Args = [ArgCallExpr, ArgUint32]; } 225*700637cbSDimitry Andric 226*700637cbSDimitry Andricdef CallPtr : Opcode { 227*700637cbSDimitry Andric let Args = [ArgUint32, ArgCallExpr]; 228*700637cbSDimitry Andric} 229*700637cbSDimitry Andric 230*700637cbSDimitry Andricdef CallVar : Opcode { 231*700637cbSDimitry Andric let Args = [ArgFunction, ArgUint32]; 232*700637cbSDimitry Andric} 233*700637cbSDimitry Andric 234*700637cbSDimitry Andricdef OffsetOf : Opcode { 235*700637cbSDimitry Andric let Types = [IntegerTypeClass]; 236*700637cbSDimitry Andric let Args = [ArgOffsetOfExpr]; 237*700637cbSDimitry Andric let HasGroup = 1; 238*700637cbSDimitry Andric} 239*700637cbSDimitry Andric 240*700637cbSDimitry Andric//===----------------------------------------------------------------------===// 241*700637cbSDimitry Andric// Frame management 242*700637cbSDimitry Andric//===----------------------------------------------------------------------===// 243*700637cbSDimitry Andric 244*700637cbSDimitry Andric// [] -> [] 245*700637cbSDimitry Andricdef Destroy : Opcode { 246*700637cbSDimitry Andric let Args = [ArgUint32]; 247*700637cbSDimitry Andric let HasCustomEval = 1; 248*700637cbSDimitry Andric} 249*700637cbSDimitry Andricdef InitScope : Opcode { 250*700637cbSDimitry Andric let Args = [ArgUint32]; 251*700637cbSDimitry Andric} 252*700637cbSDimitry Andric 253*700637cbSDimitry Andric//===----------------------------------------------------------------------===// 254*700637cbSDimitry Andric// Constants 255*700637cbSDimitry Andric//===----------------------------------------------------------------------===// 256*700637cbSDimitry Andric 257*700637cbSDimitry Andricclass ConstOpcode<Type Ty, ArgType ArgTy> : Opcode { 258*700637cbSDimitry Andric let Types = [SingletonTypeClass<Ty>]; 259*700637cbSDimitry Andric let Args = [ArgTy]; 260*700637cbSDimitry Andric let Name = "Const"; 261*700637cbSDimitry Andric} 262*700637cbSDimitry Andric 263*700637cbSDimitry Andric// [] -> [Integer] 264*700637cbSDimitry Andricdef ConstSint8 : ConstOpcode<Sint8, ArgSint8>; 265*700637cbSDimitry Andricdef ConstUint8 : ConstOpcode<Uint8, ArgUint8>; 266*700637cbSDimitry Andricdef ConstSint16 : ConstOpcode<Sint16, ArgSint16>; 267*700637cbSDimitry Andricdef ConstUint16 : ConstOpcode<Uint16, ArgUint16>; 268*700637cbSDimitry Andricdef ConstSint32 : ConstOpcode<Sint32, ArgSint32>; 269*700637cbSDimitry Andricdef ConstUint32 : ConstOpcode<Uint32, ArgUint32>; 270*700637cbSDimitry Andricdef ConstSint64 : ConstOpcode<Sint64, ArgSint64>; 271*700637cbSDimitry Andricdef ConstUint64 : ConstOpcode<Uint64, ArgUint64>; 272*700637cbSDimitry Andricdef ConstIntAP : ConstOpcode<IntAP, ArgIntAP>; 273*700637cbSDimitry Andricdef ConstIntAPS : ConstOpcode<IntAPS, ArgIntAPS>; 274*700637cbSDimitry Andricdef ConstBool : ConstOpcode<Bool, ArgBool>; 275*700637cbSDimitry Andricdef ConstFixedPoint : ConstOpcode<FixedPoint, ArgFixedPoint>; 276*700637cbSDimitry Andric 277*700637cbSDimitry Andricdef ConstFloat : Opcode { let Args = [ArgFloat]; } 278*700637cbSDimitry Andric 279*700637cbSDimitry Andric// [] -> [Integer] 280*700637cbSDimitry Andricdef Zero : Opcode { 281*700637cbSDimitry Andric let Types = [FixedSizeIntegralTypeClass]; 282*700637cbSDimitry Andric let HasGroup = 1; 283*700637cbSDimitry Andric} 284*700637cbSDimitry Andric 285*700637cbSDimitry Andricdef ZeroIntAP : Opcode { 286*700637cbSDimitry Andric let Args = [ArgUint32]; 287*700637cbSDimitry Andric} 288*700637cbSDimitry Andric 289*700637cbSDimitry Andricdef ZeroIntAPS : Opcode { 290*700637cbSDimitry Andric let Args = [ArgUint32]; 291*700637cbSDimitry Andric} 292*700637cbSDimitry Andric 293*700637cbSDimitry Andric// [] -> [Pointer] 294*700637cbSDimitry Andricdef Null : Opcode { 295*700637cbSDimitry Andric let Types = [PtrTypeClass]; 296*700637cbSDimitry Andric let Args = [ArgUint64, ArgDesc]; 297*700637cbSDimitry Andric let HasGroup = 1; 298*700637cbSDimitry Andric} 299*700637cbSDimitry Andric 300*700637cbSDimitry Andric//===----------------------------------------------------------------------===// 301*700637cbSDimitry Andric// Pointer generation 302*700637cbSDimitry Andric//===----------------------------------------------------------------------===// 303*700637cbSDimitry Andricclass OffsetOpcode : Opcode { 304*700637cbSDimitry Andric let Args = [ArgUint32]; 305*700637cbSDimitry Andric} 306*700637cbSDimitry Andric 307*700637cbSDimitry Andric// [] -> [Pointer] 308*700637cbSDimitry Andricdef GetPtrLocal : OffsetOpcode { 309*700637cbSDimitry Andric bit HasCustomEval = 1; 310*700637cbSDimitry Andric} 311*700637cbSDimitry Andric// [] -> [Pointer] 312*700637cbSDimitry Andricdef GetPtrParam : OffsetOpcode; 313*700637cbSDimitry Andric// [] -> [Pointer] 314*700637cbSDimitry Andricdef GetPtrGlobal : OffsetOpcode; 315*700637cbSDimitry Andric// [Pointer] -> [Pointer] 316*700637cbSDimitry Andricdef GetPtrField : OffsetOpcode; 317*700637cbSDimitry Andricdef GetPtrFieldPop : OffsetOpcode; 318*700637cbSDimitry Andric// [Pointer] -> [Pointer] 319*700637cbSDimitry Andricdef GetPtrActiveField : OffsetOpcode; 320*700637cbSDimitry Andric// [] -> [Pointer] 321*700637cbSDimitry Andricdef GetPtrActiveThisField : OffsetOpcode; 322*700637cbSDimitry Andric// [] -> [Pointer] 323*700637cbSDimitry Andricdef GetPtrThisField : OffsetOpcode; 324*700637cbSDimitry Andric// [Pointer] -> [Pointer] 325*700637cbSDimitry Andricdef GetPtrBase : OffsetOpcode; 326*700637cbSDimitry Andric// [Pointer] -> [Pointer] 327*700637cbSDimitry Andricdef GetPtrBasePop : OffsetOpcode { let Args = [ArgUint32, ArgBool]; } 328*700637cbSDimitry Andricdef GetMemberPtrBasePop : Opcode { 329*700637cbSDimitry Andric // Offset of field, which is a base. 330*700637cbSDimitry Andric let Args = [ArgSint32]; 331*700637cbSDimitry Andric} 332*700637cbSDimitry Andric 333*700637cbSDimitry Andric 334*700637cbSDimitry Andricdef FinishInitPop : Opcode; 335*700637cbSDimitry Andricdef FinishInit : Opcode; 336*700637cbSDimitry Andricdef FinishInitGlobal : Opcode; 337*700637cbSDimitry Andric 338*700637cbSDimitry Andricdef GetPtrDerivedPop : Opcode { let Args = [ArgUint32, ArgBool, ArgTypePtr]; } 339*700637cbSDimitry Andric 340*700637cbSDimitry Andric// [Pointer] -> [Pointer] 341*700637cbSDimitry Andricdef GetPtrVirtBasePop : Opcode { 342*700637cbSDimitry Andric // RecordDecl of base class. 343*700637cbSDimitry Andric let Args = [ArgRecordDecl]; 344*700637cbSDimitry Andric} 345*700637cbSDimitry Andric// [] -> [Pointer] 346*700637cbSDimitry Andricdef GetPtrThisBase : Opcode { 347*700637cbSDimitry Andric // Offset of field, which is a base. 348*700637cbSDimitry Andric let Args = [ArgUint32]; 349*700637cbSDimitry Andric} 350*700637cbSDimitry Andric// [] -> [Pointer] 351*700637cbSDimitry Andricdef GetPtrThisVirtBase : Opcode { 352*700637cbSDimitry Andric // RecordDecl of base class. 353*700637cbSDimitry Andric let Args = [ArgRecordDecl]; 354*700637cbSDimitry Andric} 355*700637cbSDimitry Andric// [] -> [Pointer] 356*700637cbSDimitry Andricdef This : Opcode; 357*700637cbSDimitry Andric 358*700637cbSDimitry Andric// [] -> [Pointer] 359*700637cbSDimitry Andricdef RVOPtr : Opcode; 360*700637cbSDimitry Andric 361*700637cbSDimitry Andric// [Pointer] -> [Pointer] 362*700637cbSDimitry Andricdef NarrowPtr : Opcode; 363*700637cbSDimitry Andric// [Pointer] -> [Pointer] 364*700637cbSDimitry Andricdef ExpandPtr : Opcode; 365*700637cbSDimitry Andric// [Pointer, Offset] -> [Pointer] 366*700637cbSDimitry Andricdef ArrayElemPtr : AluOpcode; 367*700637cbSDimitry Andricdef ArrayElemPtrPop : AluOpcode; 368*700637cbSDimitry Andric 369*700637cbSDimitry Andricdef ArrayElemPop : Opcode { 370*700637cbSDimitry Andric let Args = [ArgUint32]; 371*700637cbSDimitry Andric let Types = [AllTypeClass]; 372*700637cbSDimitry Andric let HasGroup = 1; 373*700637cbSDimitry Andric} 374*700637cbSDimitry Andric 375*700637cbSDimitry Andricdef ArrayElem : Opcode { 376*700637cbSDimitry Andric let Args = [ArgUint32]; 377*700637cbSDimitry Andric let Types = [AllTypeClass]; 378*700637cbSDimitry Andric let HasGroup = 1; 379*700637cbSDimitry Andric} 380*700637cbSDimitry Andric 381*700637cbSDimitry Andricdef CopyArray : Opcode { 382*700637cbSDimitry Andric let Args = [ArgUint32, ArgUint32, ArgUint32]; 383*700637cbSDimitry Andric let Types = [AllTypeClass]; 384*700637cbSDimitry Andric let HasGroup = 1; 385*700637cbSDimitry Andric} 386*700637cbSDimitry Andric 387*700637cbSDimitry Andric//===----------------------------------------------------------------------===// 388*700637cbSDimitry Andric// Direct field accessors 389*700637cbSDimitry Andric//===----------------------------------------------------------------------===// 390*700637cbSDimitry Andric 391*700637cbSDimitry Andricclass AccessOpcode : Opcode { 392*700637cbSDimitry Andric let Types = [AllTypeClass]; 393*700637cbSDimitry Andric let Args = [ArgUint32]; 394*700637cbSDimitry Andric let HasGroup = 1; 395*700637cbSDimitry Andric} 396*700637cbSDimitry Andric 397*700637cbSDimitry Andricclass BitFieldOpcode : Opcode { 398*700637cbSDimitry Andric let Types = [IntegralTypeClass]; 399*700637cbSDimitry Andric let Args = [ArgRecordField]; 400*700637cbSDimitry Andric let HasGroup = 1; 401*700637cbSDimitry Andric} 402*700637cbSDimitry Andric 403*700637cbSDimitry Andric// [] -> [Pointer] 404*700637cbSDimitry Andricdef GetLocal : AccessOpcode { let HasCustomEval = 1; } 405*700637cbSDimitry Andric// [] -> [Pointer] 406*700637cbSDimitry Andricdef SetLocal : AccessOpcode { let HasCustomEval = 1; } 407*700637cbSDimitry Andric 408*700637cbSDimitry Andricdef EndLifetimePop : Opcode; 409*700637cbSDimitry Andricdef EndLifetime : Opcode; 410*700637cbSDimitry Andricdef StartLifetime : Opcode; 411*700637cbSDimitry Andric 412*700637cbSDimitry Andricdef CheckDecl : Opcode { 413*700637cbSDimitry Andric let Args = [ArgVarDecl]; 414*700637cbSDimitry Andric} 415*700637cbSDimitry Andric 416*700637cbSDimitry Andricdef CheckEnumValue : Opcode { 417*700637cbSDimitry Andric let Args = [ArgEnumDecl]; 418*700637cbSDimitry Andric let Types = [FixedSizeIntegralTypeClass]; 419*700637cbSDimitry Andric let HasGroup = 1; 420*700637cbSDimitry Andric} 421*700637cbSDimitry Andric 422*700637cbSDimitry Andricdef CheckLiteralType : Opcode { 423*700637cbSDimitry Andric let Args = [ArgTypePtr]; 424*700637cbSDimitry Andric} 425*700637cbSDimitry Andric 426*700637cbSDimitry Andricdef CheckArraySize : Opcode { let Args = [ArgUint64]; } 427*700637cbSDimitry Andric 428*700637cbSDimitry Andric// [] -> [Value] 429*700637cbSDimitry Andricdef GetGlobal : AccessOpcode; 430*700637cbSDimitry Andricdef GetGlobalUnchecked : AccessOpcode; 431*700637cbSDimitry Andric// [Value] -> [] 432*700637cbSDimitry Andricdef InitGlobal : AccessOpcode; 433*700637cbSDimitry Andric// [Value] -> [] 434*700637cbSDimitry Andricdef InitGlobalTemp : AccessOpcode { 435*700637cbSDimitry Andric let Args = [ArgUint32, ArgLETD]; 436*700637cbSDimitry Andric} 437*700637cbSDimitry Andric// [Pointer] -> [Pointer] 438*700637cbSDimitry Andricdef InitGlobalTempComp : Opcode { 439*700637cbSDimitry Andric let Args = [ArgLETD]; 440*700637cbSDimitry Andric} 441*700637cbSDimitry Andric// [Value] -> [] 442*700637cbSDimitry Andricdef SetGlobal : AccessOpcode; 443*700637cbSDimitry Andric 444*700637cbSDimitry Andric// [] -> [Value] 445*700637cbSDimitry Andricdef GetParam : AccessOpcode; 446*700637cbSDimitry Andric// [Value] -> [] 447*700637cbSDimitry Andricdef SetParam : AccessOpcode; 448*700637cbSDimitry Andric 449*700637cbSDimitry Andric// [Pointer] -> [Pointer, Value] 450*700637cbSDimitry Andricdef GetField : AccessOpcode; 451*700637cbSDimitry Andric// [Pointer] -> [Value] 452*700637cbSDimitry Andricdef GetFieldPop : AccessOpcode; 453*700637cbSDimitry Andric// [] -> [Value] 454*700637cbSDimitry Andricdef GetThisField : AccessOpcode; 455*700637cbSDimitry Andric 456*700637cbSDimitry Andric// [Pointer, Value] -> [Pointer] 457*700637cbSDimitry Andricdef SetField : AccessOpcode; 458*700637cbSDimitry Andric// [Value] -> [] 459*700637cbSDimitry Andricdef SetThisField : AccessOpcode; 460*700637cbSDimitry Andric 461*700637cbSDimitry Andric// [Value] -> [] 462*700637cbSDimitry Andricdef InitThisField : AccessOpcode; 463*700637cbSDimitry Andric// [Value] -> [] 464*700637cbSDimitry Andricdef InitThisBitField : Opcode { 465*700637cbSDimitry Andric let Types = [AluTypeClass]; 466*700637cbSDimitry Andric let Args = [ArgRecordField, ArgUint32]; 467*700637cbSDimitry Andric let HasGroup = 1; 468*700637cbSDimitry Andric} 469*700637cbSDimitry Andric// [Pointer, Value] -> [] 470*700637cbSDimitry Andricdef InitField : AccessOpcode; 471*700637cbSDimitry Andric// [Pointer, Value] -> [] 472*700637cbSDimitry Andricdef InitBitField : BitFieldOpcode; 473*700637cbSDimitry Andric 474*700637cbSDimitry Andric//===----------------------------------------------------------------------===// 475*700637cbSDimitry Andric// Pointer access 476*700637cbSDimitry Andric//===----------------------------------------------------------------------===// 477*700637cbSDimitry Andric 478*700637cbSDimitry Andricclass LoadOpcode : Opcode { 479*700637cbSDimitry Andric let Types = [AllTypeClass]; 480*700637cbSDimitry Andric let HasGroup = 1; 481*700637cbSDimitry Andric} 482*700637cbSDimitry Andric 483*700637cbSDimitry Andric// [Pointer] -> [Pointer, Value] 484*700637cbSDimitry Andricdef Load : LoadOpcode {} 485*700637cbSDimitry Andric// [Pointer] -> [Value] 486*700637cbSDimitry Andricdef LoadPop : LoadOpcode {} 487*700637cbSDimitry Andric 488*700637cbSDimitry Andricclass StoreOpcode : Opcode { 489*700637cbSDimitry Andric let Types = [AllTypeClass]; 490*700637cbSDimitry Andric let HasGroup = 1; 491*700637cbSDimitry Andric} 492*700637cbSDimitry Andric 493*700637cbSDimitry Andricclass StoreBitFieldOpcode : Opcode { 494*700637cbSDimitry Andric let Types = [AluTypeClass]; 495*700637cbSDimitry Andric let HasGroup = 1; 496*700637cbSDimitry Andric} 497*700637cbSDimitry Andric 498*700637cbSDimitry Andric// [Pointer, Value] -> [Pointer] 499*700637cbSDimitry Andricdef Store : StoreOpcode {} 500*700637cbSDimitry Andric// [Pointer, Value] -> [] 501*700637cbSDimitry Andricdef StorePop : StoreOpcode {} 502*700637cbSDimitry Andric 503*700637cbSDimitry Andric// [Pointer, Value] -> [Pointer] 504*700637cbSDimitry Andricdef StoreBitField : StoreBitFieldOpcode {} 505*700637cbSDimitry Andric// [Pointer, Value] -> [] 506*700637cbSDimitry Andricdef StoreBitFieldPop : StoreBitFieldOpcode {} 507*700637cbSDimitry Andric 508*700637cbSDimitry Andric// [Pointer, Value] -> [] 509*700637cbSDimitry Andricdef Init : StoreOpcode {} 510*700637cbSDimitry Andricdef InitPop : StoreOpcode {} 511*700637cbSDimitry Andric// [Pointer, Value] -> [Pointer] 512*700637cbSDimitry Andricdef InitElem : Opcode { 513*700637cbSDimitry Andric let Types = [AllTypeClass]; 514*700637cbSDimitry Andric let Args = [ArgUint32]; 515*700637cbSDimitry Andric let HasGroup = 1; 516*700637cbSDimitry Andric} 517*700637cbSDimitry Andric// [Pointer, Value] -> [] 518*700637cbSDimitry Andricdef InitElemPop : Opcode { 519*700637cbSDimitry Andric let Types = [AllTypeClass]; 520*700637cbSDimitry Andric let Args = [ArgUint32]; 521*700637cbSDimitry Andric let HasGroup = 1; 522*700637cbSDimitry Andric} 523*700637cbSDimitry Andric 524*700637cbSDimitry Andric//===----------------------------------------------------------------------===// 525*700637cbSDimitry Andric// Pointer arithmetic. 526*700637cbSDimitry Andric//===----------------------------------------------------------------------===// 527*700637cbSDimitry Andric 528*700637cbSDimitry Andric// [Pointer, Integral] -> [Pointer] 529*700637cbSDimitry Andricdef AddOffset : AluOpcode; 530*700637cbSDimitry Andric// [Pointer, Integral] -> [Pointer] 531*700637cbSDimitry Andricdef SubOffset : AluOpcode; 532*700637cbSDimitry Andric 533*700637cbSDimitry Andric// [Pointer, Pointer] -> [Integral] 534*700637cbSDimitry Andricdef SubPtr : Opcode { 535*700637cbSDimitry Andric let Types = [IntegerTypeClass]; 536*700637cbSDimitry Andric let HasGroup = 1; 537*700637cbSDimitry Andric} 538*700637cbSDimitry Andric 539*700637cbSDimitry Andric// [Pointer] -> [Pointer] 540*700637cbSDimitry Andricdef IncPtr : Opcode; 541*700637cbSDimitry Andric// [Pointer] -> [Pointer] 542*700637cbSDimitry Andricdef DecPtr : Opcode; 543*700637cbSDimitry Andric 544*700637cbSDimitry Andric//===----------------------------------------------------------------------===// 545*700637cbSDimitry Andric// Function pointers. 546*700637cbSDimitry Andric//===----------------------------------------------------------------------===// 547*700637cbSDimitry Andricdef GetFnPtr : Opcode { 548*700637cbSDimitry Andric let Args = [ArgFunction]; 549*700637cbSDimitry Andric} 550*700637cbSDimitry Andric 551*700637cbSDimitry Andricdef GetIntPtr : Opcode { 552*700637cbSDimitry Andric let Types = [AluTypeClass]; 553*700637cbSDimitry Andric let Args = [ArgDesc]; 554*700637cbSDimitry Andric let HasGroup = 1; 555*700637cbSDimitry Andric} 556*700637cbSDimitry Andric 557*700637cbSDimitry Andric//===----------------------------------------------------------------------===// 558*700637cbSDimitry Andric// Binary operators. 559*700637cbSDimitry Andric//===----------------------------------------------------------------------===// 560*700637cbSDimitry Andric 561*700637cbSDimitry Andric// [Real, Real] -> [Real] 562*700637cbSDimitry Andricdef Add : AluOpcode; 563*700637cbSDimitry Andricdef Addf : FloatOpcode; 564*700637cbSDimitry Andricdef Sub : AluOpcode; 565*700637cbSDimitry Andricdef Subf : FloatOpcode; 566*700637cbSDimitry Andricdef Mul : AluOpcode; 567*700637cbSDimitry Andricdef Mulf : FloatOpcode; 568*700637cbSDimitry Andricdef Mulc : Opcode { 569*700637cbSDimitry Andric let Types = [NumberTypeClass]; 570*700637cbSDimitry Andric let HasGroup = 1; 571*700637cbSDimitry Andric} 572*700637cbSDimitry Andricdef Rem : IntegerOpcode; 573*700637cbSDimitry Andricdef Div : IntegerOpcode; 574*700637cbSDimitry Andricdef Divf : FloatOpcode; 575*700637cbSDimitry Andricdef Divc : Opcode { 576*700637cbSDimitry Andric let Types = [NumberTypeClass]; 577*700637cbSDimitry Andric let HasGroup = 1; 578*700637cbSDimitry Andric} 579*700637cbSDimitry Andric 580*700637cbSDimitry Andricdef BitAnd : IntegerOpcode; 581*700637cbSDimitry Andricdef BitOr : IntegerOpcode; 582*700637cbSDimitry Andricdef BitXor : IntegerOpcode; 583*700637cbSDimitry Andric 584*700637cbSDimitry Andricdef Shl : Opcode { 585*700637cbSDimitry Andric let Types = [IntegerTypeClass, IntegerTypeClass]; 586*700637cbSDimitry Andric let HasGroup = 1; 587*700637cbSDimitry Andric} 588*700637cbSDimitry Andric 589*700637cbSDimitry Andricdef Shr : Opcode { 590*700637cbSDimitry Andric let Types = [IntegerTypeClass, IntegerTypeClass]; 591*700637cbSDimitry Andric let HasGroup = 1; 592*700637cbSDimitry Andric} 593*700637cbSDimitry Andric 594*700637cbSDimitry Andric//===----------------------------------------------------------------------===// 595*700637cbSDimitry Andric// Unary operators. 596*700637cbSDimitry Andric//===----------------------------------------------------------------------===// 597*700637cbSDimitry Andric 598*700637cbSDimitry Andric// [Bool] -> [Bool] 599*700637cbSDimitry Andricdef Inv: Opcode; 600*700637cbSDimitry Andric 601*700637cbSDimitry Andric// Increment and decrement. 602*700637cbSDimitry Andricclass OverflowOpcode : Opcode { 603*700637cbSDimitry Andric let Types = [AluTypeClass]; 604*700637cbSDimitry Andric let Args = [ArgBool]; 605*700637cbSDimitry Andric let HasGroup = 1; 606*700637cbSDimitry Andric} 607*700637cbSDimitry Andric 608*700637cbSDimitry Andricdef Inc : OverflowOpcode; 609*700637cbSDimitry Andricdef IncPop : OverflowOpcode; 610*700637cbSDimitry Andricdef PreInc : OverflowOpcode; 611*700637cbSDimitry Andricdef Dec : OverflowOpcode; 612*700637cbSDimitry Andricdef DecPop : OverflowOpcode; 613*700637cbSDimitry Andricdef PreDec : OverflowOpcode; 614*700637cbSDimitry Andric 615*700637cbSDimitry Andric// Float increment and decrement. 616*700637cbSDimitry Andricdef Incf: FloatOpcode; 617*700637cbSDimitry Andricdef IncfPop : FloatOpcode; 618*700637cbSDimitry Andricdef Decf: FloatOpcode; 619*700637cbSDimitry Andricdef DecfPop : FloatOpcode; 620*700637cbSDimitry Andric 621*700637cbSDimitry Andric// [Real] -> [Real] 622*700637cbSDimitry Andricdef Neg: Opcode { 623*700637cbSDimitry Andric let Types = [NonPtrTypeClass]; 624*700637cbSDimitry Andric let HasGroup = 1; 625*700637cbSDimitry Andric} 626*700637cbSDimitry Andric 627*700637cbSDimitry Andric// [Real] -> [Real] 628*700637cbSDimitry Andricdef Comp: Opcode { 629*700637cbSDimitry Andric let Types = [IntegerTypeClass]; 630*700637cbSDimitry Andric let HasGroup = 1; 631*700637cbSDimitry Andric} 632*700637cbSDimitry Andric 633*700637cbSDimitry Andricdef IsNonNull : Opcode { 634*700637cbSDimitry Andric let Types = [PtrTypeClass]; 635*700637cbSDimitry Andric let HasGroup = 1; 636*700637cbSDimitry Andric} 637*700637cbSDimitry Andric 638*700637cbSDimitry Andric//===----------------------------------------------------------------------===// 639*700637cbSDimitry Andric// Cast, CastFP. 640*700637cbSDimitry Andric//===----------------------------------------------------------------------===// 641*700637cbSDimitry Andric 642*700637cbSDimitry Andricdef FromCastTypeClass : TypeClass { 643*700637cbSDimitry Andric let Types = [Uint8, Sint8, Uint16, Sint16, Uint32, Sint32, Uint64, Sint64, Bool, IntAP, IntAPS, FixedPoint]; 644*700637cbSDimitry Andric} 645*700637cbSDimitry Andric 646*700637cbSDimitry Andricdef ToCastTypeClass : TypeClass { 647*700637cbSDimitry Andric let Types = [Uint8, Sint8, Uint16, Sint16, Uint32, Sint32, Uint64, Sint64, Bool]; 648*700637cbSDimitry Andric} 649*700637cbSDimitry Andric 650*700637cbSDimitry Andricdef Cast: Opcode { 651*700637cbSDimitry Andric let Types = [FromCastTypeClass, ToCastTypeClass]; 652*700637cbSDimitry Andric let HasGroup = 1; 653*700637cbSDimitry Andric} 654*700637cbSDimitry Andric 655*700637cbSDimitry Andricdef CastFP : Opcode { 656*700637cbSDimitry Andric let Args = [ArgFltSemantics, ArgRoundingMode]; 657*700637cbSDimitry Andric} 658*700637cbSDimitry Andric 659*700637cbSDimitry Andricdef CastFixedPoint : Opcode { 660*700637cbSDimitry Andric let Args = [ArgUint32]; 661*700637cbSDimitry Andric} 662*700637cbSDimitry Andric 663*700637cbSDimitry Andricdef CastAP : Opcode { 664*700637cbSDimitry Andric let Types = [AluTypeClass]; 665*700637cbSDimitry Andric let Args = [ArgUint32]; 666*700637cbSDimitry Andric let HasGroup = 1; 667*700637cbSDimitry Andric} 668*700637cbSDimitry Andric 669*700637cbSDimitry Andricdef CastAPS : Opcode { 670*700637cbSDimitry Andric let Types = [AluTypeClass]; 671*700637cbSDimitry Andric let Args = [ArgUint32]; 672*700637cbSDimitry Andric let HasGroup = 1; 673*700637cbSDimitry Andric} 674*700637cbSDimitry Andric 675*700637cbSDimitry Andric// Cast an integer to a floating type 676*700637cbSDimitry Andricdef CastIntegralFloating : Opcode { 677*700637cbSDimitry Andric let Types = [AluTypeClass]; 678*700637cbSDimitry Andric let Args = [ArgFltSemantics, ArgUint32]; 679*700637cbSDimitry Andric let HasGroup = 1; 680*700637cbSDimitry Andric} 681*700637cbSDimitry Andric 682*700637cbSDimitry Andric// Cast a floating to an integer type 683*700637cbSDimitry Andricdef CastFloatingIntegral : Opcode { 684*700637cbSDimitry Andric let Types = [FixedSizeIntegralTypeClass]; 685*700637cbSDimitry Andric let Args = [ArgUint32]; 686*700637cbSDimitry Andric let HasGroup = 1; 687*700637cbSDimitry Andric} 688*700637cbSDimitry Andric 689*700637cbSDimitry Andricdef CastFloatingIntegralAP : Opcode { 690*700637cbSDimitry Andric let Args = [ArgUint32, ArgUint32]; 691*700637cbSDimitry Andric} 692*700637cbSDimitry Andric 693*700637cbSDimitry Andricdef CastFloatingIntegralAPS : Opcode { 694*700637cbSDimitry Andric let Args = [ArgUint32, ArgUint32]; 695*700637cbSDimitry Andric} 696*700637cbSDimitry Andric 697*700637cbSDimitry Andricdef CastPointerIntegral : Opcode { 698*700637cbSDimitry Andric let Types = [FixedSizeIntegralTypeClass]; 699*700637cbSDimitry Andric let HasGroup = 1; 700*700637cbSDimitry Andric} 701*700637cbSDimitry Andricdef CastPointerIntegralAP : Opcode { 702*700637cbSDimitry Andric let Args = [ArgUint32]; 703*700637cbSDimitry Andric} 704*700637cbSDimitry Andricdef CastPointerIntegralAPS : Opcode { 705*700637cbSDimitry Andric let Args = [ArgUint32]; 706*700637cbSDimitry Andric} 707*700637cbSDimitry Andricdef CastIntegralFixedPoint : Opcode { 708*700637cbSDimitry Andric let Types = [FixedSizeIntegralTypeClass]; 709*700637cbSDimitry Andric let Args = [ArgUint32]; 710*700637cbSDimitry Andric let HasGroup = 1; 711*700637cbSDimitry Andric} 712*700637cbSDimitry Andricdef CastFloatingFixedPoint : Opcode { 713*700637cbSDimitry Andric let Args = [ArgUint32]; 714*700637cbSDimitry Andric} 715*700637cbSDimitry Andricdef CastFixedPointFloating : Opcode { 716*700637cbSDimitry Andric let Args = [ArgFltSemantics]; 717*700637cbSDimitry Andric} 718*700637cbSDimitry Andricdef CastFixedPointIntegral : Opcode { 719*700637cbSDimitry Andric let Types = [FixedSizeIntegralNoBoolTypeClass]; 720*700637cbSDimitry Andric let HasGroup = 1; 721*700637cbSDimitry Andric} 722*700637cbSDimitry Andricdef ShiftFixedPoint : Opcode { 723*700637cbSDimitry Andric let Args = [ArgBool]; 724*700637cbSDimitry Andric} 725*700637cbSDimitry Andric 726*700637cbSDimitry Andricdef PtrPtrCast : Opcode { 727*700637cbSDimitry Andric let Args = [ArgBool]; 728*700637cbSDimitry Andric 729*700637cbSDimitry Andric} 730*700637cbSDimitry Andric 731*700637cbSDimitry Andricdef DecayPtr : Opcode { 732*700637cbSDimitry Andric let Types = [PtrTypeClass, PtrTypeClass]; 733*700637cbSDimitry Andric let HasGroup = 1; 734*700637cbSDimitry Andric} 735*700637cbSDimitry Andric 736*700637cbSDimitry Andric//===----------------------------------------------------------------------===// 737*700637cbSDimitry Andric// Comparison opcodes. 738*700637cbSDimitry Andric//===----------------------------------------------------------------------===// 739*700637cbSDimitry Andric 740*700637cbSDimitry Andricclass EqualityOpcode : Opcode { 741*700637cbSDimitry Andric let Types = [AllTypeClass]; 742*700637cbSDimitry Andric let HasGroup = 1; 743*700637cbSDimitry Andric} 744*700637cbSDimitry Andric 745*700637cbSDimitry Andricdef EQ : EqualityOpcode; 746*700637cbSDimitry Andricdef NE : EqualityOpcode; 747*700637cbSDimitry Andric 748*700637cbSDimitry Andricclass ComparisonOpcode : Opcode { 749*700637cbSDimitry Andric let Types = [ComparableTypeClass]; 750*700637cbSDimitry Andric let HasGroup = 1; 751*700637cbSDimitry Andric} 752*700637cbSDimitry Andric 753*700637cbSDimitry Andricdef CMP3 : ComparisonOpcode { 754*700637cbSDimitry Andric let Args = [ArgCCI]; 755*700637cbSDimitry Andric} 756*700637cbSDimitry Andric 757*700637cbSDimitry Andricdef LT : ComparisonOpcode; 758*700637cbSDimitry Andricdef LE : ComparisonOpcode; 759*700637cbSDimitry Andricdef GT : ComparisonOpcode; 760*700637cbSDimitry Andricdef GE : ComparisonOpcode; 761*700637cbSDimitry Andric 762*700637cbSDimitry Andric//===----------------------------------------------------------------------===// 763*700637cbSDimitry Andric// Stack management. 764*700637cbSDimitry Andric//===----------------------------------------------------------------------===// 765*700637cbSDimitry Andric 766*700637cbSDimitry Andric// [Value] -> [] 767*700637cbSDimitry Andricdef Pop : Opcode { 768*700637cbSDimitry Andric let Types = [AllTypeClass]; 769*700637cbSDimitry Andric let HasGroup = 1; 770*700637cbSDimitry Andric} 771*700637cbSDimitry Andric 772*700637cbSDimitry Andric// [Value] -> [Value, Value] 773*700637cbSDimitry Andricdef Dup : Opcode { 774*700637cbSDimitry Andric let Types = [AllTypeClass]; 775*700637cbSDimitry Andric let HasGroup = 1; 776*700637cbSDimitry Andric} 777*700637cbSDimitry Andric 778*700637cbSDimitry Andricdef Flip : Opcode { 779*700637cbSDimitry Andric let Types = [AllTypeClass, AllTypeClass]; 780*700637cbSDimitry Andric let HasGroup = 1; 781*700637cbSDimitry Andric} 782*700637cbSDimitry Andric 783*700637cbSDimitry Andric// [] -> [] 784*700637cbSDimitry Andricdef Invalid : Opcode {} 785*700637cbSDimitry Andricdef Unsupported : Opcode {} 786*700637cbSDimitry Andricdef Error : Opcode {} 787*700637cbSDimitry Andricdef SideEffect : Opcode {} 788*700637cbSDimitry Andricdef InvalidCast : Opcode { 789*700637cbSDimitry Andric let Args = [ArgCastKind, ArgBool]; 790*700637cbSDimitry Andric} 791*700637cbSDimitry Andricdef CheckPseudoDtor : Opcode {} 792*700637cbSDimitry Andric 793*700637cbSDimitry Andricdef InvalidDeclRef : Opcode { 794*700637cbSDimitry Andric let Args = [ArgDeclRef, ArgBool]; 795*700637cbSDimitry Andric} 796*700637cbSDimitry Andric 797*700637cbSDimitry Andricdef SizelessVectorElementSize : Opcode; 798*700637cbSDimitry Andricdef InvalidShuffleVectorIndex : Opcode { 799*700637cbSDimitry Andric let Args = [ArgUint32]; 800*700637cbSDimitry Andric} 801*700637cbSDimitry Andric 802*700637cbSDimitry Andricdef Assume : Opcode; 803*700637cbSDimitry Andric 804*700637cbSDimitry Andricdef ArrayDecay : Opcode; 805*700637cbSDimitry Andric 806*700637cbSDimitry Andricdef CheckNonNullArg : Opcode { 807*700637cbSDimitry Andric let Types = [PtrTypeClass]; 808*700637cbSDimitry Andric let HasGroup = 1; 809*700637cbSDimitry Andric} 810*700637cbSDimitry Andric 811*700637cbSDimitry Andricdef Memcpy : Opcode; 812*700637cbSDimitry Andric 813*700637cbSDimitry Andricdef ToMemberPtr : Opcode; 814*700637cbSDimitry Andricdef CastMemberPtrPtr : Opcode; 815*700637cbSDimitry Andricdef GetMemberPtr : Opcode { 816*700637cbSDimitry Andric let Args = [ArgValueDecl]; 817*700637cbSDimitry Andric} 818*700637cbSDimitry Andricdef GetMemberPtrBase : Opcode; 819*700637cbSDimitry Andricdef GetMemberPtrDecl : Opcode; 820*700637cbSDimitry Andric 821*700637cbSDimitry Andric//===----------------------------------------------------------------------===// 822*700637cbSDimitry Andric// Debugging. 823*700637cbSDimitry Andric//===----------------------------------------------------------------------===// 824*700637cbSDimitry Andricdef Dump : Opcode; 825*700637cbSDimitry Andric 826*700637cbSDimitry Andricdef Alloc : Opcode { 827*700637cbSDimitry Andric let Args = [ArgDesc]; 828*700637cbSDimitry Andric} 829*700637cbSDimitry Andric 830*700637cbSDimitry Andricdef AllocN : Opcode { 831*700637cbSDimitry Andric let Types = [IntegerTypeClass]; 832*700637cbSDimitry Andric let Args = [ArgPrimType, ArgExpr, ArgBool]; 833*700637cbSDimitry Andric let HasGroup = 1; 834*700637cbSDimitry Andric} 835*700637cbSDimitry Andric 836*700637cbSDimitry Andricdef AllocCN : Opcode { 837*700637cbSDimitry Andric let Types = [IntegerTypeClass]; 838*700637cbSDimitry Andric let Args = [ArgDesc, ArgBool]; 839*700637cbSDimitry Andric let HasGroup = 1; 840*700637cbSDimitry Andric} 841*700637cbSDimitry Andric 842*700637cbSDimitry Andricdef Free : Opcode { 843*700637cbSDimitry Andric let Args = [ArgBool, ArgBool]; 844*700637cbSDimitry Andric} 845*700637cbSDimitry Andric 846*700637cbSDimitry Andricdef CheckNewTypeMismatch : Opcode { 847*700637cbSDimitry Andric let Args = [ArgExpr]; 848*700637cbSDimitry Andric} 849*700637cbSDimitry Andric 850*700637cbSDimitry Andricdef InvalidNewDeleteExpr : Opcode { 851*700637cbSDimitry Andric let Args = [ArgExpr]; 852*700637cbSDimitry Andric} 853*700637cbSDimitry Andric 854*700637cbSDimitry Andricdef CheckNewTypeMismatchArray : Opcode { 855*700637cbSDimitry Andric let Types = [IntegerTypeClass]; 856*700637cbSDimitry Andric let Args = [ArgExpr]; 857*700637cbSDimitry Andric let HasGroup = 1; 858*700637cbSDimitry Andric} 859*700637cbSDimitry Andric 860*700637cbSDimitry Andricdef IsConstantContext: Opcode; 861*700637cbSDimitry Andricdef CheckAllocations : Opcode; 862*700637cbSDimitry Andric 863*700637cbSDimitry Andricdef BitCastTypeClass : TypeClass { 864*700637cbSDimitry Andric let Types = [Uint8, Sint8, Uint16, Sint16, Uint32, Sint32, Uint64, Sint64, 865*700637cbSDimitry Andric IntAP, IntAPS, Bool, Float, Ptr]; 866*700637cbSDimitry Andric} 867*700637cbSDimitry Andric 868*700637cbSDimitry Andricdef BitCastPrim : Opcode { 869*700637cbSDimitry Andric let Types = [BitCastTypeClass]; 870*700637cbSDimitry Andric let Args = [ArgBool, ArgUint32, ArgFltSemantics]; 871*700637cbSDimitry Andric let HasGroup = 1; 872*700637cbSDimitry Andric} 873*700637cbSDimitry Andric 874*700637cbSDimitry Andricdef BitCast : Opcode; 875*700637cbSDimitry Andric 876*700637cbSDimitry Andricdef GetTypeid : Opcode { let Args = [ArgTypePtr, ArgTypePtr]; } 877*700637cbSDimitry Andricdef GetTypeidPtr : Opcode { let Args = [ArgTypePtr]; } 878*700637cbSDimitry Andricdef DiagTypeid : Opcode; 879*700637cbSDimitry Andric 880*700637cbSDimitry Andricdef CheckDestruction : Opcode; 881*700637cbSDimitry Andric 882*700637cbSDimitry Andricdef PushCC : Opcode { let Args = [ArgBool]; } 883*700637cbSDimitry Andricdef PopCC : Opcode; 884