mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2026-04-27 04:18:42 +00:00
[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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233411 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
1 parent
19e2fce680
commit
f09378397e
39 files changed
+228
-107
No files matched your search
@@ -19,6 +19,7 @@ class raw_ostream;
|
||||
class MCAsmInfo;
|
||||
class MCInstrInfo;
|
||||
class MCRegisterInfo;
|
||||
class MCSubtargetInfo;
|
||||
class StringRef;
|
||||
|
||||
namespace HexStyle {
|
||||
@@ -69,7 +70,7 @@ public:
|
||||
/// printInst - Print the specified MCInst to the specified raw_ostream.
|
||||
///
|
||||
virtual void printInst(const MCInst *MI, raw_ostream &OS,
|
||||
StringRef Annot) = 0;
|
||||
StringRef Annot, const MCSubtargetInfo &STI) = 0;
|
||||
|
||||
/// getOpcodeName - Return the name of the specified opcode enum (e.g.
|
||||
/// "MOV32ri") or empty if we can't resolve it.
|
||||
|
||||
@@ -1015,6 +1015,11 @@ class AsmWriter {
|
||||
// name.
|
||||
string AsmWriterClassName = "InstPrinter";
|
||||
|
||||
// PassSubtarget - Determines whether MCSubtargetInfo should be passed to
|
||||
// the various print methods.
|
||||
// FIXME: Remove after all ports are updated.
|
||||
int PassSubtarget = 0;
|
||||
|
||||
// Variant - AsmWriters can be of multiple different variants. Variants are
|
||||
// used to support targets that need to emit assembly code in ways that are
|
||||
// mostly the same for different targets, but have minor differences in
|
||||
|
||||
Reference in new issue
Block a user