[llvm-dev] LLVM IR symbolic address operand to be treated as immediate value

Alex Susu via llvm-dev llvm-dev at lists.llvm.org
Thu Jun 16 06:23:07 PDT 2016


   Hello.
     I would like to programmatically add in my LLVM IR program a symbolic (address) 
operand which denotes an immediate value and should be treated as such by llc's 
instruction selector.
     Basically I would like to add an LLVM IR instruction like this:
       load %some_var, <8 x i64>* inttoptr (i64 SymbolicOperand to <8 x i64>*)
     where SymbolicOperand is the symbolic operand.
     As already said, I want the instruction selector phase to treat SymbolicOperand as an 
immediate value. For example, SymbolicOperand can be a variable defined in the assembly 
module or a macro to an immediate value.

     Could you please tell me if I can do such thing?
     I found a module called MCExternalSymbolizer.cpp, which talks about symbolic operand 
in place of the immediate Value in the MCInst (some more info at 
http://llvm.org/docs/CodeGenerator.html#the-mcinst-class), but this is something that 
happens already in the back end as far as I understand, while I want to do this in the 
middle-tier (in the LLVM IR program).

   Thank you,
     Alex


More information about the llvm-dev mailing list