Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,7 @@ enum {
/// - OpIdx(ULEB128) - Operand index
/// - SizeInBits(ULEB128) - The size of the pointer value in bits.
GIM_CheckPointerToAny,
GIM_CheckIntPtr,

/// Check the register bank for the specified operand
/// - InsnID(ULEB128) - Instruction ID
Expand Down
12 changes: 8 additions & 4 deletions llvm/include/llvm/CodeGen/GlobalISel/GIMatchTableExecutorImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -719,14 +719,17 @@ bool GIMatchTableExecutor::executeMatchTable(
}
break;
}
case GIM_CheckIntPtr:
case GIM_CheckPointerToAny: {
bool IsPointerCheck = MatcherOpcode == GIM_CheckPointerToAny;
uint64_t InsnID = readULEB();
uint64_t OpIdx = readULEB();
uint64_t SizeInBits = readULEB();

DEBUG_WITH_TYPE(TgtExecutor::getName(),
dbgs() << CurrentIdx << ": GIM_CheckPointerToAny(MIs["
<< InsnID << "]->getOperand(" << OpIdx
dbgs() << CurrentIdx << ": GIM_Check"
<< (IsPointerCheck ? "PointerToAny" : "IntPtr")
<< "(MIs[" << InsnID << "]->getOperand(" << OpIdx
<< "), SizeInBits=" << SizeInBits << ")\n");
assert(State.MIs[InsnID] != nullptr && "Used insn before defined");
MachineOperand &MO = State.MIs[InsnID]->getOperand(OpIdx);
Expand All @@ -735,14 +738,15 @@ bool GIMatchTableExecutor::executeMatchTable(
// iPTR must be looked up in the target.
if (SizeInBits == 0) {
MachineFunction *MF = State.MIs[InsnID]->getParent()->getParent();
const unsigned AddrSpace = Ty.getAddressSpace();
const unsigned AddrSpace = IsPointerCheck ? Ty.getAddressSpace() : 0;
SizeInBits = MF->getDataLayout().getPointerSizeInBits(AddrSpace);
}

assert(SizeInBits != 0 && "Pointer size must be known");

if (MO.isReg()) {
if (!Ty.isPointer() || Ty.getSizeInBits() != SizeInBits)
if ((IsPointerCheck && !Ty.isPointer()) ||
Ty.getSizeInBits() != SizeInBits)
if (handleReject() == RejectAndGiveUp)
return false;
} else if (handleReject() == RejectAndGiveUp)
Expand Down
1 change: 1 addition & 0 deletions llvm/include/llvm/Target/GlobalISel/SelectionDAGCompat.td
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ def : GINodeEquiv<G_CTTZ_ZERO_UNDEF, cttz_zero_undef>;
def : GINodeEquiv<G_CTPOP, ctpop>;
def : GINodeEquiv<G_EXTRACT_VECTOR_ELT, extractelt>;
def : GINodeEquiv<G_INSERT_VECTOR_ELT, vector_insert>;
def : GINodeEquiv<G_INSERT_VECTOR_ELT, insertelt>;
def : GINodeEquiv<G_CONCAT_VECTORS, concat_vectors>;
def : GINodeEquiv<G_BUILD_VECTOR, build_vector>;
def : GINodeEquiv<G_FCEIL, fceil>;
Expand Down
Loading
Loading