summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/BPF
diff options
context:
space:
mode:
authorAkira Hatanaka <ahatanaka@apple.com>2015-03-27 20:36:02 +0000
committerAkira Hatanaka <ahatanaka@apple.com>2015-03-27 20:36:02 +0000
commitb46d0234a6969727567cd8c8eaddd1da65d15233 (patch)
tree8d37817da3002009aa4c67552dc3347f21d6c41d /llvm/lib/Target/BPF
parentfaf8065a99817bcb10e6f09b558fe3e0972c35ce (diff)
downloadbcm5719-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/lib/Target/BPF')
-rw-r--r--llvm/lib/Target/BPF/InstPrinter/BPFInstPrinter.cpp2
-rw-r--r--llvm/lib/Target/BPF/InstPrinter/BPFInstPrinter.h3
2 files changed, 3 insertions, 2 deletions
diff --git a/llvm/lib/Target/BPF/InstPrinter/BPFInstPrinter.cpp b/llvm/lib/Target/BPF/InstPrinter/BPFInstPrinter.cpp
index 3f09379ddab..05f6d825719 100644
--- a/llvm/lib/Target/BPF/InstPrinter/BPFInstPrinter.cpp
+++ b/llvm/lib/Target/BPF/InstPrinter/BPFInstPrinter.cpp
@@ -27,7 +27,7 @@ using namespace llvm;
#include "BPFGenAsmWriter.inc"
void BPFInstPrinter::printInst(const MCInst *MI, raw_ostream &O,
- StringRef Annot) {
+ StringRef Annot, const MCSubtargetInfo &STI) {
printInstruction(MI, O);
printAnnotation(O, Annot);
}
diff --git a/llvm/lib/Target/BPF/InstPrinter/BPFInstPrinter.h b/llvm/lib/Target/BPF/InstPrinter/BPFInstPrinter.h
index d7c2899430b..adcaff68693 100644
--- a/llvm/lib/Target/BPF/InstPrinter/BPFInstPrinter.h
+++ b/llvm/lib/Target/BPF/InstPrinter/BPFInstPrinter.h
@@ -25,7 +25,8 @@ public:
const MCRegisterInfo &MRI)
: MCInstPrinter(MAI, MII, MRI) {}
- void printInst(const MCInst *MI, raw_ostream &O, StringRef Annot) override;
+ void printInst(const MCInst *MI, raw_ostream &O, StringRef Annot,
+ const MCSubtargetInfo &STI) override;
void printOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O,
const char *Modifier = nullptr);
void printMemOperand(const MCInst *MI, int OpNo, raw_ostream &O,
OpenPOWER on IntegriCloud