diff options
author | Chris Lattner <sabre@nondot.org> | 2010-10-30 19:23:13 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2010-10-30 19:23:13 +0000 |
commit | 693173feefaa326fad0e386470846fb3199ba381 (patch) | |
tree | df8851a37072eb03789bcb2f4250e30ffeb5f866 /docs | |
parent | 8cc0a6b788a17b3afc779e9da90f5203c8b78436 (diff) | |
download | external_llvm-693173feefaa326fad0e386470846fb3199ba381.zip external_llvm-693173feefaa326fad0e386470846fb3199ba381.tar.gz external_llvm-693173feefaa326fad0e386470846fb3199ba381.tar.bz2 |
Implement (and document!) support for MnemonicAlias's to have Requires
directives, allowing things like this:
def : MnemonicAlias<"pop", "popl">, Requires<[In32BitMode]>;
def : MnemonicAlias<"pop", "popq">, Requires<[In64BitMode]>;
Move the rest of the X86 MnemonicAliases over to the .td file.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@117830 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'docs')
-rw-r--r-- | docs/CodeGenerator.html | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/docs/CodeGenerator.html b/docs/CodeGenerator.html index de6a5c1..60d54e5 100644 --- a/docs/CodeGenerator.html +++ b/docs/CodeGenerator.html @@ -1896,7 +1896,7 @@ compiler.</p> The MatchInstructionImpl function performs alias processing and then does actual matching.</p> -<p>Alias processing if the phase that canonicalizes different lexical forms of +<p>Alias processing is the phase that canonicalizes different lexical forms of the same instructions down to one representation. There are several different kinds of alias that are possible to implement and they are listed below in the order that they are processed (which is in order from simplest/weakest to most @@ -1911,7 +1911,7 @@ description.</p> <p>The first phase of alias processing is simple instruction mneomonic remapping for classes of instructions which are allowed with two different -mneomonics. This phase is a simple and unconditionally remapping from one input +mnemonics. This phase is a simple and unconditionally remapping from one input mnemonic to one output mnemonic. It isn't possible for this form of alias to look at the operands at all, so the remapping must apply for all forms of a given mnemonic. Mnemonic aliases are defined simply, for example X86 has: @@ -1928,7 +1928,19 @@ def : MnemonicAlias<"ud2a", "ud2">; </div> <p>... and many others. With a MnemonicAlias definition, the mnemonic is -remapped simply and directly.</p> +remapped simply and directly. Though MnemonicAlias's can't look at any aspect +of the instruction (such as the operands) they can depend on global modes (the +same ones supported by the matcher), through a Requires clause:</p> + +<div class="doc_code"> +<pre> +def : MnemonicAlias<"pushf", "pushfq">, Requires<[In64BitMode]>; +def : MnemonicAlias<"pushf", "pushfl">, Requires<[In32BitMode]>; +</pre> +</div> + +<p>In this example, the mnemonic gets mapped into different a new one depending +on the current instruction set.</p> </div> |