[LLVMdev] About porting llvm-gcc frontend.

Duncan Sands baldrick at free.fr
Thu Sep 24 08:24:32 PDT 2009


Hi 任坤,

> void vfu1(union MYunion  u) {
>     u.ui = 99;
> }

here u is passed by copy, so vfu1 has no externally
visible effect.  I think you meant: union MYunion *u

> define void @vfu1(%struct.MYunion* byval align 4 %u) nounwind {

Here "byval" means that a pointer to a temporary copy of u is being
passed, not u itself.  Thus any writes to the %u parameter have no
effect outside this function.

> /3. ***********My question*********/
> It  means that function "void vfu1(union MYunion  u)"  modifies global 
> varible myunion.

This call
   vfu1(myunion);
does not result in myunion being modified.

Ciao,

Duncan.



More information about the llvm-dev mailing list