add Inline assembly in LLVM IR

Hi all,

I’m working for translating dex bytecode to LLVM IR

In order to communicate with Android interpreter,

The work have to add data below some instructions

I want to use inline assembly to add data.

Thus, I wrote a little program to find out the related LLVM IR

int main()
asm(".long 0x12345678");
return 0;

and I use clang to translate it into bitcode
It’s the result…

; ModuleID = ‘hello.c’
target datalayout = “e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128”
target triple = “x86_64-unknown-linux-gnu”

define i32 @main() nounwind uwtable {
%retval = alloca i32, align 4
store i32 0, i32* %retval
call void asm sideeffect “.long 0x12345678”, “~{dirflag},~{fpsr},~{flags}”() nounwind, !srcloc !0
ret i32 0

!0 = metadata !{i32 20}

Hi Jian-Ru Chen, if you run llc on your bitcode with -march=cpp then it should
output the series of API calls needed to produce that bitcode.

Ciao, Duncan.

Thanks for your help!
It's a helpful information!!