<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -135,7 +135,7 @@ llvm_builder_malloc(VALUE self, VALUE rtype, VALUE rsize) {
 
   Value *size = ConstantInt::get(Type::Int32Ty, FIX2INT(rsize));
   Value *v = builder-&gt;CreateMalloc(type, size);
-  return llvm_value_wrap(v);
+  return Data_Wrap_Struct(cLLVMAllocationInst, NULL, NULL, v);
 }
 
 VALUE
@@ -155,7 +155,7 @@ llvm_builder_alloca(VALUE self, VALUE rtype, VALUE rsize) {
 
   Value *size = ConstantInt::get(Type::Int32Ty, FIX2INT(rsize));
   Value *v = builder-&gt;CreateAlloca(type, size);
-  return llvm_value_wrap(v);
+  return Data_Wrap_Struct(cLLVMAllocationInst, NULL, NULL, v);
 }
 
 VALUE</diff>
      <filename>ext/llvm_basicblock.cpp</filename>
    </modified>
    <modified>
      <diff>@@ -112,6 +112,32 @@ llvm_switch_inst_add_case(VALUE self, VALUE rci, VALUE rbb) {
   return self;
 }
 
+#define DATA_GET_ALLOCATION_INST AllocationInst *ai; Data_Get_Struct(self, AllocationInst, ai);
+
+VALUE 
+llvm_allocation_inst_is_array_allocation(VALUE self) {
+  DATA_GET_ALLOCATION_INST
+  return ai-&gt;isArrayAllocation() ? true : false;
+}
+
+VALUE 
+llvm_allocation_inst_array_size(VALUE self) {
+  DATA_GET_ALLOCATION_INST
+  return llvm_value_wrap(ai-&gt;getArraySize());
+}
+
+VALUE 
+llvm_allocation_inst_allocated_type(VALUE self) {
+  DATA_GET_ALLOCATION_INST
+  Type *at = const_cast&lt;Type*&gt;(ai-&gt;getAllocatedType()); 
+  return Data_Wrap_Struct(cLLVMType, NULL, NULL, at);
+}
+
+VALUE 
+llvm_allocation_inst_alignment(VALUE self) {
+  DATA_GET_ALLOCATION_INST
+  return INT2FIX(ai-&gt;getAlignment());
+}
 
 #define DEFINE_INST(type, name) rb_define_const(cLLVMInstruction, #name, INT2FIX(Instruction::name));
 #define DEFINE_BINARY_INST(name) DEFINE_INST(cLLVMBinaryOps, name)</diff>
      <filename>ext/llvm_instruction.cpp</filename>
    </modified>
    <modified>
      <diff>@@ -17,6 +17,7 @@ VALUE cLLVMTerminatorInst = Qnil;
 VALUE cLLVMReturnInst = Qnil;
 VALUE cLLVMBranchInst = Qnil;
 VALUE cLLVMSwitchInst = Qnil;
+VALUE cLLVMAllocationInst = Qnil;
 VALUE cLLVMPhi = Qnil;
 VALUE cLLVMBinaryOps = Qnil;
 VALUE cLLVMPassManager = Qnil;
@@ -69,6 +70,11 @@ VALUE llvm_switch_inst_get_default_dest(VALUE);
 VALUE llvm_switch_inst_get_num_cases(VALUE);
 VALUE llvm_switch_inst_add_case(VALUE, VALUE, VALUE);
 
+VALUE llvm_allocation_inst_is_array_allocation(VALUE);
+VALUE llvm_allocation_inst_array_size(VALUE);
+VALUE llvm_allocation_inst_allocated_type(VALUE);
+VALUE llvm_allocation_inst_alignment(VALUE);
+
 VALUE llvm_builder_set_insert_point(VALUE, VALUE);
 VALUE llvm_builder_bin_op(VALUE, VALUE, VALUE, VALUE);
 VALUE llvm_builder_phi(VALUE, VALUE);
@@ -133,6 +139,7 @@ void Init_llvmruby() {
   cLLVMReturnInst = rb_define_class_under(cLLVMRuby, &quot;ReturnInst&quot;, cLLVMTerminatorInst);
   cLLVMBranchInst = rb_define_class_under(cLLVMRuby, &quot;BranchInst&quot;, cLLVMTerminatorInst);
   cLLVMSwitchInst = rb_define_class_under(cLLVMRuby, &quot;SwitchInst&quot;, cLLVMTerminatorInst);
+  cLLVMAllocationInst = rb_define_class_under(cLLVMRuby, &quot;AllocationInst&quot;, cLLVMInstruction);
   cLLVMBinaryOps = rb_define_class_under(cLLVMInstruction, &quot;BinaryOps&quot;, rb_cObject);
   cLLVMPhi = rb_define_class_under(cLLVMRuby, &quot;Phi&quot;, cLLVMValue);
 
@@ -191,6 +198,11 @@ void Init_llvmruby() {
   rb_define_method(cLLVMSwitchInst, &quot;get_num_cases&quot;, llvm_switch_inst_get_num_cases, 0);
   rb_define_method(cLLVMSwitchInst, &quot;add_case&quot;, llvm_switch_inst_add_case, 2);
 
+  rb_define_method(cLLVMAllocationInst, &quot;array_allocation?&quot;, llvm_allocation_inst_is_array_allocation, 0);
+  rb_define_method(cLLVMAllocationInst, &quot;array_size&quot;, llvm_allocation_inst_array_size, 0);
+  rb_define_method(cLLVMAllocationInst, &quot;allocated_type&quot;, llvm_allocation_inst_allocated_type, 0);
+  rb_define_method(cLLVMAllocationInst, &quot;alignment&quot;, llvm_allocation_inst_alignment, 0);
+
   rb_define_method(cLLVMBuilder, &quot;set_insert_point&quot;, llvm_builder_set_insert_point, 1);
   rb_define_method(cLLVMBuilder, &quot;bin_op&quot;, llvm_builder_bin_op, 3);
   rb_define_method(cLLVMBuilder, &quot;phi&quot;, llvm_builder_phi, 1);</diff>
      <filename>ext/llvmruby.c</filename>
    </modified>
    <modified>
      <diff>@@ -36,6 +36,7 @@ extern VALUE cLLVMTerminatorInst;
 extern VALUE cLLVMReturnInst;
 extern VALUE cLLVMBranchInst;
 extern VALUE cLLVMSwitchInst;
+extern VALUE cLLVMAllocationInst;
 extern VALUE cLLVMBinaryOps;
 extern VALUE cLLVMPhi;
 extern VALUE cLLVMPassManager;</diff>
      <filename>ext/llvmruby.h</filename>
    </modified>
    <modified>
      <diff>@@ -272,6 +272,12 @@ class BasicTests &lt; Test::Unit::TestCase
     function_tester(23) do |f|
       b = f.create_block.builder
       new_space = b.malloc(MACHINE_WORD, 1)
+      assert_kind_of(AllocationInst, new_space)
+      assert(!new_space.array_allocation?)
+      assert_kind_of(Value, new_space.array_size)
+      assert_kind_of(Type, new_space.allocated_type)
+      assert_equal(0, new_space.alignment)
+
       b.store(23.llvm(MACHINE_WORD), new_space)    
       v = b.load(new_space)
       b.free(new_space)</diff>
      <filename>test/test_basic.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>f26df3f0f9db776e33e04ee129d1a754b72e3bb1</id>
    </parent>
  </parents>
  <author>
    <name>Tom Bagby</name>
    <email>tomatobagby@gmail.com</email>
  </author>
  <url>http://github.com/tombagby/llvmruby/commit/e0eb33ec85b71d3761cb648e1fdc89a724b5bb9e</url>
  <id>e0eb33ec85b71d3761cb648e1fdc89a724b5bb9e</id>
  <committed-date>2008-10-19T14:05:01-07:00</committed-date>
  <authored-date>2008-10-19T14:05:01-07:00</authored-date>
  <message>add inspector methods for allocation instructions</message>
  <tree>0571bb0e88f74eed6f7b0459ca07ea2f44235d1e</tree>
  <committer>
    <name>Tom Bagby</name>
    <email>tomatobagby@gmail.com</email>
  </committer>
</commit>
