summaryrefslogtreecommitdiffstats
path: root/llvm/lib/MC/MCStreamer.cpp
diff options
context:
space:
mode:
authorAlexey Bataev <a.bataev@hotmail.com>2018-10-24 14:04:00 +0000
committerAlexey Bataev <a.bataev@hotmail.com>2018-10-24 14:04:00 +0000
commitc15c853c3a4bf16e6065ad326c7279d38dba57db (patch)
tree00b128d85f70ad558f733ae529175f53effbf059 /llvm/lib/MC/MCStreamer.cpp
parente8437cbf5e9c41c27da6be13996963529c8ca1bf (diff)
downloadbcm5719-llvm-c15c853c3a4bf16e6065ad326c7279d38dba57db.tar.gz
bcm5719-llvm-c15c853c3a4bf16e6065ad326c7279d38dba57db.zip
[DEBUGINFO, NVPTX] Try to pack bytes data into a single string.
Summary: If the target does not support `.asciz` and `.ascii` directives, the strings are represented as bytes and each byte is placed on the new line as a separate byte directive `.b8 <data>`. NVPTX target allows to represent the vector of the data of the same type as a vector, where values are separated using `,` symbol: `.b8 <data1>,<data2>,...`. This allows to reduce the size of the final PTX file. Ptxas tool includes ptx files into the resulting binary object, so reducing the size of the PTX file is important. Reviewers: tra, jlebar, echristo Subscribers: jholewinski, llvm-commits Differential Revision: https://reviews.llvm.org/D45822 llvm-svn: 345142
Diffstat (limited to 'llvm/lib/MC/MCStreamer.cpp')
-rw-r--r--llvm/lib/MC/MCStreamer.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/llvm/lib/MC/MCStreamer.cpp b/llvm/lib/MC/MCStreamer.cpp
index bfcf6d47a78..1b704b89320 100644
--- a/llvm/lib/MC/MCStreamer.cpp
+++ b/llvm/lib/MC/MCStreamer.cpp
@@ -72,6 +72,18 @@ void MCTargetStreamer::emitValue(const MCExpr *Value) {
Streamer.EmitRawText(OS.str());
}
+void MCTargetStreamer::emitRawBytes(StringRef Data) {
+ const MCAsmInfo *MAI = Streamer.getContext().getAsmInfo();
+ const char *Directive = MAI->getData8bitsDirective();
+ for (const unsigned char C : Data.bytes()) {
+ SmallString<128> Str;
+ raw_svector_ostream OS(Str);
+
+ OS << Directive << (unsigned)C;
+ Streamer.EmitRawText(OS.str());
+ }
+}
+
void MCTargetStreamer::emitAssignment(MCSymbol *Symbol, const MCExpr *Value) {}
MCStreamer::MCStreamer(MCContext &Ctx)
OpenPOWER on IntegriCloud