Are there any examples for the inline assembler or more complete docs?
Questions:
- What are the syntax and semantics of constraints?
- If I load up specific registers in the inline assembly, will llvm make sure that those registers are unassigned or should I save the registers and restore them? i.e. does llvm try and understand what is going on in the inline assembly, or is it a black box to llvm analysis?
- What is the syntax of the inline assembly? i.e. intel, att, …?
The test code is complete mystery to me:
; From test/Assembler/alignstack.II
define void @test1() nounwind {
; CHECK: test1
; CHECK: sideeffect
; CHECK-NOT: alignstack
tail call void asm sideeffect “mov”, “~{dirflag},~{fpsr},~{flags}”() nounwind
ret void
; CHECK: ret
}
- Presumably “mov” is the inline assembly string, but that isn’t going to assemble without arguments – are arguments append to the string somehow?
- Is anyone using the inline assembler? I would really like to see how others are using it.
Are there any examples for the inline assembler or more complete docs?
Questions:
* What are the syntax and semantics of constraints?
Try the gcc inline asm docs; we don't have very good ones.
* If I load up specific registers in the inline assembly, will llvm make
sure that those registers are unassigned or should I save the registers and
restore them? i.e. does llvm try and understand what is going on in the
inline assembly, or is it a black box to llvm analysis?
You have to mark registers which are clobbered.
* What is the syntax of the inline assembly? i.e. intel, att, ...?
The test code is complete mystery to me:
; From test/Assembler/alignstack.II
define void @test1() nounwind {
; CHECK: test1
; CHECK: sideeffect
; CHECK-NOT: alignstack
tail call void asm sideeffect "mov", "~{dirflag},~{fpsr},~{flags}"()
nounwind
ret void
; CHECK: ret
}
* Presumably "mov" is the inline assembly string, but that isn't going to
assemble without arguments -- are arguments append to the string somehow?
That isn't a working example of an inline asm; inline asm doesn't get
parsed if you're just emitting assembly code.
* Is anyone using the inline assembler? I would really like to see how
others are using it.
Look for examples in C, and convert them to LLVM IR with clang.
-Eli