diff options
author | Reed Kotler <rkotler@mips.com> | 2013-10-27 21:57:36 +0000 |
---|---|---|
committer | Reed Kotler <rkotler@mips.com> | 2013-10-27 21:57:36 +0000 |
commit | 91ae9829a9b5718ffaf594b59d789a0e9e2aa0d3 (patch) | |
tree | ba7aa61543abba5140bde59dc9f145f89841cb4c /llvm/lib/Target/Mips/MipsAsmPrinter.h | |
parent | 31bd72fb22924a8743455dad4c281918a9c49e16 (diff) | |
download | bcm5719-llvm-91ae9829a9b5718ffaf594b59d789a0e9e2aa0d3.tar.gz bcm5719-llvm-91ae9829a9b5718ffaf594b59d789a0e9e2aa0d3.zip |
Make first substantial checkin of my port of ARM constant islands code to Mips.
Before I just ported the shell of the pass. I've tried to keep everything
nearly identical to the ARM version. I think it will be very easy to eventually
merge these two and create a new more general pass that other targets can
use. I have some improvements I would like to make to allow pools to
be shared across functions and some other things. When I'm all done we
can think about making a more general pass. More to be ported but the
basic mechanism works now almost as good as gcc mips16.
llvm-svn: 193509
Diffstat (limited to 'llvm/lib/Target/Mips/MipsAsmPrinter.h')
-rw-r--r-- | llvm/lib/Target/Mips/MipsAsmPrinter.h | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/llvm/lib/Target/Mips/MipsAsmPrinter.h b/llvm/lib/Target/Mips/MipsAsmPrinter.h index 5f6cac8f211..44b8b068dfa 100644 --- a/llvm/lib/Target/Mips/MipsAsmPrinter.h +++ b/llvm/lib/Target/Mips/MipsAsmPrinter.h @@ -42,6 +42,16 @@ private: // lowerOperand - Convert a MachineOperand into the equivalent MCOperand. bool lowerOperand(const MachineOperand &MO, MCOperand &MCOp); + /// MCP - Keep a pointer to constantpool entries of the current + /// MachineFunction. + const MachineConstantPool *MCP; + + /// InConstantPool - Maintain state when emitting a sequence of constant + /// pool entries so we can properly mark them as data regions. + bool InConstantPool; + + bool UsingConstantPools; + public: const MipsSubtarget *Subtarget; @@ -49,8 +59,11 @@ public: MipsMCInstLower MCInstLowering; explicit MipsAsmPrinter(TargetMachine &TM, MCStreamer &Streamer) - : AsmPrinter(TM, Streamer), MCInstLowering(*this) { + : AsmPrinter(TM, Streamer), MCP(0), InConstantPool(false), + MCInstLowering(*this) { Subtarget = &TM.getSubtarget<MipsSubtarget>(); + UsingConstantPools = + (Subtarget->inMips16Mode() && Subtarget->useConstantIslands()); } virtual const char *getPassName() const { @@ -59,6 +72,12 @@ public: virtual bool runOnMachineFunction(MachineFunction &MF); + virtual void EmitConstantPool() LLVM_OVERRIDE { + if (!UsingConstantPools) + AsmPrinter::EmitConstantPool(); + // we emit constant pools customly! + } + void EmitInstruction(const MachineInstr *MI); void printSavedRegsBitmask(raw_ostream &O); void printHex32(unsigned int Value, raw_ostream &O); |