[llvm-dev] about SDTypeConstraint and transplanting

林政宗 via llvm-dev llvm-dev at lists.llvm.org
Thu Oct 17 06:50:26 PDT 2019


Hello,
I am not sure how to determine the operand index in SDTypeConstraint.

For example, there a line of code in TargetSelectionDAG.td:


def SDTIntBinOp : SDTypeProfile<1, 2, [     // add, and, or, xor, udiv, etc.
  SDTCisSameAs<0, 1>, SDTCisSameAs<0, 2>, SDTCisInt<0>
]>;


The number of results is 1. The number of operands is 2. How could determine the indexes in SDTCisSameAS and SDTCisInt.
Is it that we count the results first and count the operands second starting with the end index of results?


I'm transplanting Cpu0 backend from llvm 3.9 to llvm 9.0. I find there is a different file(TargetLoweringObjectFileImpl.cpp) needing to be changed.
For example, for Sparc, line 208 to line 222:


case Triple::sparcel:
  case Triple::sparc:
    if (isPositionIndependent()) {
      LSDAEncoding = dwarf::DW_EH_PE_pcrel | dwarf::DW_EH_PE_sdata4;
      PersonalityEncoding = dwarf::DW_EH_PE_indirect | dwarf::DW_EH_PE_pcrel |
        dwarf::DW_EH_PE_sdata4;
      TTypeEncoding = dwarf::DW_EH_PE_indirect | dwarf::DW_EH_PE_pcrel |
        dwarf::DW_EH_PE_sdata4;
    } else {
      LSDAEncoding = dwarf::DW_EH_PE_absptr;
      PersonalityEncoding = dwarf::DW_EH_PE_absptr;
      TTypeEncoding = dwarf::DW_EH_PE_absptr;
    }
    CallSiteEncoding = dwarf::DW_EH_PE_udata4;
    break;
How could I understand these codes? I know little about dwarf. what materials do you suggest me to read?


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


More information about the llvm-dev mailing list