[PATCH] D133914: [InlineAsm][bugfix] Correct function addressing in inline asm

Xiang Zhang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 14 23:30:18 PDT 2022


xiangzhangllvm created this revision.
xiangzhangllvm added reviewers: jonpa, LuoYuanke, craig.topper, RKSimon, pengfei.
Herald added subscribers: StephenFan, hiraditya.
Herald added a project: All.
xiangzhangllvm requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

  In Linux PIC model, there are 4 cases about value/label addressing:
  
  **Case 1**: Function call or Label jmp inside the module.
  **Case 2**: Data access (such as global variable, static variable) inside the module.
  **Case 3**: Function call or Label jmp outside the module.
  **Case 4**: Data access (such as global variable) outside the module.
  
  Due to current llvm inline asm architecture designed to not "recognize" the asm
  code, there are quite troubles for us to treat mem addressing differently for
  same value/adress used in different instuctions.
  For example, in pic model, call a func may in plt way or direclty pc-related,
  but lea/mov a function adress may use got.
  
  This patch fix/refine the case 1 and case 2 in inline asm.
  Due to currently inline asm didn't support jmp the outsider lable, this patch
  mainly focus on fix the function call addressing bugs in inline asm.


https://reviews.llvm.org/D133914

Files:
  clang/test/CodeGen/ms-inline-asm-functions.c
  llvm/include/llvm/CodeGen/TargetLowering.h
  llvm/include/llvm/CodeGen/TargetSubtargetInfo.h
  llvm/include/llvm/IR/InlineAsm.h
  llvm/lib/CodeGen/SelectionDAG/InstrEmitter.cpp
  llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
  llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
  llvm/lib/IR/InlineAsm.cpp
  llvm/lib/Target/X86/X86ISelLowering.cpp
  llvm/lib/Target/X86/X86ISelLowering.h
  llvm/test/CodeGen/X86/inline-asm-function-call-pic.ll
  llvm/test/CodeGen/X86/inline-asm-p-constraint.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D133914.460300.patch
Type: text/x-patch
Size: 20477 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220915/9c5a8c3c/attachment-0001.bin>


More information about the llvm-commits mailing list