blockaddress(@function, %block) IR?

Tove via digitalmars-d-ldc digitalmars-d-ldc at puremagic.com
Fri Aug 15 11:10:43 PDT 2014


I'm now convinced it's a bug, I get this error-message:
==================================================
store i8* blockaddress(@fun, %label_lbl1), i8** %0
                        ^
unknown function referenced by blockaddress
==================================================

For this program:
==================================================
pragma(LDC_no_moduleinfo)
pragma(LDC_inline_ir)
R inlineIR(string s, R, P...)(P);

extern(C)
byte* fun()
{
   byte* lbl_addr;

   inlineIR!(`store i8* blockaddress(@fun, %label_lbl1), i8** %0`, 
void)(&lbl_addr);

lbl1:
   return lbl_addr;
}
==================================================

But it works fine, if I instead hand-edit the *.ll file and 
compile it.
==================================================
target triple = "i686-pc-mingw32"

define i8* @fun() {
   %lbl_addr = alloca i8*, align 4
   store i8* blockaddress(@fun, %label_lbl1), i8** %lbl_addr
   %tmp = load i8** %lbl_addr
   br label %label_lbl1

label_lbl1:                                       ; preds = %0
   %tmp1 = load i8** %lbl_addr
   %tmp2 = load i8** %lbl_addr
   ret i8* %tmp2
}
==================================================


More information about the digitalmars-d-ldc mailing list