[cfe-dev] Strange character around function declared with "asm"

Lorenzo De Carli lorenzo at cs.wisc.edu
Thu Dec 2 20:49:04 PST 2010


Hi everyone,

I am trying to instruct clang to generate llvm intrinsics in place of
certain function calls, and to do so I am using the "asm" tag. For
example:

void MyFunc(int a, int b) asm("llvm.myfunc");

void DoSomething() {
  int x = 1;
  int y = 2;

  MyFunc(x, y);
}

However, if I try to compile the above function with "clang -emit-llvm
-S test.c -o test.s" I obtain:

define void @DoSomething() nounwind {
  %x = alloca i32, align 4
  %y = alloca i32, align 4
  store i32 1, i32* %x, align 4
  store i32 2, i32* %y, align 4
  %1 = load i32* %x, align 4
  %2 = load i32* %y, align 4
  call void @"\01llvm.myfunc"(i32 %1, i32 %2)
  ret void
}

declare void @"\01llvm.myfunc"(i32, i32)

Is there a reason for the quotation marks (") and the \01 before the
intrinsic call? I tried to get the same assembly from llvm-gcc, and in
that case there are no quotation marks or other artefacts.

Thanks,
Lorenzo



More information about the cfe-dev mailing list