diff options
author | Akira Hatanaka <ahatanaka@apple.com> | 2015-03-27 20:36:02 +0000 |
---|---|---|
committer | Akira Hatanaka <ahatanaka@apple.com> | 2015-03-27 20:36:02 +0000 |
commit | b46d0234a6969727567cd8c8eaddd1da65d15233 (patch) | |
tree | 8d37817da3002009aa4c67552dc3347f21d6c41d /llvm/utils/TableGen/AsmWriterInst.h | |
parent | faf8065a99817bcb10e6f09b558fe3e0972c35ce (diff) | |
download | bcm5719-llvm-b46d0234a6969727567cd8c8eaddd1da65d15233.tar.gz bcm5719-llvm-b46d0234a6969727567cd8c8eaddd1da65d15233.zip |
[MCInstPrinter] Enable MCInstPrinter to change its behavior based on the
per-function subtarget.
Currently, code-gen passes the default or generic subtarget to the constructors
of MCInstPrinter subclasses (see LLVMTargetMachine::addPassesToEmitFile), which
enables some targets (AArch64, ARM, and X86) to change their instprinter's
behavior based on the subtarget feature bits. Since the backend can now use
different subtargets for each function, instprinter has to be changed to use the
per-function subtarget rather than the default subtarget.
This patch takes the first step towards enabling instprinter to change its
behavior based on the per-function subtarget. It adds a bit "PassSubtarget" to
AsmWriter which tells table-gen to pass a reference to MCSubtargetInfo to the
various print methods table-gen auto-generates.
I will follow up with changes to instprinters of AArch64, ARM, and X86.
llvm-svn: 233411
Diffstat (limited to 'llvm/utils/TableGen/AsmWriterInst.h')
-rw-r--r-- | llvm/utils/TableGen/AsmWriterInst.h | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/llvm/utils/TableGen/AsmWriterInst.h b/llvm/utils/TableGen/AsmWriterInst.h index 6a900b79970..a597e6ba1a5 100644 --- a/llvm/utils/TableGen/AsmWriterInst.h +++ b/llvm/utils/TableGen/AsmWriterInst.h @@ -53,6 +53,11 @@ namespace llvm { /// an operand, specified with syntax like ${opname:modifier}. std::string MiModifier; + // PassSubtarget - Pass MCSubtargetInfo to the print method if this is + // equal to 1. + // FIXME: Remove after all ports are updated. + unsigned PassSubtarget; + // To make VS STL happy AsmWriterOperand(OpType op = isLiteralTextOperand):OperandType(op) {} @@ -64,9 +69,10 @@ namespace llvm { unsigned _CGIOpNo, unsigned _MIOpNo, const std::string &Modifier, + unsigned PassSubtarget, OpType op = isMachineInstrOperand) : OperandType(op), Str(Printer), CGIOpNo(_CGIOpNo), MIOpNo(_MIOpNo), - MiModifier(Modifier) {} + MiModifier(Modifier), PassSubtarget(PassSubtarget) {} bool operator!=(const AsmWriterOperand &Other) const { if (OperandType != Other.OperandType || Str != Other.Str) return true; @@ -88,7 +94,7 @@ namespace llvm { const CodeGenInstruction *CGI; AsmWriterInst(const CodeGenInstruction &CGI, - unsigned Variant); + unsigned Variant, unsigned PassSubtarget); /// MatchesAllButOneOp - If this instruction is exactly identical to the /// specified instruction except for one differing operand, return the |