Home | History | Annotate | Download | only in tutorial

Lines Matching full:variable

51 In this case, we have the variable "X", whose value depends on the path
109 variable (which lives in memory, because it is on the stack) for each
116 "i32\*" even though the variable is defined as "i32". What this means is
120 variable definitions, they are declared with the `LLVM alloca
135 variable in the LLVM IR. Stack memory allocated with the alloca
169 #. Each mutable variable becomes a stack allocation.
170 #. Each read of the variable becomes a load from the stack.
171 #. Each update of the variable becomes a store to the stack.
172 #. Taking the address of a variable just uses the stack address
251 the variable exposed so that debug info can be attached to it. This
301 operator, then extend Kaleidoscope to support new variable definitions.
308 "Value\*" that holds the double value for the named variable. In order
310 ``named_values`` holds the *memory location* of the variable in
318 variable of 'for' loops. For consistency, we'll allow mutation of these
353 variable references. In our new scheme, variables live on the stack, so
361 | Ast.Variable name ->
363 | Not_found -> raise (Error "unknown variable name")
378 (* Create an alloca for the variable in the entry block. *)
381 (* Emit the start code first, without 'variable' in scope. *)
389 (* Within the loop, the variable is defined equal to the PHI node. If it
390 * shadows an existing variable, we have to restore it, so save it
403 * the body of the loop mutates the variable. *)
412 variable as needed.
427 (* Create an alloca for this variable. *)
433 (* Add arguments to variable symbol table. *)
498 Here there is only one variable (x, the input argument) but you can
501 value is stored into it. Each reference to the variable does a reload
535 the variable. The point of showing this is to calm your tension about
600 | Ast.Variable name -> name
601 | _ -> raise (Error "destination of '=' must be a variable")
607 The other strange thing is that it requires the LHS to be a variable. It
617 let variable = try Hashtbl.find named_values name with
618 | Not_found -> raise (Error "unknown variable name")
620 ignore(build_store val_ variable builder);
625 Once we have the variable, codegen'ing the assignment is
715 (* At least one variable name is required. *)
754 time. For each variable we put into the symbol table, we remember the
759 (* Emit the initializer before adding the variable to scope, this
760 * prevents the initializer from referencing the variable itself, and
774 (* Remember the old variable binding so that we can restore the binding
798 Finally, before returning, we restore the previous variable bindings:
810 The end result of all of this is that we get properly scoped variable
961 (* variant for referencing a variable, like "a". *)
962 | Variable of string
1039 (* Simple variable ref. *)
1040 | [< >] -> Ast.Variable id
1082 (* At least one variable name is required. *)
1242 | Ast.Variable name ->
1244 | Not_found -> raise (Error "unknown variable name")
1264 | Ast.Variable name -> name
1265 | _ -> raise (Error "destination of '=' must be a variable")
1272 let variable = try Hashtbl.find named_values name with
1273 | Not_found -> raise (Error "unknown variable name")
1275 ignore(build_store val_ variable builder);
1389 (* Create an alloca for the variable in the entry block. *)
1392 (* Emit the start code first, without 'variable' in scope. *)
1409 (* Within the loop, the variable is defined equal to the PHI node. If it
1410 * shadows an existing variable, we have to restore it, so save it
1434 * the body of the loop mutates the variable. *)
1452 (* Restore the unshadowed variable. *)
1467 (* Emit the initializer before adding the variable to scope, this
1468 * prevents the initializer from referencing the variable itself, and
1482 (* Remember the old variable binding so that we can restore the binding
1544 (* Create an alloca for this variable. *)
1550 (* Add arguments to variable symbol table. *)