예제 #1
0
        internal static Value Create(LLVMValueRef v)
        {
            if (v.Pointer == IntPtr.Zero)
            {
                return(null);
            }

            if (LLVM.ValueIsBasicBlock(v))
            {
                return(new BasicBlock(LLVM.ValueAsBasicBlock(v)));
            }

            if (LLVM.IsAFunction(v).ToBool())
            {
                return(new Function(v));
            }

            if (LLVM.IsABinaryOperator(v).ToBool())
            {
                return(BinaryOperator.Create(v));
            }

            if (LLVM.IsAInstruction(v).ToBool())
            {
                return(Instruction.Create(v));
            }

            if (LLVM.IsConstant(v))
            {
                return(Constant.Create(v));
            }

            if (LLVM.IsAArgument(v).ToBool())
            {
                return(new Argument(v));
            }

            if (LLVM.IsAMDString(v).ToBool())
            {
                return(new MDStringAsValue(v));
            }

            throw new NotImplementedException();
        }