<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>test/test_value.rb</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -101,6 +101,68 @@ llvm_value_get_immediate_constant(VALUE self, VALUE v) {
   return llvm_value_wrap(ConstantInt::get(type, (long)v));
 }
 
+VALUE
+llvm_value_is_constant(VALUE self) {
+  Value *v;
+  Data_Get_Struct(self, Value, v);
+  return isa&lt;Constant&gt;(v) ? Qtrue : Qfalse;
+}
+
+VALUE
+llvm_value_is_int_constant(VALUE self) {
+  Value *v;
+  Data_Get_Struct(self, Value, v);
+  return isa&lt;ConstantInt&gt;(v) ? Qtrue : Qfalse;
+}
+
+VALUE
+llvm_value_is_float_constant(VALUE self) {
+  Value *v;
+  Data_Get_Struct(self, Value, v);
+  return isa&lt;ConstantFP&gt;(v) ? Qtrue : Qfalse;
+}
+
+VALUE
+llvm_value_get_int_constant_value(VALUE self) {
+  Value *v;
+  Data_Get_Struct(self, Value, v);
+  if (ConstantInt *C = dyn_cast&lt;ConstantInt&gt;(v)) {
+    APInt val = C-&gt;getValue();
+    return LL2NUM(val.getLimitedValue());
+  } else {
+    rb_raise(rb_eTypeError, &quot;Argument not an integer constant&quot;);
+  }
+}
+
+VALUE
+llvm_value_get_float_constant_value(VALUE self) {
+  Value *v;
+  Data_Get_Struct(self, Value, v);
+  if (ConstantFP *C = dyn_cast&lt;ConstantFP&gt;(v)) {
+    APFloat val = C-&gt;getValueAPF();
+    return rb_float_new(val.convertToFloat());
+  } else {
+    rb_raise(rb_eTypeError, &quot;Argument not a float constant&quot;);
+  }
+}
+
+
+VALUE
+llvm_value_is_null(VALUE self) {
+  Value *v;
+  Data_Get_Struct(self, Value, v);
+  if (Constant *C = dyn_cast&lt;Constant&gt;(v))
+    return C-&gt;isNullValue() ? Qtrue : Qfalse;
+  return Qfalse;
+}
+
+VALUE
+llvm_value_is_undef(VALUE self) {
+  Value *v;
+  Data_Get_Struct(self, Value, v);
+  return isa&lt;UndefValue&gt;(v) ? Qtrue : Qfalse;
+}
+
 VALUE 
 llvm_type_pointer(VALUE self, VALUE rtype) {
   Type *type;</diff>
      <filename>ext/llvm_value.cpp</filename>
    </modified>
    <modified>
      <diff>@@ -129,6 +129,14 @@ VALUE llvm_value_num_uses(VALUE);
 VALUE llvm_value_used_in_basic_block(VALUE, VALUE);
 VALUE llvm_value_replace_all_uses_with(VALUE, VALUE);
 
+VALUE llvm_value_is_constant(VALUE self);
+VALUE llvm_value_is_int_constant(VALUE self);
+VALUE llvm_value_is_float_constant(VALUE self);
+VALUE llvm_value_get_int_constant_value(VALUE self);
+VALUE llvm_value_get_float_constant_value(VALUE self);
+VALUE llvm_value_is_null(VALUE self);
+VALUE llvm_value_is_undef(VALUE self);
+
 VALUE llvm_user_get_operand_list(VALUE);
 VALUE llvm_user_get_num_operands(VALUE);
 VALUE llvm_user_get_operand(VALUE, VALUE);
@@ -209,6 +217,14 @@ void Init_llvmruby() {
   rb_define_method(cLLVMValue, &quot;used_in_basic_block?&quot;, llvm_value_used_in_basic_block, 1);
   rb_define_method(cLLVMValue, &quot;replace_all_uses_with&quot;, llvm_value_replace_all_uses_with, 1);
 
+  rb_define_method(cLLVMValue, &quot;is_constant&quot;, llvm_value_is_constant, 0);
+  rb_define_method(cLLVMValue, &quot;is_int_constant&quot;, llvm_value_is_int_constant, 0);
+  rb_define_method(cLLVMValue, &quot;is_float_constant&quot;, llvm_value_is_float_constant, 0);
+  rb_define_method(cLLVMValue, &quot;get_int_constant_value&quot;, llvm_value_get_int_constant_value, 0);
+  rb_define_method(cLLVMValue, &quot;get_float_constant_value&quot;, llvm_value_get_float_constant_value, 0);
+  rb_define_method(cLLVMValue, &quot;is_null&quot;, llvm_value_is_null, 0);
+  rb_define_method(cLLVMValue, &quot;is_undef&quot;, llvm_value_is_undef, 0);
+
   rb_define_method(cLLVMUser, &quot;get_operand_list&quot;, llvm_user_get_operand_list, 0);
   rb_define_method(cLLVMUser, &quot;get_num_operands&quot;, llvm_user_get_num_operands, 0);
   rb_define_method(cLLVMUser, &quot;get_operand&quot;, llvm_user_get_operand, 1);</diff>
      <filename>ext/llvmruby.c</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>277de214623f9378b84bf6316576aa04dbbeb042</id>
    </parent>
  </parents>
  <author>
    <name>Christian Plessl</name>
    <email>christian@plesslweb.ch</email>
  </author>
  <url>http://github.com/tombagby/llvmruby/commit/cc60d93b02632692e1c684a1a84bb312fd47dd39</url>
  <id>cc60d93b02632692e1c684a1a84bb312fd47dd39</id>
  <committed-date>2008-11-14T06:27:36-08:00</committed-date>
  <authored-date>2008-11-14T06:27:36-08:00</authored-date>
  <message>Adding support for reading integer and float constants.</message>
  <tree>41407d694a3695d38c069cf02fa3e75ef4f64c93</tree>
  <committer>
    <name>Christian Plessl</name>
    <email>christian@plesslweb.ch</email>
  </committer>
</commit>
