Add @llvm.clear_cache builtin

Implementing the LLVM part of the call to __builtin___clear_cache
which translates into an intrinsic @llvm.clear_cache and is lowered
by each target, either to a call to __clear_cache or nothing at all
incase the caches are unified.

Updating LangRef and adding some tests for the implemented architectures.
Other archs will have to implement the method in case this builtin
has to be compiled for it, since the default behaviour is to bail
unimplemented.

A Clang patch is required for the builtin to be lowered into the
llvm intrinsic. This will be done next.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204802 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Renato Golin
2014-03-26 12:52:28 +00:00
parent 159e7f4095
commit c4b058f9e7
10 changed files with 135 additions and 0 deletions

View File

@@ -6939,6 +6939,36 @@ is lowered to a constant 0.
Note that runtime support may be conditional on the privilege-level code is
running at and the host platform.
'``llvm.clear_cache``' Intrinsic
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Syntax:
"""""""
::
declare void @llvm.clear_cache(i8*, i8*)
Overview:
"""""""""
The '``llvm.clear_cache``' intrinsic provides access to the systemcall
that flushes the cache at the range specified. Some targets need this
to specifically flush the instruction cache when executable data changes
in memory (self-modifying code). Other targets have unified intruction
and data cache, so they don't need any calls.
Semantics:
""""""""""
When directly supported, this intrinsic will either return a call to
the appropriate cache clearing system call (usually ``__clear_cache``)
when the caches are not unified (ARM, Mips) or just remove the call
altogether when they are (ex. x86_64).
Targets must implement it directly to have either behaviour, as the
default is to bail with "Not Implemented" message.
Standard C Library Intrinsics
-----------------------------