R/manual_instruction.R

getOpcode =
function(x, ...)
 .Call("R_Instruction_getOpcode", x)

setMethod("getParent", "Instruction",
          function(x, ...)
          .Call("R_Instruction_getParent", x))

setMethod("getParent", "Function",
          function(x, ...)
           as(x, "Module"))

  

setMethod("getOperand", "Instruction",
          function(instruction, index) {
            if(index < 1)
              stop("don't be silly!")  
            coerceGenericInstruction(.Call("R_Instruction_getOperand", as(instruction, "Instruction"), as.integer(index)),throwError=FALSE)
          })

setMethod("getNumOperands", "Instruction",
function(x, ...)
{
   .Call("R_Instruction_getNumOperands", x)
})

setMethod("length", "Instruction",
             function(x)
                getNumOperands(x))


setMethod("[[", c("Instruction", "numeric"),
           function(x, i, j, ...) {
             getOperand(x, i)
           })


setMethod("getOperands", "Instruction",
           function(x, ...) {
             lapply(seq(length = getNumOperands(x)), function(i) getOperand(x, i))
           })
             
doktorschiwago/Rllvm2 documentation built on May 15, 2019, 9:42 a.m.