aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2010-10-30 17:36:36 +0000
committerChris Lattner <sabre@nondot.org>2010-10-30 17:36:36 +0000
commit674c1dcca21f5edf9f7380902971fc5471c0bd4a (patch)
treeb25b3b65baa600caf962eb7b8b666d378dfdcc40 /include
parent905b8f76142b43cd33c36c554d359ee8740f51d5 (diff)
downloadexternal_llvm-674c1dcca21f5edf9f7380902971fc5471c0bd4a.zip
external_llvm-674c1dcca21f5edf9f7380902971fc5471c0bd4a.tar.gz
external_llvm-674c1dcca21f5edf9f7380902971fc5471c0bd4a.tar.bz2
implement (and document!) the first kind of MC assembler alias, which
just remaps one mnemonic to another. Convert a few of the X86 aliases from .cpp to .td code. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@117815 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r--include/llvm/Target/Target.td19
1 files changed, 19 insertions, 0 deletions
diff --git a/include/llvm/Target/Target.td b/include/llvm/Target/Target.td
index 7db2e86..39f4ba7 100644
--- a/include/llvm/Target/Target.td
+++ b/include/llvm/Target/Target.td
@@ -530,6 +530,25 @@ class AsmParser {
def DefaultAsmParser : AsmParser;
+/// MnemonicAlias - This class allows targets to define assembler mnemonic
+/// aliases. This should be used when all forms of one mnemonic are accepted
+/// with a different mnemonic. For example, X86 allows:
+/// sal %al, 1 -> shl %al, 1
+/// sal %ax, %cl -> shl %ax, %cl
+/// sal %eax, %cl -> shl %eax, %cl
+/// etc. Though "sal" is accepted with many forms, all of them are directly
+/// translated to a shl, so it can be handled with (in the case of X86, it
+/// actually has one for each suffix as well):
+/// def : MnemonicAlias<"sal", "shl">;
+///
+/// Mnemonic aliases are mapped before any other translation in the match phase.
+///
+class MnemonicAlias<string From, string To> {
+ string FromMnemonic = From;
+ string ToMnemonic = To;
+}
+
+
//===----------------------------------------------------------------------===//
// AsmWriter - This class can be implemented by targets that need to customize
// the format of the .s file writer.