{-# LINE 1 "src/LLVM/Internal/FFI/InstructionDefs.hsc" #-}
-- This module translates the instruction data in "llvm/Instruction.def" into a Haskell data structure,
{-# LINE 2 "src/LLVM/Internal/FFI/InstructionDefs.hsc" #-}
-- so it may be accessed conveniently with Template Haskell code
module LLVM.Internal.FFI.InstructionDefs where

import LLVM.Prelude

import LLVM.Internal.FFI.LLVMCTypes


{-# LINE 20 "src/LLVM/Internal/FFI/InstructionDefs.hsc" #-}


{-# LINE 22 "src/LLVM/Internal/FFI/InstructionDefs.hsc" #-}


{-# LINE 24 "src/LLVM/Internal/FFI/InstructionDefs.hsc" #-}


{-# LINE 42 "src/LLVM/Internal/FFI/InstructionDefs.hsc" #-}

data InstructionKind = Terminator | Binary | Memory | Cast | FuncletPad | Other
  deriving (Eq, Ord, Show)

data InstructionDef = InstructionDef {
    cppOpcode :: CPPOpcode,
    cAPIName :: String,
    cAPIClassName :: String,
    instructionKind :: InstructionKind
  }
  deriving (Eq, Ord, Show)

instructionDefs :: [InstructionDef]
instructionDefs = [ 
 InstructionDef o an acn k
 | (o, an, acn, k) <-
   [ (CPPOpcode 1,"Ret","ReturnInst", Terminator)
   , (CPPOpcode 2,"Br","BranchInst", Terminator)
   , (CPPOpcode 3,"Switch","SwitchInst", Terminator)
   , (CPPOpcode 4,"IndirectBr","IndirectBrInst", Terminator)
   , (CPPOpcode 5,"Invoke","InvokeInst", Terminator)
   , (CPPOpcode 6,"Resume","ResumeInst", Terminator)
   , (CPPOpcode 7,"Unreachable","UnreachableInst", Terminator)
   , (CPPOpcode 8,"CleanupRet","CleanupReturnInst", Terminator)
   , (CPPOpcode 9,"CatchRet","CatchReturnInst", Terminator)
   , (CPPOpcode 10,"CatchSwitch","CatchSwitchInst", Terminator)
   , (CPPOpcode 11,"Add","BinaryOperator", Binary)
   , (CPPOpcode 12,"FAdd","BinaryOperator", Binary)
   , (CPPOpcode 13,"Sub","BinaryOperator", Binary)
   , (CPPOpcode 14,"FSub","BinaryOperator", Binary)
   , (CPPOpcode 15,"Mul","BinaryOperator", Binary)
   , (CPPOpcode 16,"FMul","BinaryOperator", Binary)
   , (CPPOpcode 17,"UDiv","BinaryOperator", Binary)
   , (CPPOpcode 18,"SDiv","BinaryOperator", Binary)
   , (CPPOpcode 19,"FDiv","BinaryOperator", Binary)
   , (CPPOpcode 20,"URem","BinaryOperator", Binary)
   , (CPPOpcode 21,"SRem","BinaryOperator", Binary)
   , (CPPOpcode 22,"FRem","BinaryOperator", Binary)
   , (CPPOpcode 23,"Shl","BinaryOperator", Binary)
   , (CPPOpcode 24,"LShr","BinaryOperator", Binary)
   , (CPPOpcode 25,"AShr","BinaryOperator", Binary)
   , (CPPOpcode 26,"And","BinaryOperator", Binary)
   , (CPPOpcode 27,"Or","BinaryOperator", Binary)
   , (CPPOpcode 28,"Xor","BinaryOperator", Binary)
   , (CPPOpcode 29,"Alloca","AllocaInst", Memory)
   , (CPPOpcode 30,"Load","LoadInst", Memory)
   , (CPPOpcode 31,"Store","StoreInst", Memory)
   , (CPPOpcode 32,"GetElementPtr","GetElementPtrInst", Memory)
   , (CPPOpcode 33,"Fence","FenceInst", Memory)
   , (CPPOpcode 34,"AtomicCmpXchg","AtomicCmpXchgInst", Memory)
   , (CPPOpcode 35,"AtomicRMW","AtomicRMWInst", Memory)
   , (CPPOpcode 36,"Trunc","TruncInst", Cast)
   , (CPPOpcode 37,"ZExt","ZExtInst", Cast)
   , (CPPOpcode 38,"SExt","SExtInst", Cast)
   , (CPPOpcode 39,"FPToUI","FPToUIInst", Cast)
   , (CPPOpcode 40,"FPToSI","FPToSIInst", Cast)
   , (CPPOpcode 41,"UIToFP","UIToFPInst", Cast)
   , (CPPOpcode 42,"SIToFP","SIToFPInst", Cast)
   , (CPPOpcode 43,"FPTrunc","FPTruncInst", Cast)
   , (CPPOpcode 44,"FPExt","FPExtInst", Cast)
   , (CPPOpcode 45,"PtrToInt","PtrToIntInst", Cast)
   , (CPPOpcode 46,"IntToPtr","IntToPtrInst", Cast)
   , (CPPOpcode 47,"BitCast","BitCastInst", Cast)
   , (CPPOpcode 48,"AddrSpaceCast","AddrSpaceCastInst", Cast)
   , (CPPOpcode 49,"CleanupPad","CleanupPadInst", FuncletPad)
   , (CPPOpcode 50,"CatchPad","CatchPadInst", FuncletPad)
   , (CPPOpcode 51,"ICmp","ICmpInst", Other)
   , (CPPOpcode 52,"FCmp","FCmpInst", Other)
   , (CPPOpcode 53,"PHI","PHINode", Other)
   , (CPPOpcode 54,"Call","CallInst", Other)
   , (CPPOpcode 55,"Select","SelectInst", Other)
   , (CPPOpcode 56,"UserOp1","Instruction", Other)
   , (CPPOpcode 57,"UserOp2","Instruction", Other)
   , (CPPOpcode 58,"VAArg","VAArgInst", Other)
   , (CPPOpcode 59,"ExtractElement","ExtractElementInst", Other)
   , (CPPOpcode 60,"InsertElement","InsertElementInst", Other)
   , (CPPOpcode 61,"ShuffleVector","ShuffleVectorInst", Other)
   , (CPPOpcode 62,"ExtractValue","ExtractValueInst", Other)
   , (CPPOpcode 63,"InsertValue","InsertValueInst", Other)
   , (CPPOpcode 64,"LandingPad","LandingPadInst", Other) ] ,
{-# LINE 59 "src/LLVM/Internal/FFI/InstructionDefs.hsc" #-}
 an /= "UserOp1" && an /= "UserOp2"
 ]