llvmliteir
¶
LLVM-IR builder.
LLVMLiteIR
¶
LLVMLiteIR()
Bases: Builder
LLVM-IR transpiler and compiler.
Source code in src/irx/builders/llvmliteir.py
753 754 755 756 |
|
build
¶
build(expr: AST, output_file: str) -> None
Transpile the ASTx to LLVM-IR and build it to an executable file.
Source code in src/irx/builders/llvmliteir.py
758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 |
|
module
¶
module() -> Module
Create a new ASTx Module.
Source code in src/irx/builders/base.py
133 134 135 |
|
run
¶
run() -> None
Run the generated executable.
Source code in src/irx/builders/llvmliteir.py
784 785 786 |
|
LLVMLiteIRVisitor
¶
LLVMLiteIRVisitor()
Bases: BuilderVisitor
LLVM-IR Translator.
Source code in src/irx/builders/llvmliteir.py
90 91 92 93 94 95 96 97 98 99 100 101 102 103 |
|
create_entry_block_alloca
¶
Create an alloca instruction in the entry block of the function.
This is used for mutable variables, etc.
Parameters:
Returns:
-
An llvm allocation instance.
–
Source code in src/irx/builders/llvmliteir.py
179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 |
|
get_function
¶
Put the function defined by the given name to result stack.
Source code in src/irx/builders/llvmliteir.py
162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 |
|
initialize
¶
initialize() -> None
Initialize self.
Source code in src/irx/builders/llvmliteir.py
110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 |
|
translate
¶
translate(expr: AST) -> str
Translate an ASTx expression to string.
Source code in src/irx/builders/llvmliteir.py
105 106 107 108 |
|
visit
¶
visit(expr: VariableDeclaration) -> None
Translate ASTx Variable to LLVM-IR.
Source code in src/irx/builders/llvmliteir.py
721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 |
|
VariablesLLVM
¶
Store all the LLVM variables that is used for the code generation.
get_data_type
¶
get_data_type(type_name: str) -> Type
Get the LLVM data type for the given type name.
Returns:
-
ir.Type: The LLVM data type.
–
Source code in src/irx/builders/llvmliteir.py
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
|
run_command
¶
Run a command in the operating system.
Source code in src/irx/builders/llvmliteir.py
21 22 23 24 25 26 |
|
safe_pop
¶
safe_pop(lst: list[Value | Function]) -> Value | Function
Implement a safe pop operation for lists.
Source code in src/irx/builders/llvmliteir.py
30 31 32 33 34 35 |
|