Skip to content

Commit 5845837

Browse files
authored
Merge pull request rust-lang#172 from vext01/volatile
Serialise volatile memory accesses.
2 parents c7d7cf1 + e80db65 commit 5845837

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

llvm/lib/YkIR/YkIRWriter.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -707,7 +707,6 @@ class YkIRWriter {
707707
void serialiseLoadInst(LoadInst *I, FuncLowerCtxt &FLCtxt, unsigned BBIdx,
708708
unsigned &InstIdx) {
709709
// We don't yet support:
710-
// - volatile loads
711710
// - atomic loads
712711
// - loads from exotic address spaces
713712
// - potentially misaligned loads
@@ -726,7 +725,7 @@ class YkIRWriter {
726725
// Eventually we will have to encode the alignment of the load into our IR
727726
// and have the trace code generator split up the loads where necessary.
728727
// The same will have to be done for store instructions.
729-
if (I->isVolatile() || (I->getOrdering() != AtomicOrdering::NotAtomic) ||
728+
if ((I->getOrdering() != AtomicOrdering::NotAtomic) ||
730729
(I->getPointerAddressSpace() != 0) ||
731730
(I->getAlign() < DL.getTypeSizeInBits(I->getType()) / 8)) {
732731
serialiseUnimplementedInstruction(I, FLCtxt, BBIdx, InstIdx);
@@ -739,6 +738,8 @@ class YkIRWriter {
739738
serialiseOperand(I, FLCtxt, I->getPointerOperand());
740739
// type_idx:
741740
OutStreamer.emitSizeT(typeIndex(I->getType()));
741+
// volatile:
742+
OutStreamer.emitInt8(I->isVolatile());
742743

743744
FLCtxt.updateVLMap(I, InstIdx);
744745
InstIdx++;
@@ -747,14 +748,13 @@ class YkIRWriter {
747748
void serialiseStoreInst(StoreInst *I, FuncLowerCtxt &FLCtxt, unsigned BBIdx,
748749
unsigned &InstIdx) {
749750
// We don't yet support:
750-
// - volatile store
751751
// - atomic store
752752
// - stores into exotic address spaces
753753
// - potentially misaligned stores
754754
//
755755
// See the comment in `serialiseLoadInst()` for context on misaligned memory
756756
// accesses.
757-
if (I->isVolatile() || (I->getOrdering() != AtomicOrdering::NotAtomic) ||
757+
if ((I->getOrdering() != AtomicOrdering::NotAtomic) ||
758758
(I->getPointerAddressSpace() != 0) ||
759759
(I->getAlign() <
760760
DL.getTypeSizeInBits(I->getValueOperand()->getType()) / 8)) {
@@ -768,6 +768,8 @@ class YkIRWriter {
768768
serialiseOperand(I, FLCtxt, I->getValueOperand());
769769
// ptr:
770770
serialiseOperand(I, FLCtxt, I->getPointerOperand());
771+
// volatile:
772+
OutStreamer.emitInt8(I->isVolatile());
771773

772774
InstIdx++;
773775
}

0 commit comments

Comments
 (0)