[LLVMdev] Target lowering: how to dump byval argument?

Konstantin Vladimirov konstantin.vladimirov at gmail.com
Wed Mar 28 08:22:52 PDT 2012


Hi,

For example consider code:

typedef struct tag_instead_ll {
  int upper;
  int lower;
  int otherguys[9];
} instead_ll_t;

__attribute__ ((noinline)) int
foo (instead_ll_t value);

int
main(void)
{
  instead_ll_t val;
  val.upper = 0x12345678;
  val.lower = 0x9abcdef;
  return foo(val);
}

On the entrance of my LowerCall function, IR looks like:

*** IR Dump After Machine Function Analysis ***
define i32 @main() nounwind uwtable readonly {
  %val = alloca %struct.tag_instead_ll, align 4
  %1 = bitcast %struct.tag_instead_ll* %val to i32*
  store i32 305419896, i32* %1, align 4, !tbaa !0
  %2 = getelementptr inbounds %struct.tag_instead_ll* %val, i32 0, i32 1
  store i32 162254319, i32* %2, align 4, !tbaa !0
  %3 = call i32 @foo(%struct.tag_instead_ll* byval %val)
  ret i32 %3
}

Inside the LowerCall function, when I trying to dump incoming OutVals:

  dbgs() << "<--- Outvals: --->\n";
  for (int idx = 0, maxidx = OutVals.size(); idx != maxidx; ++idx) {
    dbgs() << idx << ":\n";
    OutVals[idx].getNode()->dumprFull();
    dbgs() << "\n";
  }
  dbgs() << "<--->\n";

I get only:

<--- Outvals: --->
0:
0x31fbe40: i32 = FrameIndex<0>
<--->

So LLVM thinks, I have only one i32 argument.

How can I look inside it? Is there anything better, then dumprFull?

Thanks in advance.

---
With best regards, Konstantin



More information about the llvm-dev mailing list