[PATCH] Address Space Casting

Michele Scandale michele.scandale at gmail.com
Wed Aug 14 10:44:53 PDT 2013


Hi arsenm, villmow, theraven,

Hello to everybody,

here I a patch to add the 'addrspacecast' instruction to represent casting between pointers of different address spaces in general (pointers of different sizes, value change).
I took the specification details from http://lists.cs.uiuc.edu/pipermail/llvmdev/2013-August/064674.html .
I haven't implemented the auto upgrade for ptrtoint-inttoptr sequence because it's not clear to me the reasong for this transformation.

A small summary about the content of this patch:
-  addrspacecast instruction added in the IR
   -  asmparser, asmwriter, bitcode reader, bitcode writer
   -  auto upgrade for bitcast
   -  create PointerCast helper functions has been updated to emit an 'addrspacecast' when different address spaces are involved
   -  constant cast expression added
   -  added checks to the verifier
   -  added wrapper for C-bindings
-  fixed constant folding analysis to support the new instruction
-  added ADDRSPACECAST SDNode to the SelectionDAG
   - custom SDNode where both source and destination address space are tracked
   - added TargetLowering hook to avoid generation of ADDRSPACECAST node during SelectionDAG build when the conversion is a noop.
-  fixed 2 test that were expecting a bitcast instruction
-  handled conversione between address spaces [0-255] as NOOP for X86
-  fixed NVPTXGenericToNVVM pass to use CreatePointerCast instead of CreateBitCast for generating cast between global variables with different address spaces.

I don't know well how to test all this in a deep way, so I would appreciate any suggestion.

Thanks in advance.

Best regards,
-Michele

http://llvm-reviews.chandlerc.com/D1401

Files:
  include/llvm-c/Core.h
  include/llvm/AutoUpgrade.h
  include/llvm/Bitcode/LLVMBitCodes.h
  include/llvm/CodeGen/ISDOpcodes.h
  include/llvm/CodeGen/SelectionDAG.h
  include/llvm/CodeGen/SelectionDAGNodes.h
  include/llvm/IR/Constants.h
  include/llvm/IR/IRBuilder.h
  include/llvm/IR/Instruction.def
  include/llvm/IR/Instructions.h
  include/llvm/InstVisitor.h
  include/llvm/Target/TargetLowering.h
  lib/Analysis/ConstantFolding.cpp
  lib/AsmParser/LLLexer.cpp
  lib/AsmParser/LLParser.cpp
  lib/AsmParser/LLToken.h
  lib/Bitcode/Reader/BitcodeReader.cpp
  lib/Bitcode/Writer/BitcodeWriter.cpp
  lib/CodeGen/SelectionDAG/SelectionDAG.cpp
  lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
  lib/CodeGen/SelectionDAG/SelectionDAGBuilder.h
  lib/CodeGen/SelectionDAG/SelectionDAGDumper.cpp
  lib/CodeGen/TargetLoweringBase.cpp
  lib/IR/AutoUpgrade.cpp
  lib/IR/ConstantFold.cpp
  lib/IR/Constants.cpp
  lib/IR/Core.cpp
  lib/IR/Instruction.cpp
  lib/IR/Instructions.cpp
  lib/IR/Verifier.cpp
  lib/Target/NVPTX/NVPTXGenericToNVVM.cpp
  lib/Target/X86/X86ISelLowering.cpp
  lib/Target/X86/X86ISelLowering.h
  test/Other/constant-fold-gep.ll
  test/Transforms/InstCombine/2012-07-30-addrsp-bitcast.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D1401.1.patch
Type: text/x-patch
Size: 43599 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130814/0eb2c233/attachment.bin>


More information about the llvm-commits mailing list