LLVM中的类型系统很重要!有类型,可以使得很多优化成为可能,而且不需要额外的分析。一个强类型系统可使生成的代码更容易理解,并且更容易优化和转换。 1.类型的类别 llvm有以下几种类型: integer i1, i2, i3, ... i8, ... i16, ... i32, ... i64, ... floating point float, double, x86_fp80, fp128, ppc_fp128 first class integer , floating point , pointer , vector , structure , array , label , metadata . primitive label , void , floating point , x86mmx , metadata . derived array , function , pointer , structure , packed structure , vector , opaque . (第一类)first class是最重要的。指令只能产生这些类型的值。 2.原始类型(primitive types) 原始类型是llvm系统中的基础。 integer类型 整数类型是一个位宽度从1到2^23-1的整数。 语法: iN 其中N为位宽。 例子: i1 i32 i1942652 Floating Point类型 float 32-bit floating point value double 64-bit floating point value fp128 128-bit floating point value (112-bit mantissa) x86_fp80 80-bit floating point value (X8...