This is an archive of the discontinued LLVM Phabricator instance.

Function prefix data refactoring and introduction of prologue data
AbandonedPublic

Authored by bgamari on Nov 27 2014, 4:46 PM.

Details

Reviewers
pcc
rafael
rnk
Summary

This redefines the prefix attribute introduced previously and
introduces a prologue attribute. There are a two primary usecases
that these attributes aim to serve,

  1. Function prologue sigils: TODO figure out what Reid meant by this
  2. Function hot-patching: Enable the user to insert nop operations at the beginning of the function which can later be safely replaced with a call to some instrumentation facility
  3. Runtime metadata: Allow a compiler to insert data for use by the runtime during execution. GHC is one example of a compiler that needs this functionality for its tables-next-to-code functionality.

Previously prefix served cases (1) and (2) quite well by allowing the user
to introduce arbitrary data at the entrypoint but before the function
body. Case (3), however, was poorly handled by this approach as it
required that prefix data was valid executable code.

Here we redefine the notion of prefix data to instead be data which
occurs immediately before the function entrypoint (i.e. the symbol
address). Since prefix data now occurs before the function entrypoint,
there is no need for the data to be valid code.

The previous notion of prefix data now goes under the name "prologue
data" to emphasize its duality with the function epilogue.

The intention here is to handle cases (1) and (2) with prologue data and
case (3) with prefix data.

References

This idea arose out of discussions[1] with Reid Kleckner in response to a
proposal to introduce the notion of symbol offsets to enable handling of
case (3).

[1] http://lists.cs.uiuc.edu/pipermail/llvmdev/2014-May/073235.html

Diff Detail

Event Timeline

bgamari updated this revision to Diff 16709.Nov 27 2014, 4:46 PM
bgamari retitled this revision from to Prologue support.
bgamari updated this object.
bgamari edited the test plan for this revision. (Show Details)
bgamari added reviewers: rnk, pcc, rafael.
bgamari added a subscriber: Unknown Object (MLST).Nov 27 2014, 4:49 PM
bgamari retitled this revision from Prologue support to Function prefix data refactoring and introduction of prologue data.Nov 27 2014, 4:57 PM
bgamari abandoned this revision.Nov 28 2014, 7:20 AM

Abandoning in favor of D6454 where llvm-commits is a proper subscriber.