NAME

LLVM::Builder - LLVM builder class

VERSION

version 0.03

DESCRIPTION

A LLVM::Builder is the means of building instructions and represents a point within a basic block.

METHODS

new( $ctx, $blk )

Create a new LLVM::Builder object given a LLVM::Context and a LLVM::BasicBlock.

TERMINATOR INSTRUCTIONS

See the LLVM reference for more information about the single instructions.

ret( $v )

Append a ret instruction to the block. This function takes a LLVM::Value representing the value to be returned and returns a LLVM::Value.

ret_void( )

Append a void ret instruction to the block. This function returns a LLVM::Value.

cond( $if, $then, $else )

Append a conditional instruction to the block. This function takes a LLVM::Value $if representing the condition (e.g. it can be the value returned by a icmp or fcmp instruction) and two LLVM::BasicBlock: the first executed if the condition is true, the second executed otherwise.

BINARY OPERATIONS

The binary operations require two arguments of the same LLVM::Type and produce a single LLVM::Value.

See the LLVM reference for more information about the single instructions.

add( $lhs, $rhs, $name )

Append an integer add instruction to the block and name the result $name.

fadd( $lhs, $rhs, $name )

Append a floating add instruction to the block and name the result $name.

mul( $lhs, $rhs, $name )

Append a mul instruction to the block and name the result $name.

fmul( $lhs, $rhs, $name )

Append a floating mul instruction to the block and name the result $name.

sub( $lhs, $rhs, $name )

Append a sub instruction to the block and name the result $name.

fsub( $lhs, $rhs, $name )

Append a floating sub instruction to the block and name the result $name.

udiv( $lhs, $rhs, $name )

Append an unsigned div instruction to the block and name the result $name.

sdiv( $lhs, $rhs, $name )

Append a signed div instruction to the block and name the result $name.

fdiv( $lhs, $rhs, $name )

Append a floating div instruction to the block and name the result $name.

BINARY BITWISE OPERATIONS

The binary bitwise operations require two arguments of the same LLVM::Type and produce a single LLVM::Value.

See the LLVM reference for more information about the single instructions.

shl( $lhs, $rhs, $name )

Append a shift left instruction to the block and name the result $name.

lshr( $lhs, $rhs, $name )

Append a logical shift right instruction to the block and name the result $name.

ashr( $lhs, $rhs, $name )

Append an arithmetic shift right instruction to the block and name the result $name.

and( $lhs, $rhs, $name )

Append an and instruction to the block and name the result $name.

or( $lhs, $rhs, $name )

Append an or instruction to the block and name the result $name.

xor( $lhs, $rhs, $name )

Append a xor instruction to the block and name the result $name.

OTHER OPERATIONS

See the LLVM reference for more information about the single instructions.

icmp( $pred, $lhs, $rhs, $name )

Append an integer cmp instruction to the block and name the result $name. The predicate $pred must be one of:

"eq": equal
"ne": not equal
"ugt": unsigned greater than
"uge": unsigned greater or equal
"ult": unsigned less than
"ule": unsigned less or equal
"sgt": signed greater than
"sge": signed greater or equal
"slt": signed less than
"sle": signed less or equal

fcmp( $pred, $lhs, $rhs, $name )

Append a float cmp instruction to the block and name the result $name. The predicate $pred must be one of:

"false": no comparison, always returns false
"oeq": ordered and equal
"ogt": ordered and greater than
"oge": ordered and greater than or equal
"olt": ordered and less than
"ole": ordered and less than or equal
"one": ordered and not equal
"ord": ordered (no nans)
"ueq": unordered or equal
"ugt": unordered or greater than
"uge": unordered or greater than or equal
"ult": unordered or less than
"ule": unordered or less than or equal
"une": unordered or not equal
"uno": unordered (either nans)
"true": no comparison, always returns true

AUTHOR

Alessandro Ghedini <alexbio@cpan.org>

LICENSE AND COPYRIGHT

Copyright 2012 Alessandro Ghedini.

This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.

See http://dev.perl.org/licenses/ for more information.