[LLVMdev] Question about InlineAsm
David Gonzalez Marquez
fokerman at gmail.com
Mon Mar 11 04:56:28 PDT 2013
Hello,
I'm new with the llvm, and I trying to write a transformation adding
some lines of asm to a code.
My code is like this,
Type *VoidTy = llvm::Type::getVoidTy(getGlobalContext());
llvm::FunctionType *ty = llvm::FunctionType::get(VoidTy, false);
InlineAsm *iv = InlineAsm::get( ty, "mov $55, %eax", "", true ); //
<----- here
SmallVector<llvm::Value*, 4> ArgList;
llvm::CallInst::Create( iv , ArgList, "", &ins);
It work perfect, but when I compiled I found the next error:
opt -load /home/david/LLVM/build_all/Release+Asserts/lib/LLVMHello.so
-hello < hello.bc > hello.t.bc 2> AAA
llc hello.t.bc -o hello.t.s
LLVM ERROR: Invalid $ operand number in inline asm string: 'mov $55, %eax'
make: *** [opt] Error 1
If I remove the symbol "$", it works properly, but does not be the
corrected att syntax, because in att syntax the constants are prefixed
by $.
It is possible to write a inline asm instrucction to load a constant
in a register?
Thanks in advance.
David.
More information about the llvm-dev
mailing list