aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorJames Molloy <james.molloy@arm.com>2011-09-07 17:24:38 +0000
committerJames Molloy <james.molloy@arm.com>2011-09-07 17:24:38 +0000
commitb950585cc5a0d665e9accfe5ce490cd269756f2e (patch)
tree70f25e269b3e66fe882501df4ae7caeacf154eee /include
parent758ba1f4edfe2a2876c91022f921180a6dbece01 (diff)
downloadexternal_llvm-b950585cc5a0d665e9accfe5ce490cd269756f2e.zip
external_llvm-b950585cc5a0d665e9accfe5ce490cd269756f2e.tar.gz
external_llvm-b950585cc5a0d665e9accfe5ce490cd269756f2e.tar.bz2
Refactor instprinter and mcdisassembler to take a SubtargetInfo. Add -mattr= handling to llvm-mc. Reviewed by Owen Anderson.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@139237 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r--include/llvm/MC/MCDisassembler.h6
-rw-r--r--include/llvm/Support/TargetRegistry.h15
2 files changed, 14 insertions, 7 deletions
diff --git a/include/llvm/MC/MCDisassembler.h b/include/llvm/MC/MCDisassembler.h
index adcb882..404b8aa 100644
--- a/include/llvm/MC/MCDisassembler.h
+++ b/include/llvm/MC/MCDisassembler.h
@@ -15,6 +15,7 @@
namespace llvm {
class MCInst;
+class MCSubtargetInfo;
class MemoryObject;
class raw_ostream;
class MCContext;
@@ -54,7 +55,7 @@ public:
};
/// Constructor - Performs initial setup for the disassembler.
- MCDisassembler() : GetOpInfo(0), DisInfo(0), Ctx(0) {}
+ MCDisassembler(const MCSubtargetInfo &STI) : GetOpInfo(0), DisInfo(0), Ctx(0), STI(STI) {}
virtual ~MCDisassembler();
@@ -98,6 +99,9 @@ private:
// The assembly context for creating symbols and MCExprs in place of
// immediate operands when there is symbolic information.
MCContext *Ctx;
+protected:
+ // Subtarget information, for instruction decoding predicates if required.
+ const MCSubtargetInfo &STI;
public:
void setupForSymbolicDisassembly(LLVMOpInfoCallback getOpInfo,
diff --git a/include/llvm/Support/TargetRegistry.h b/include/llvm/Support/TargetRegistry.h
index 8c07461..45f249d 100644
--- a/include/llvm/Support/TargetRegistry.h
+++ b/include/llvm/Support/TargetRegistry.h
@@ -94,10 +94,12 @@ namespace llvm {
const MCAsmInfo &MAI);
typedef MCTargetAsmParser *(*MCAsmParserCtorTy)(MCSubtargetInfo &STI,
MCAsmParser &P);
- typedef MCDisassembler *(*MCDisassemblerCtorTy)(const Target &T);
+ typedef MCDisassembler *(*MCDisassemblerCtorTy)(const Target &T,
+ const MCSubtargetInfo &STI);
typedef MCInstPrinter *(*MCInstPrinterCtorTy)(const Target &T,
unsigned SyntaxVariant,
- const MCAsmInfo &MAI);
+ const MCAsmInfo &MAI,
+ const MCSubtargetInfo &STI);
typedef MCCodeEmitter *(*MCCodeEmitterCtorTy)(const MCInstrInfo &II,
const MCSubtargetInfo &STI,
MCContext &Ctx);
@@ -373,17 +375,18 @@ namespace llvm {
return AsmPrinterCtorFn(TM, Streamer);
}
- MCDisassembler *createMCDisassembler() const {
+ MCDisassembler *createMCDisassembler(const MCSubtargetInfo &STI) const {
if (!MCDisassemblerCtorFn)
return 0;
- return MCDisassemblerCtorFn(*this);
+ return MCDisassemblerCtorFn(*this, STI);
}
MCInstPrinter *createMCInstPrinter(unsigned SyntaxVariant,
- const MCAsmInfo &MAI) const {
+ const MCAsmInfo &MAI,
+ const MCSubtargetInfo &STI) const {
if (!MCInstPrinterCtorFn)
return 0;
- return MCInstPrinterCtorFn(*this, SyntaxVariant, MAI);
+ return MCInstPrinterCtorFn(*this, SyntaxVariant, MAI, STI);
}