|
From: Stepan D. <stp...@na...> - 2013-06-27 10:33:31
|
Hi guys.
Today I went through whole AVR-Libc Inline Assembler Cookbook chapter.
I have checked all examples with two commands:
1. clang -S -o - -emit-llvm example.c
2. avr-clang -S -o - -emit-llvm example.c
I've found two difference:
1. As I mentioned before difference for memory constraint.
For string "asm("instr %0": "=Q"(a):)"
clang emits:
%0 = call i32 asm "instr $0", "=Q,~{dirflag},~{fpsr},~{flags}"()
arm-linux-gnueabi emits:
call void asm "instr $0", "=*Q"(i32* @a) #1, !srcloc !0
avr-clang:
%0 = call i16 asm "instr $0", "=Q"()
I'll try to use current syntax here. Though ARM syntax is working well
now, but I din't find explanation of =*Q sequence yet.
2. asm names.
// example.c:
extern long Calc(void) asm ("CALCULATE");
void f() { Calc(); }
clang emits:
%call = call i64 @CALCULATE()
...
declare i64 @CALCULATE()
avr-clang emits:
%call = call i32 @"\01CALCULATE"()
...
declare i32 @"\01CALCULATE"()
Does somebody know what \01 is used for here?
-Stepan
|