This is an archive of the discontinued LLVM Phabricator instance.

[CodeGen] Introduce a FAULTING_LOAD_OP pseudo-op.
ClosedPublic

Authored by sanjoy on Jun 2 2015, 2:34 PM.

Details

Summary

This instruction encodes a loading operation that may fault, and a label
to branch to if the load page-faults. The locations of potentially
faulting loads and their "handler" destinations are recorded in a
FaultMap section, meant to be consumed by LLVM's clients.

Nothing generates FAULTING_LOAD_OP instructions yet, but they will be
used in a future change.

The documentation (FaultMaps.rst) needs improvement and I will update
this diff with a more expanded version shortly.

Depends on D10196

Diff Detail

Repository
rL LLVM

Event Timeline

sanjoy updated this revision to Diff 27006.Jun 2 2015, 2:34 PM
sanjoy retitled this revision from to [CodeGen] Introduce a FAULTING_LOAD_OP pseudo-op..
sanjoy updated this object.
sanjoy edited the test plan for this revision. (Show Details)
sanjoy added reviewers: atrick, rnk, reames, pgavlin, AndyAyers.
sanjoy added a subscriber: Unknown Object (MLST).
sanjoy added a reviewer: ab.Jun 5 2015, 9:14 AM
pgavlin added inline comments.Jun 9 2015, 9:55 AM
include/llvm/CodeGen/FaultMaps.h
2 ↗(On Diff #27006)

Extra blank line.

15 ↗(On Diff #27006)

Extra blank line.

54 ↗(On Diff #27006)

Nit: s/FunctionFaultingInfo/FunctionFaultInfos/

lib/CodeGen/FaultMaps.cpp
11 ↗(On Diff #27006)

Extra blank line.

75–86 ↗(On Diff #27006)

What specifically about testing are you trying to make easier here? Are you just looking for determinism in the output order? If so, perhaps it would be better if FunctionInfos was a std::map, which should give you this property without the extra work.

FWIW, I think determinism here is useful beyond the scope of testing, so it would be nice to be able to provide it relatively cheaply.

lib/MC/MCObjectFileInfo.cpp
523 ↗(On Diff #27006)

Could you also add code to initialize FaultMapSection for COFF objects?

lib/Target/X86/X86AsmPrinter.cpp
686 ↗(On Diff #27006)

Please serialize the fault map section for COFF objects as well.

atrick accepted this revision.Jun 9 2015, 3:02 PM
atrick edited edge metadata.

Looks good.

docs/FaultMaps.rst
20–26 ↗(On Diff #27006)

Should this be an admonition?

52 ↗(On Diff #27006)

"Handler"

This revision is now accepted and ready to land.Jun 9 2015, 3:02 PM
sanjoy updated this revision to Diff 27421.Jun 9 2015, 6:36 PM
sanjoy edited edge metadata.
  • address review
docs/FaultMaps.rst
20–26 ↗(On Diff #27006)

I don't think I understand -- what should be an admonition?

52 ↗(On Diff #27006)

Fixed.

include/llvm/CodeGen/FaultMaps.h
2 ↗(On Diff #27006)

Fixed.

15 ↗(On Diff #27006)

This one was intentional, to visually separate the llvm/ includes from the stdlib includes. :)

54 ↗(On Diff #27006)

Fixed.

lib/CodeGen/FaultMaps.cpp
11 ↗(On Diff #27006)

That's intentional, to visually separate the header this file implements from the rest.

75–86 ↗(On Diff #27006)

What specifically about testing are you trying to make easier here?

FileCheck based testing, I don't want tests to spuriously fail just because the order in which we emitted function infos changed. I'll change the data structure to an std::map and remove the sorting step.

lib/MC/MCObjectFileInfo.cpp
523 ↗(On Diff #27006)

I don't know enough about COFF to confidently do that, and I don't have a stackmap example to copy from -- do you mind adding that bit of code once this change has landed?

pgavlin accepted this revision.Jun 11 2015, 10:44 AM
pgavlin edited edge metadata.

I don't know enough about COFF to confidently do that, and I don't have a stackmap example to copy from -- do you mind adding that bit of code once this change has landed?

Sure, that sounds fine.

LGTM otherwise.

This revision was automatically updated to reflect the committed changes.