Exemplo n.º 1
0
            public Value BuildSizeOf(SSAType t, AST.Node contextNode, string name = null)
            {
                var np     = new ConstPtr(new PointerType(t), 0);
                var size   = BuildGEP(np, contextNode, "size_of_trick", false, one_i32_v);
                var result = BuildPtrToInt(size, Const.mm_t, contextNode, name);

                Debug.Assert(result.isConst);
                return(result);
            }
Exemplo n.º 2
0
 public static Value Undefined(SSAType type)
 {
     if (type.kind == TypeKind.Integer)
     {
         var result = new ConstInt(type, 0);
         result.flags |= SSAFlags.undef;
         return(result);
     }
     else if (type.kind == TypeKind.Float || type.kind == TypeKind.Double)
     {
         var result = new ConstReal(type, 0);
         result.flags |= SSAFlags.undef;
         return(result);
     }
     else if (type.kind == TypeKind.Pointer)
     {
         var result = new ConstPtr(type, 0);
         result.flags |= SSAFlags.undef;
         return(result);
     }
     Debug.Assert(false);
     return(null);
 }