@@ -706,6 +706,31 @@ class YkIRWriter {
706
706
707
707
void serialiseLoadInst (LoadInst *I, FuncLowerCtxt &FLCtxt, unsigned BBIdx,
708
708
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
+
709
734
// opcode:
710
735
serialiseOpcode (OpCodeLoad);
711
736
// ptr:
0 commit comments