github.com/llir/llvm@v0.3.6/ir/instruction.go (about)

     1  package ir
     2  
     3  import "github.com/llir/llvm/ir/value"
     4  
     5  // === [ Instructions ] ========================================================
     6  
     7  // Instruction is an LLVM IR instruction. All instructions (except store and
     8  // fence) implement the value.Named interface and may thus be used directly as
     9  // values.
    10  //
    11  // An Instruction has one of the following underlying types.
    12  //
    13  // Unary instructions
    14  //
    15  // https://llvm.org/docs/LangRef.html#unary-operations
    16  //
    17  //    *ir.InstFNeg   // https://pkg.go.dev/github.com/llir/llvm/ir#InstFNeg
    18  //
    19  // Binary instructions
    20  //
    21  // https://llvm.org/docs/LangRef.html#binary-operations
    22  //
    23  //    *ir.InstAdd    // https://pkg.go.dev/github.com/llir/llvm/ir#InstAdd
    24  //    *ir.InstFAdd   // https://pkg.go.dev/github.com/llir/llvm/ir#InstFAdd
    25  //    *ir.InstSub    // https://pkg.go.dev/github.com/llir/llvm/ir#InstSub
    26  //    *ir.InstFSub   // https://pkg.go.dev/github.com/llir/llvm/ir#InstFSub
    27  //    *ir.InstMul    // https://pkg.go.dev/github.com/llir/llvm/ir#InstMul
    28  //    *ir.InstFMul   // https://pkg.go.dev/github.com/llir/llvm/ir#InstFMul
    29  //    *ir.InstUDiv   // https://pkg.go.dev/github.com/llir/llvm/ir#InstUDiv
    30  //    *ir.InstSDiv   // https://pkg.go.dev/github.com/llir/llvm/ir#InstSDiv
    31  //    *ir.InstFDiv   // https://pkg.go.dev/github.com/llir/llvm/ir#InstFDiv
    32  //    *ir.InstURem   // https://pkg.go.dev/github.com/llir/llvm/ir#InstURem
    33  //    *ir.InstSRem   // https://pkg.go.dev/github.com/llir/llvm/ir#InstSRem
    34  //    *ir.InstFRem   // https://pkg.go.dev/github.com/llir/llvm/ir#InstFRem
    35  //
    36  // Bitwise instructions
    37  //
    38  // https://llvm.org/docs/LangRef.html#bitwise-binary-operations
    39  //
    40  //    *ir.InstShl    // https://pkg.go.dev/github.com/llir/llvm/ir#InstShl
    41  //    *ir.InstLShr   // https://pkg.go.dev/github.com/llir/llvm/ir#InstLShr
    42  //    *ir.InstAShr   // https://pkg.go.dev/github.com/llir/llvm/ir#InstAShr
    43  //    *ir.InstAnd    // https://pkg.go.dev/github.com/llir/llvm/ir#InstAnd
    44  //    *ir.InstOr     // https://pkg.go.dev/github.com/llir/llvm/ir#InstOr
    45  //    *ir.InstXor    // https://pkg.go.dev/github.com/llir/llvm/ir#InstXor
    46  //
    47  // Vector instructions
    48  //
    49  // https://llvm.org/docs/LangRef.html#vector-operations
    50  //
    51  //    *ir.InstExtractElement   // https://pkg.go.dev/github.com/llir/llvm/ir#InstExtractElement
    52  //    *ir.InstInsertElement    // https://pkg.go.dev/github.com/llir/llvm/ir#InstInsertElement
    53  //    *ir.InstShuffleVector    // https://pkg.go.dev/github.com/llir/llvm/ir#InstShuffleVector
    54  //
    55  // Aggregate instructions
    56  //
    57  // https://llvm.org/docs/LangRef.html#aggregate-operations
    58  //
    59  //    *ir.InstExtractValue   // https://pkg.go.dev/github.com/llir/llvm/ir#InstExtractValue
    60  //    *ir.InstInsertValue    // https://pkg.go.dev/github.com/llir/llvm/ir#InstInsertValue
    61  //
    62  // Memory instructions
    63  //
    64  // https://llvm.org/docs/LangRef.html#memory-access-and-addressing-operations
    65  //
    66  //    *ir.InstAlloca          // https://pkg.go.dev/github.com/llir/llvm/ir#InstAlloca
    67  //    *ir.InstLoad            // https://pkg.go.dev/github.com/llir/llvm/ir#InstLoad
    68  //    *ir.InstStore           // https://pkg.go.dev/github.com/llir/llvm/ir#InstStore
    69  //    *ir.InstFence           // https://pkg.go.dev/github.com/llir/llvm/ir#InstFence
    70  //    *ir.InstCmpXchg         // https://pkg.go.dev/github.com/llir/llvm/ir#InstCmpXchg
    71  //    *ir.InstAtomicRMW       // https://pkg.go.dev/github.com/llir/llvm/ir#InstAtomicRMW
    72  //    *ir.InstGetElementPtr   // https://pkg.go.dev/github.com/llir/llvm/ir#InstGetElementPtr
    73  //
    74  // Conversion instructions
    75  //
    76  // https://llvm.org/docs/LangRef.html#conversion-operations
    77  //
    78  //    *ir.InstTrunc           // https://pkg.go.dev/github.com/llir/llvm/ir#InstTrunc
    79  //    *ir.InstZExt            // https://pkg.go.dev/github.com/llir/llvm/ir#InstZExt
    80  //    *ir.InstSExt            // https://pkg.go.dev/github.com/llir/llvm/ir#InstSExt
    81  //    *ir.InstFPTrunc         // https://pkg.go.dev/github.com/llir/llvm/ir#InstFPTrunc
    82  //    *ir.InstFPExt           // https://pkg.go.dev/github.com/llir/llvm/ir#InstFPExt
    83  //    *ir.InstFPToUI          // https://pkg.go.dev/github.com/llir/llvm/ir#InstFPToUI
    84  //    *ir.InstFPToSI          // https://pkg.go.dev/github.com/llir/llvm/ir#InstFPToSI
    85  //    *ir.InstUIToFP          // https://pkg.go.dev/github.com/llir/llvm/ir#InstUIToFP
    86  //    *ir.InstSIToFP          // https://pkg.go.dev/github.com/llir/llvm/ir#InstSIToFP
    87  //    *ir.InstPtrToInt        // https://pkg.go.dev/github.com/llir/llvm/ir#InstPtrToInt
    88  //    *ir.InstIntToPtr        // https://pkg.go.dev/github.com/llir/llvm/ir#InstIntToPtr
    89  //    *ir.InstBitCast         // https://pkg.go.dev/github.com/llir/llvm/ir#InstBitCast
    90  //    *ir.InstAddrSpaceCast   // https://pkg.go.dev/github.com/llir/llvm/ir#InstAddrSpaceCast
    91  //
    92  // Other instructions
    93  //
    94  // https://llvm.org/docs/LangRef.html#other-operations
    95  //
    96  //    *ir.InstICmp         // https://pkg.go.dev/github.com/llir/llvm/ir#InstICmp
    97  //    *ir.InstFCmp         // https://pkg.go.dev/github.com/llir/llvm/ir#InstFCmp
    98  //    *ir.InstPhi          // https://pkg.go.dev/github.com/llir/llvm/ir#InstPhi
    99  //    *ir.InstSelect       // https://pkg.go.dev/github.com/llir/llvm/ir#InstSelect
   100  //    *ir.InstFreeze       // https://pkg.go.dev/github.com/llir/llvm/ir#InstFreeze
   101  //    *ir.InstCall         // https://pkg.go.dev/github.com/llir/llvm/ir#InstCall
   102  //    *ir.InstVAArg        // https://pkg.go.dev/github.com/llir/llvm/ir#InstVAArg
   103  //    *ir.InstLandingPad   // https://pkg.go.dev/github.com/llir/llvm/ir#InstLandingPad
   104  //    *ir.InstCatchPad     // https://pkg.go.dev/github.com/llir/llvm/ir#InstCatchPad
   105  //    *ir.InstCleanupPad   // https://pkg.go.dev/github.com/llir/llvm/ir#InstCleanupPad
   106  type Instruction interface {
   107  	LLStringer
   108  	// isInstruction ensures that only instructions can be assigned to the
   109  	// instruction.Instruction interface.
   110  	isInstruction()
   111  	// Instruction implements the value.User interface.
   112  	value.User
   113  }