Skip to content

Commit 06d831b

Browse files
committed
Reject unsupported loads.
1 parent abde985 commit 06d831b

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

llvm/lib/YkIR/YkIRWriter.cpp

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -706,6 +706,31 @@ class YkIRWriter {
706706

707707
void serialiseLoadInst(LoadInst *I, FuncLowerCtxt &FLCtxt, unsigned BBIdx,
708708
unsigned &InstIdx) {
709+
// We don't yet support:
710+
// - volatile loads
711+
// - atomic loads
712+
// - loads from exotic address spaces
713+
// - potentially misaligned loads
714+
//
715+
// FIXME: About misaligned loads, when a load is aligned `N`, this is a hard
716+
// guarantee to the code generator that at runtime, the pointer is aligned
717+
// to N bytes. The codegen uses this to decide whether or not to split the
718+
// operation into multiple loads (in order to avoid a memory access
719+
// straddling an alignment boundary on a CPU that disallows such things).
720+
//
721+
// For now we are going to reject any load that has an alignment value not
722+
// the same as the natural alignment of the type of the data being loaded.
723+
// Eventually we will have to encode the alignment of the load into our IR
724+
// and have the trace code generator split up the loads where necessary.
725+
// The same will have to be done for store instructions.
726+
DataLayout DL(&M);
727+
if (I->isVolatile() || (I->getOrdering() != AtomicOrdering::NotAtomic) ||
728+
(I->getPointerAddressSpace() != 0) ||
729+
(I->getAlign() != DL.getPrefTypeAlign(I->getType()))) {
730+
serialiseUnimplementedInstruction(I, FLCtxt, BBIdx, InstIdx);
731+
return;
732+
}
733+
709734
// opcode:
710735
serialiseOpcode(OpCodeLoad);
711736
// ptr:

0 commit comments

Comments
 (0)