Skip to content

Latest commit

 

History

History
30 lines (22 loc) · 720 Bytes

examples.rst

File metadata and controls

30 lines (22 loc) · 720 Bytes

Example---defining a simple function

This example defines a function that adds 2 double-precision, floating-point numbers.

../examples/ir_fpadd.py

The generated LLVM intermediate representation <intermediate representation> is printed at the end:

; ModuleID = "examples/ir_fpadd.py"
target triple = "unknown-unknown-unknown"
target datalayout = ""

define double @"fpadd"(double %".1", double %".2")
{
entry:
  %"res" = fadd double %".1", %".2"
  ret double %"res"
}

To learn how to compile and execute this function, see ../binding/index.