summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/PTX/PTXAsmPrinter.cpp
diff options
context:
space:
mode:
authorJustin Holewinski <justin.holewinski@gmail.com>2011-06-20 15:56:20 +0000
committerJustin Holewinski <justin.holewinski@gmail.com>2011-06-20 15:56:20 +0000
commitc7b073da0fc9b64ab352c0e38cb571c1a3c76b44 (patch)
tree7973e60b9a1226a8c12224c34f298502d222adf1 /llvm/lib/Target/PTX/PTXAsmPrinter.cpp
parent254f82112d0c73eaf198e629792bc75285e875f7 (diff)
downloadbcm5719-llvm-c7b073da0fc9b64ab352c0e38cb571c1a3c76b44.tar.gz
bcm5719-llvm-c7b073da0fc9b64ab352c0e38cb571c1a3c76b44.zip
PTX: Add basic register spilling code
The current implementation generates stack loads/stores, which are really just mov instructions from/to "special" registers. This may not be the most efficient implementation, compared to an approach where the stack registers are directly folded into instructions, but this is easier to implement and I have yet to see a case where ptxas is unable to see through this kind of register usage and know what is really going on. llvm-svn: 133443
Diffstat (limited to 'llvm/lib/Target/PTX/PTXAsmPrinter.cpp')
-rw-r--r--llvm/lib/Target/PTX/PTXAsmPrinter.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/llvm/lib/Target/PTX/PTXAsmPrinter.cpp b/llvm/lib/Target/PTX/PTXAsmPrinter.cpp
index df973fdeb76..6f6fc29673e 100644
--- a/llvm/lib/Target/PTX/PTXAsmPrinter.cpp
+++ b/llvm/lib/Target/PTX/PTXAsmPrinter.cpp
@@ -23,6 +23,7 @@
#include "llvm/ADT/StringExtras.h"
#include "llvm/ADT/Twine.h"
#include "llvm/CodeGen/AsmPrinter.h"
+#include "llvm/CodeGen/MachineFrameInfo.h"
#include "llvm/CodeGen/MachineInstr.h"
#include "llvm/CodeGen/MachineRegisterInfo.h"
#include "llvm/MC/MCStreamer.h"
@@ -194,6 +195,18 @@ void PTXAsmPrinter::EmitFunctionBodyStart() {
def += ';';
OutStreamer.EmitRawText(Twine(def));
}
+
+ const MachineFrameInfo* FrameInfo = MF->getFrameInfo();
+ DEBUG(dbgs() << "Have " << FrameInfo->getNumObjects() << " frame object(s)\n");
+ for (unsigned i = 0, e = FrameInfo->getNumObjects(); i != e; ++i) {
+ DEBUG(dbgs() << "Size of object: " << FrameInfo->getObjectSize(i) << "\n");
+ std::string def = "\t.reg .b";
+ def += utostr(FrameInfo->getObjectSize(i)*8); // Convert to bits
+ def += " s";
+ def += utostr(i);
+ def += ";";
+ OutStreamer.EmitRawText(Twine(def));
+ }
}
void PTXAsmPrinter::EmitInstruction(const MachineInstr *MI) {
OpenPOWER on IntegriCloud