This is an archive of the discontinued LLVM Phabricator instance.

Tablegen: Extend target register information by giving the users access to call preserved register mask names.
AbandonedPublic

Authored by arphaman on Jun 22 2015, 2:26 PM.

Details

Summary

This commit extends the TargetRegisterInfo class and TableGen so that the users of TRI can get the list of all the call preserved register masks and a list of names that correspond to each mask.

This patch is useful for MIR Serialization, as it would enable serialization of register mask machine operands.

Diff Detail

Repository
rL LLVM

Event Timeline

arphaman updated this revision to Diff 28160.Jun 22 2015, 2:26 PM
arphaman retitled this revision from to Tablegen: Extend target register information by giving the users access to call preserved register mask names..
arphaman updated this object.
arphaman edited the test plan for this revision. (Show Details)
arphaman added reviewers: dexonsmith, bob.wilson, bogner.
arphaman set the repository for this revision to rL LLVM.
arphaman added a subscriber: Unknown Object (MLST).

This is what tablegen would produce for the X86 TRI:

ArrayRef<const uint32_t *> X86GenRegisterInfo::getRegMasks() const {
  static const uint32_t *Masks[] = {
    CSR_32_RegMask, 
    CSR_32EHRet_RegMask, 
    CSR_64_RegMask, 
    CSR_64EHRet_RegMask, 
    CSR_64_AllRegs_RegMask, 
    CSR_64_AllRegs_AVX_RegMask, 
    CSR_64_Intel_OCL_BI_RegMask, 
    CSR_64_Intel_OCL_BI_AVX_RegMask, 
    CSR_64_Intel_OCL_BI_AVX512_RegMask, 
    CSR_64_MostRegs_RegMask, 
    CSR_64_RT_AllRegs_RegMask, 
    CSR_64_RT_AllRegs_AVX_RegMask, 
    CSR_64_RT_MostRegs_RegMask, 
    CSR_NoRegs_RegMask, 
    CSR_Win64_RegMask, 
    CSR_Win64_Intel_OCL_BI_AVX_RegMask, 
    CSR_Win64_Intel_OCL_BI_AVX512_RegMask, 
    nullptr
  };
  return ArrayRef<const uint32_t *>(Masks, (size_t)17);
}

ArrayRef<const char *> X86GenRegisterInfo::getRegMaskNames() const {
  static const char *Names[] = {
    "CSR_32",
    "CSR_32EHRet",
    "CSR_64",
    "CSR_64EHRet",
    "CSR_64_AllRegs",
    "CSR_64_AllRegs_AVX",
    "CSR_64_Intel_OCL_BI",
    "CSR_64_Intel_OCL_BI_AVX",
    "CSR_64_Intel_OCL_BI_AVX512",
    "CSR_64_MostRegs",
    "CSR_64_RT_AllRegs",
    "CSR_64_RT_AllRegs_AVX",
    "CSR_64_RT_MostRegs",
    "CSR_NoRegs",
    "CSR_Win64",
    "CSR_Win64_Intel_OCL_BI_AVX",
    "CSR_Win64_Intel_OCL_BI_AVX512",
    nullptr
  };
  return ArrayRef<const char *>(Names, (size_t)17);
}
ab added a subscriber: ab.Jun 23 2015, 12:55 PM
ab added inline comments.
include/llvm/Target/TargetRegisterInfo.h
473

ArrayRef already implies 'const', no?

arphaman abandoned this revision.Jun 23 2015, 4:30 PM

This patch got squashed with D10673.