[LLVMdev] store addrspace qualifier

Mon Ping Wang wangmp at apple.com
Wed Sep 17 15:45:29 PDT 2008


The address qualifier is stored in the type of %result.  From that  
operand, you can get the Value and then call getType.  The type for  
result  should be a PointerType which you cast to a PointerType and  
get the getAddressSpace e.g. cast<PointerType>(Ty)->getAddressSpace()

-- Mon Ping


On Sep 17, 2008, at 1:06 PM, Villmow, Micah wrote:

> How do I access the address qualifier from the store instruction.
> Given the following code:
>
> define void @test_unary_op_anegate(float %x, float addrspace(11)*  
> %result) nounwind  {
> entry:
>         %neg = sub float -0.000000e+000, %x             ; <float>  
> [#uses=1]
>         store float %neg, float addrspace(11)* %result
>         ret void
> }
> When I attempt to generate this code, I’m aborting on.
> Cannot yet select: 017E8230: ch = store 017E7DF0, 017E8098,  
> 017E8010, 017E81A8 <0035A078:0> alignment=4
> So I am doing a custom Store function.
> In my LowerStore function, I get an SDValue w/ opcode of 119(store)  
> and 4 child Operands
> Operand 0 is the entry token which I assume I can ignore
> Operand 1 is the source data(%neg), which I finally can handle  
> correctly thanks to Eli
> Operand 2 is the dst location with two children, an EntryToken and  
> Register(%result I’m guessing)
> Operand 3 is undef
>
> So, how do I find out the address space? The reason being different  
> address spaces are accessed with different registers.
>
> Thanks,
>
> Micah Villmow
> Systems Engineer
> Advanced Technology & Performance
> Advanced Micro Devices Inc.
> 4555 Great America Pkwy,
> Santa Clara, CA. 95054
> P: 408-572-6219
> F: 408-572-6596
>
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20080917/94701a56/attachment.html>


More information about the llvm-dev mailing list