//===- SandboxIRValues.def --------------------------------------*- 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
//
//===----------------------------------------------------------------------===//

//    ClassID, Class
#ifndef DEF_VALUE
#define DEF_VALUE(ID, CLASS)
#endif
DEF_VALUE(Function, Function)
DEF_VALUE(Argument, Argument)

#ifndef DEF_USER
#define DEF_USER(ID, CLASS)
#endif
DEF_USER(User, User)
DEF_VALUE(Block, BasicBlock)
DEF_USER(Constant, Constant)

#ifndef DEF_INSTR
#define DEF_INSTR(ID, OPCODE, CLASS)
#endif

#ifndef OP
#define OP(OPCODE)
#endif

#ifndef OPCODES
#define OPCODES(...)
#endif
// clang-format off
//        ClassID,        Opcode(s),          Class
DEF_INSTR(Opaque,         OP(Opaque),         OpaqueInst)
DEF_INSTR(ExtractElement, OP(ExtractElement), ExtractElementInst)
DEF_INSTR(InsertElement,  OP(InsertElement),  InsertElementInst)
DEF_INSTR(Select,         OP(Select),         SelectInst)
DEF_INSTR(Br,             OP(Br),             BranchInst)
DEF_INSTR(Load,           OP(Load),           LoadInst)
DEF_INSTR(Store,          OP(Store),          StoreInst)
DEF_INSTR(Ret,            OP(Ret),            ReturnInst)
DEF_INSTR(Call,           OP(Call),           CallInst)
DEF_INSTR(Invoke,         OP(Invoke),         InvokeInst)
DEF_INSTR(CallBr,         OP(CallBr),         CallBrInst)
DEF_INSTR(GetElementPtr,  OP(GetElementPtr),  GetElementPtrInst)
DEF_INSTR(AtomicCmpXchg, OP(AtomicCmpXchg), AtomicCmpXchgInst)
DEF_INSTR(Alloca,         OP(Alloca),         AllocaInst)
DEF_INSTR(Cast,   OPCODES(\
                          OP(ZExt)          \
                          OP(SExt)          \
                          OP(FPToUI)        \
                          OP(FPToSI)        \
                          OP(FPExt)         \
                          OP(PtrToInt)      \
                          OP(IntToPtr)      \
                          OP(SIToFP)        \
                          OP(UIToFP)        \
                          OP(Trunc)         \
                          OP(FPTrunc)       \
                          OP(BitCast)       \
                          OP(AddrSpaceCast) \
                          ),                  CastInst)
DEF_INSTR(PHI,            OP(PHI),            PHINode)
DEF_INSTR(Unreachable,    OP(Unreachable),    UnreachableInst)

// clang-format on
#ifdef DEF_VALUE
#undef DEF_VALUE
#endif
#ifdef DEF_USER
#undef DEF_USER
#endif
#ifdef DEF_INSTR
#undef DEF_INSTR
#endif
#ifdef OP
#undef OP
#endif
#ifdef OPCODES
#undef OPCODES
#endif
