This is an archive of the discontinued LLVM Phabricator instance.

[GlobalISel]: Simple helper functions used across GISel pipeline
AbandonedPublic

Authored by aditya_nandakumar on Mar 24 2017, 5:52 PM.

Details

Summary

Add functional equivalents to SelectionDAGs isFloatingPoint(), getConstantOperandVal() which frequently is used during selection.

Diff Detail

Repository
rL LLVM

Event Timeline

ab added inline comments.Mar 27 2017, 2:17 PM
include/llvm/CodeGen/GlobalISel/Utils.h
65

This name is too generic to live in the llvm namespace (I would expect the function to take Instruction:: opcodes).

More importantly, AArch64RegisterBankInfo.cpp has a 'isPreISelGenericFloatingPointOpcode', which has a different behavior (it ignores itofp, because it interprets 'floating point opcode' as 'all operands are FP values')

IMO that shows that this is too nebulous to be shared. Keep it next to your use?

Otherwise, maybe we could make this precise enough that we could share it? For instance, 'isFloatingPointVRegDef' that takes a vreg, checks its definition, and returns true if the def is known to be FP?

76

I added a 'getConstantVRegVal' in r298855, but that's only in the selector; the Optional hopefully lets it replace all three functions (after extracting it from the selector) ?

include/llvm/CodeGen/GlobalISel/Utils.h
65

Yup - The precise definition would work. Should I rename that helper function and change the behavior to take a vreg instead?

76

Yes - getConstantVRegVal would totally replace the above functions. I'll update the backend code to use that instead.

aditya_nandakumar abandoned this revision.May 4 2017, 3:15 PM