From c3f5976112c2785f192c4ef95404627020d33ec3 Mon Sep 17 00:00:00 2001
From: Chris Lattner
@@ -221,9 +228,6 @@ the parser.
LLVM requires that values start with a '%' sign for two reasons: Compilers @@ -293,16 +299,6 @@ demonstrating instructions, we will follow an instruction with a comment that defines the type and name of value produced. Comments are shown in italic text.
-The one non-intuitive notation for constants is the optional hexidecimal form -of floating point constants. For example, the form 'double -0x432ff973cafa8000' is equivalent to (but harder to read than) 'double -4.5e+15' which is also supported by the parser. The only time hexadecimal -floating point constants are useful (and the only time that they are generated -by the disassembler) is when an FP constant has to be emitted that is not -representable as a decimal floating point number exactly. For example, NaN's, -infinities, and other special cases are represented in their IEEE hexadecimal -format so that assembly and disassembly do not cause any bits to change in the -constants.
@@ -577,25 +573,39 @@ produced by instructions, passed as arguments, or used as operands to instructions. This means that all structures and arrays must be manipulated either by pointer or by component. + +The real power in LLVM comes from the derived types in the system. This is what allows a programmer to represent arrays, functions, pointers, and other useful types. Note that these derived types may be recursive: For example, it is possible to have a two dimensional array.
+The array type is a very simple derived type that arranges elements sequentially in memory. The array type requires a size (number of elements) and an underlying data type.
+[<# elements> x <elementtype>]+ +
+ [<# elements> x <elementtype>] ++
The number of elements is a constant integer value, elementtype may be any type with a size.
+LLVM has several different basic types of constants. This section describes +them all and their syntax.
+ +The one non-intuitive notation for constants is the optional hexidecimal form +of floating point constants. For example, the form 'double +0x432ff973cafa8000' is equivalent to (but harder to read than) 'double +4.5e+15'. The only time hexadecimal floating point constants are required +(and the only time that they are generated by the disassembler) is when an FP +constant has to be emitted that is not representable as a decimal floating point +number exactly. For example, NaN's, infinities, and other special cases are +represented in their IEEE hexadecimal format so that assembly and disassembly do +not cause any bits to change in the constants.
+ +The addresses of global variables and functions are always implicitly valid (link-time) +constants. These constants explicitly referenced when the identifier for the global is used, and always have pointer type. For example, the following is a legal LLVM +file:
+ ++ %X = global int 17 + %Y = global int 42 + %Z = global [2 x int*] [ int* %X, int* %Y ] ++ +
The string 'undef' is recognized as a filler that has no specified +value. Undefined values may be of any type, and be used anywhere a constant +is.
+ +Undefined values are used to indicate the compiler that the program is well +defined no matter what value is used, giving it more freedom.
+ +Constant expressions are used to allow expressions involving other constants +to be used as constants. Constant expressions may be of any first class type, and may involve any LLVM operation +that does not have side effects (e.g. load and call are not supported). The +following is the syntax for constant expressions:
+ +The LLVM instruction set consists of several different classifications of instructions: terminator instructions, binary instructions, memory instructions, and other instructions.
+As mentioned previously, every basic block in a program ends with a "Terminator" instruction, which indicates which block should be executed after the current block is finished. These terminator instructions typically yield a 'void' value: they produce control flow, not values (the one exception being the 'invoke' instruction).
+There are five different terminator instructions: the 'ret' instruction, the 'br' instruction, the 'switch' instruction, the 'invoke' instruction, the 'unwind' instruction, and the 'unreachable' instruction.
+- call void (<integer type>, <integer type>)* %llvm.writeport (<integer type> <value>, <integer type> <address>) + call void (<integer type>, <integer type>)* + %llvm.writeport (<integer type> <value>, + <integer type> <address>)