Skip to content

LLVM笔记(3):LLVM的语言(下)

(本文是 http://llvm.org/releases/2.9/docs/LangRef.html 的阅读笔记,前作为《LLVM笔记(2):LLVM的语言(中)》。)

  • Instruction Reference
    • terminator instruction
      • indicates which block should be executed after the current block is finished
      • yields ‘void’ value,
      • ret (return)
        • ret <type> <value>
        • ret void
      • branch
        • br i1 <cond>, label <iftrue>, label <iffalse>
        • br label <dest> ; Unconditional branch
        • switch <intty> <value>, label <defaultdest> [ <intty> <val>, label <dest> ... ]
        • indirectbr <somety>* <address>, [ label <dest1>, label <dest2>, ... ]
      • invoke
        • invoke [cconv] [ret attrs] <ptr to function ty> <function ptr val>(<function args>) [fn attrs] to label <normal label> unwind label <exception label>
        • unwind
        • unreachable
    • binary instruction
      • add, fadd, sub, fsub
      • mul, fmul, udiv, sdiv, fdiv, urem, srem, frem
    • bitwise binary instructions
      • shl, lshr, ashr
      • and, or, xor
    • memory instructions
      • Vector Operations
        • extractelement
          • <result> = extractelement <n x <ty>> <val>, i32 <idx> ; yields <ty>
        • insertelement
          • <result> = insertelement <n x <ty>> <val>, <ty> <elt>, i32 <idx> ; yields <n x <ty>>
        • shufflevector
          • <result> = shufflevector <n x <ty>> <v1>, <n x <ty>> <v2>, <m x i32> <mask> ; yields <m x <ty>>
      • Aggregate Operations
        • extractvalue
          • <result> = extractvalue <aggregate type> <val>, <idx>{, <idx>}*
        • insertvalue
          • <result> = insertvalue <aggregate type> <val>, <ty> <elt>, <idx> ; yields <aggregate type>
      • Memory Access and Addressing Operations
        • alloca
          • <result> = alloca <type>[, <ty> <NumElements>][, align <alignment>] ; yields {type*}:result
        • load
          • <result> = load <ty>* <pointer>[, align <alignment>][, !nontemporal !<index>]
          • <result> = volatile load <ty>* <pointer>[, align <alignment>][, !nontemporal !<index>]
          • !<index> = !{ i32 1 }
        • store
          • store <ty> <value>, <ty>* <pointer>[, align <alignment>][, !nontemporal !<index>] ; yields {void}
          • volatile store <ty> <value>, <ty>* <pointer>[, align <alignment>][, !nontemporal !<index>] ; yields {void}
        • getelementptr
          • <result> = getelementptr <pty>* <ptrval>{, <ty> <idx>}*
          • <result> = getelementptr inbounds <pty>* <ptrval>{, <ty> <idx>}*
      • Conversion Operations
        • trunc .. to (truncate value type)
        • zext .. to (zero ext)
        • sext .. to (sign ext)
        • fptrunc .. to (float point truncate)
        • fpext .. to
        • fptoui .. to (float point to unsigned int)
        • fptosi .. to
        • uitofp .. to
        • sitofp .. to
        • ptrtoint .. to (pointer to int)
        • inttoptr .. to
        • bitcast .. to
    • other instructions
      • ‘icmp’ Instruction
        • <result> = icmp <cond> <ty> <op1>, <op2> ; yields {i1} or {<N x i1>}:result
  • Intrinsic Functions
    • Variable Argument Handling Intrinsics
      • llvm.va_start
      • llvm.va_end
      • llvm.va_copy
    • Accurate Garbage Collection Intrinsics
      • llvm.gcroot
      • llvm.gcread
      • llvm.gcwrite
    • Code Generator Intrinsics
      • llvm.returnaddress
        • declare i8 *@llvm.returnaddress(i32 <level>)
      • llvm.frameaddress
        • declare i8* @llvm.frameaddress(i32 <level>)
      • llvm.stacksave
        • declare i8* @llvm.stacksave()
      • llvm.stackrestore
        • declare void @llvm.stackrestore(i8* %ptr)
      • llvm.prefetch
        • declare void @llvm.prefetch(i8* <address>, i32 <rw>, i32 <locality>)
      • llvm.pcmarker
        • declare void @llvm.pcmarker(i32 <id>)
      • llvm.readcyclecounter
        • declare i64 @llvm.readcyclecounter()
    • Standard C Library Intrinsics
      • llvm.memcpy llvm.memmove llvm.memset.*
      • llvm.sqrt.* llvm.powi.* llvm.sin.* llvm.cos.* llvm.pow.*
    • Bit Manipulation Intrinsics
      • llvm.bswap.*
        • swap high and low
      • llvm.ctpop.*
        • counts the number of bits set
      • llvm.ctlz.*
        • count the number of leading zeros
      • llvm.cttz.*
        • count the number of trailing zeros
      • llvm.sadd.with.overflow.*
      • llvm.uadd.with.overflow.*
      • llvm.ssub.with.overflow.*
      • llvm.usub.with.overflow.*
      • llvm.smul.with.overflow.*
      • llvm.umul.with.overflow.*
    • Half Precision Floating Point Intrinsics
      • llvm.convert.to.fp16
      • llvm.convert.from.fp16
    • Debugger Intrinsics
      • start with llvm.dbg. prefix
    • Exception Handling Intrinsics
      • start with llvm.eh. prefix
    • Trampoline Intrinsic
      • llvm.init.trampoline
    • Atomic Operations and Synchronization Intrinsics
      • llvm.memory.barrier
      • llvm.atomic.cmp.swap.*
      • llvm.atomic.swap.*
      • llvm.atomic.load.add.* llvm.atomic.load.sub.*
      • llvm.atomic.load.and.* llvm.atomic.load.nand.* llvm.atomic.load.or.* llvm.atomic.load.xor.*
      • llvm.atomic.load.max.* llvm.atomic.load.min.* llvm.atomic.load.umax.* llvm.atomic.load.umin.*
    • Memory Use Markers
      • llvm.lifetime.start
      • llvm.lifetime.end
      • llvm.invariant.start
      • llvm.invariant.end
    • General Intrinsics
      • llvm.var.annotation
      • llvm.annotation.*
      • llvm.trap
      • llvm.stackprotector
      • llvm.objectsize

Post a Comment

Your email is never published nor shared. Required fields are marked *
*
*