Daniel Dunbar | a11af53 | 2009-06-24 01:03:06 +0000 | [diff] [blame] | 1 | //===- lib/MC/MCStreamer.cpp - Streaming Machine Code Output --------------===// |
| 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
| 5 | // This file is distributed under the University of Illinois Open Source |
| 6 | // License. See LICENSE.TXT for details. |
| 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | |
Rafael Espindola | 0bbe0b4 | 2010-12-06 17:27:56 +0000 | [diff] [blame] | 10 | #include "llvm/MC/MCAsmInfo.h" |
Rafael Espindola | af6b5808 | 2010-11-16 21:20:32 +0000 | [diff] [blame] | 11 | #include "llvm/MC/MCContext.h" |
Daniel Dunbar | a11af53 | 2009-06-24 01:03:06 +0000 | [diff] [blame] | 12 | #include "llvm/MC/MCStreamer.h" |
Chris Lattner | ddf6bdd | 2010-01-19 18:45:47 +0000 | [diff] [blame] | 13 | #include "llvm/MC/MCExpr.h" |
Kevin Enderby | c095793 | 2010-09-30 16:52:03 +0000 | [diff] [blame] | 14 | #include "llvm/MC/MCObjectWriter.h" |
Rafael Espindola | 484291c | 2010-11-01 14:28:48 +0000 | [diff] [blame] | 15 | #include "llvm/Support/ErrorHandling.h" |
Chris Lattner | d79d9dc | 2010-01-22 19:17:48 +0000 | [diff] [blame] | 16 | #include "llvm/Support/raw_ostream.h" |
Chris Lattner | 58bc4dd | 2010-04-03 22:12:35 +0000 | [diff] [blame] | 17 | #include "llvm/ADT/SmallString.h" |
| 18 | #include "llvm/ADT/Twine.h" |
Chris Lattner | 3580dea | 2010-04-03 21:48:59 +0000 | [diff] [blame] | 19 | #include <cstdlib> |
Daniel Dunbar | a11af53 | 2009-06-24 01:03:06 +0000 | [diff] [blame] | 20 | using namespace llvm; |
| 21 | |
Rafael Espindola | 7768a9d | 2011-02-16 01:08:29 +0000 | [diff] [blame] | 22 | MCStreamer::MCStreamer(MCContext &Ctx) : Context(Ctx) { |
Joerg Sonnenberger | 7d0805d | 2011-02-21 01:07:42 +0000 | [diff] [blame] | 23 | const MCSection *section = NULL; |
| 24 | SectionStack.push_back(std::make_pair(section, section)); |
Daniel Dunbar | a11af53 | 2009-06-24 01:03:06 +0000 | [diff] [blame] | 25 | } |
| 26 | |
| 27 | MCStreamer::~MCStreamer() { |
| 28 | } |
Chris Lattner | ddf6bdd | 2010-01-19 18:45:47 +0000 | [diff] [blame] | 29 | |
Chris Lattner | d79d9dc | 2010-01-22 19:17:48 +0000 | [diff] [blame] | 30 | raw_ostream &MCStreamer::GetCommentOS() { |
| 31 | // By default, discard comments. |
| 32 | return nulls(); |
| 33 | } |
| 34 | |
Rafael Espindola | 32a006e | 2010-12-03 00:55:40 +0000 | [diff] [blame] | 35 | void MCStreamer::EmitDwarfSetLineAddr(int64_t LineDelta, |
| 36 | const MCSymbol *Label, int PointerSize) { |
| 37 | // emit the sequence to set the address |
| 38 | EmitIntValue(dwarf::DW_LNS_extended_op, 1); |
| 39 | EmitULEB128IntValue(PointerSize + 1); |
| 40 | EmitIntValue(dwarf::DW_LNE_set_address, 1); |
| 41 | EmitSymbolValue(Label, PointerSize); |
| 42 | |
| 43 | // emit the sequence for the LineDelta (from 1) and a zero address delta. |
| 44 | MCDwarfLineAddr::Emit(this, LineDelta, 0); |
| 45 | } |
Chris Lattner | d79d9dc | 2010-01-22 19:17:48 +0000 | [diff] [blame] | 46 | |
Chris Lattner | 32ae3fe | 2010-01-19 22:03:38 +0000 | [diff] [blame] | 47 | /// EmitIntValue - Special case of EmitValue that avoids the client having to |
| 48 | /// pass in a MCExpr for constant integers. |
| 49 | void MCStreamer::EmitIntValue(uint64_t Value, unsigned Size, |
| 50 | unsigned AddrSpace) { |
Devang Patel | dea914b | 2010-12-09 19:26:21 +0000 | [diff] [blame] | 51 | assert(Size <= 8 && "Invalid size"); |
Matt Beaumont-Gay | 818b5f5 | 2010-12-15 23:14:45 +0000 | [diff] [blame] | 52 | assert((isUIntN(8 * Size, Value) || isIntN(8 * Size, Value)) && |
| 53 | "Invalid size"); |
Rafael Espindola | 2df042c | 2010-12-03 02:54:21 +0000 | [diff] [blame] | 54 | char buf[8]; |
| 55 | // FIXME: Endianness assumption. |
| 56 | for (unsigned i = 0; i != Size; ++i) |
| 57 | buf[i] = uint8_t(Value >> (i * 8)); |
| 58 | EmitBytes(StringRef(buf, Size), AddrSpace); |
Chris Lattner | 32ae3fe | 2010-01-19 22:03:38 +0000 | [diff] [blame] | 59 | } |
| 60 | |
Rafael Espindola | 3ff5709 | 2010-11-02 17:22:24 +0000 | [diff] [blame] | 61 | /// EmitULEB128Value - Special case of EmitULEB128Value that avoids the |
| 62 | /// client having to pass in a MCExpr for constant integers. |
| 63 | void MCStreamer::EmitULEB128IntValue(uint64_t Value, unsigned AddrSpace) { |
Rafael Espindola | 660b5fc | 2010-12-03 01:19:49 +0000 | [diff] [blame] | 64 | SmallString<32> Tmp; |
| 65 | raw_svector_ostream OSE(Tmp); |
| 66 | MCObjectWriter::EncodeULEB128(Value, OSE); |
| 67 | EmitBytes(OSE.str(), AddrSpace); |
Kevin Enderby | c095793 | 2010-09-30 16:52:03 +0000 | [diff] [blame] | 68 | } |
| 69 | |
Rafael Espindola | 3ff5709 | 2010-11-02 17:22:24 +0000 | [diff] [blame] | 70 | /// EmitSLEB128Value - Special case of EmitSLEB128Value that avoids the |
| 71 | /// client having to pass in a MCExpr for constant integers. |
| 72 | void MCStreamer::EmitSLEB128IntValue(int64_t Value, unsigned AddrSpace) { |
Rafael Espindola | 660b5fc | 2010-12-03 01:19:49 +0000 | [diff] [blame] | 73 | SmallString<32> Tmp; |
| 74 | raw_svector_ostream OSE(Tmp); |
| 75 | MCObjectWriter::EncodeSLEB128(Value, OSE); |
| 76 | EmitBytes(OSE.str(), AddrSpace); |
Kevin Enderby | c095793 | 2010-09-30 16:52:03 +0000 | [diff] [blame] | 77 | } |
| 78 | |
Rafael Espindola | 0bbe0b4 | 2010-12-06 17:27:56 +0000 | [diff] [blame] | 79 | void MCStreamer::EmitAbsValue(const MCExpr *Value, unsigned Size, |
| 80 | unsigned AddrSpace) { |
Rafael Espindola | 90a5a0c | 2010-12-22 21:51:29 +0000 | [diff] [blame] | 81 | if (getContext().getAsmInfo().hasAggressiveSymbolFolding()) { |
Rafael Espindola | 0bbe0b4 | 2010-12-06 17:27:56 +0000 | [diff] [blame] | 82 | EmitValue(Value, Size, AddrSpace); |
| 83 | return; |
| 84 | } |
| 85 | MCSymbol *ABS = getContext().CreateTempSymbol(); |
| 86 | EmitAssignment(ABS, Value); |
| 87 | EmitSymbolValue(ABS, Size, AddrSpace); |
| 88 | } |
| 89 | |
Rafael Espindola | 89b9372 | 2010-12-10 07:39:47 +0000 | [diff] [blame] | 90 | |
| 91 | void MCStreamer::EmitValue(const MCExpr *Value, unsigned Size, |
| 92 | unsigned AddrSpace) { |
| 93 | EmitValueImpl(Value, Size, false, AddrSpace); |
| 94 | } |
| 95 | |
| 96 | void MCStreamer::EmitPCRelValue(const MCExpr *Value, unsigned Size, |
| 97 | unsigned AddrSpace) { |
| 98 | EmitValueImpl(Value, Size, true, AddrSpace); |
| 99 | } |
| 100 | |
| 101 | void MCStreamer::EmitSymbolValue(const MCSymbol *Sym, unsigned Size, |
| 102 | bool isPCRel, unsigned AddrSpace) { |
| 103 | EmitValueImpl(MCSymbolRefExpr::Create(Sym, getContext()), Size, isPCRel, |
| 104 | AddrSpace); |
| 105 | } |
| 106 | |
Chris Lattner | 6cde3e6 | 2010-03-09 00:39:24 +0000 | [diff] [blame] | 107 | void MCStreamer::EmitSymbolValue(const MCSymbol *Sym, unsigned Size, |
| 108 | unsigned AddrSpace) { |
Rafael Espindola | 89b9372 | 2010-12-10 07:39:47 +0000 | [diff] [blame] | 109 | EmitSymbolValue(Sym, Size, false, AddrSpace); |
| 110 | } |
| 111 | |
| 112 | void MCStreamer::EmitPCRelSymbolValue(const MCSymbol *Sym, unsigned Size, |
| 113 | unsigned AddrSpace) { |
| 114 | EmitSymbolValue(Sym, Size, true, AddrSpace); |
Chris Lattner | 6cde3e6 | 2010-03-09 00:39:24 +0000 | [diff] [blame] | 115 | } |
| 116 | |
Rafael Espindola | 3e03211 | 2010-11-28 15:09:24 +0000 | [diff] [blame] | 117 | void MCStreamer::EmitGPRel32Value(const MCExpr *Value) { |
| 118 | report_fatal_error("unsupported directive in streamer"); |
| 119 | } |
| 120 | |
Chris Lattner | ddf6bdd | 2010-01-19 18:45:47 +0000 | [diff] [blame] | 121 | /// EmitFill - Emit NumBytes bytes worth of the value specified by |
| 122 | /// FillValue. This implements directives such as '.space'. |
Chris Lattner | aaec205 | 2010-01-19 19:46:13 +0000 | [diff] [blame] | 123 | void MCStreamer::EmitFill(uint64_t NumBytes, uint8_t FillValue, |
| 124 | unsigned AddrSpace) { |
Chris Lattner | ddf6bdd | 2010-01-19 18:45:47 +0000 | [diff] [blame] | 125 | const MCExpr *E = MCConstantExpr::Create(FillValue, getContext()); |
| 126 | for (uint64_t i = 0, e = NumBytes; i != e; ++i) |
Chris Lattner | aaec205 | 2010-01-19 19:46:13 +0000 | [diff] [blame] | 127 | EmitValue(E, 1, AddrSpace); |
Chris Lattner | ddf6bdd | 2010-01-19 18:45:47 +0000 | [diff] [blame] | 128 | } |
Chris Lattner | 91bead7 | 2010-04-03 21:35:55 +0000 | [diff] [blame] | 129 | |
Rafael Espindola | af6b5808 | 2010-11-16 21:20:32 +0000 | [diff] [blame] | 130 | bool MCStreamer::EmitDwarfFileDirective(unsigned FileNo, |
| 131 | StringRef Filename) { |
| 132 | return getContext().GetDwarfFile(Filename, FileNo) == 0; |
| 133 | } |
| 134 | |
| 135 | void MCStreamer::EmitDwarfLocDirective(unsigned FileNo, unsigned Line, |
| 136 | unsigned Column, unsigned Flags, |
| 137 | unsigned Isa, |
Devang Patel | 3f3bf93 | 2011-04-18 20:26:49 +0000 | [diff] [blame] | 138 | unsigned Discriminator, |
| 139 | StringRef FileName) { |
Rafael Espindola | af6b5808 | 2010-11-16 21:20:32 +0000 | [diff] [blame] | 140 | getContext().setCurrentDwarfLoc(FileNo, Line, Column, Flags, Isa, |
| 141 | Discriminator); |
| 142 | } |
| 143 | |
Rafael Espindola | 89b9372 | 2010-12-10 07:39:47 +0000 | [diff] [blame] | 144 | MCDwarfFrameInfo *MCStreamer::getCurrentFrameInfo() { |
| 145 | if (FrameInfos.empty()) |
| 146 | return NULL; |
| 147 | return &FrameInfos.back(); |
| 148 | } |
| 149 | |
| 150 | void MCStreamer::EnsureValidFrame() { |
| 151 | MCDwarfFrameInfo *CurFrame = getCurrentFrameInfo(); |
| 152 | if (!CurFrame || CurFrame->End) |
| 153 | report_fatal_error("No open frame"); |
| 154 | } |
| 155 | |
Rafael Espindola | 066c2f4 | 2011-04-12 23:59:07 +0000 | [diff] [blame] | 156 | void MCStreamer::EmitCFIStartProc() { |
Rafael Espindola | 89b9372 | 2010-12-10 07:39:47 +0000 | [diff] [blame] | 157 | MCDwarfFrameInfo *CurFrame = getCurrentFrameInfo(); |
Rafael Espindola | 066c2f4 | 2011-04-12 23:59:07 +0000 | [diff] [blame] | 158 | if (CurFrame && !CurFrame->End) |
Rafael Espindola | 89b9372 | 2010-12-10 07:39:47 +0000 | [diff] [blame] | 159 | report_fatal_error("Starting a frame before finishing the previous one!"); |
Rafael Espindola | 5bba084 | 2010-12-28 04:15:37 +0000 | [diff] [blame] | 160 | MCDwarfFrameInfo Frame; |
Rafael Espindola | 89b9372 | 2010-12-10 07:39:47 +0000 | [diff] [blame] | 161 | Frame.Begin = getContext().CreateTempSymbol(); |
| 162 | EmitLabel(Frame.Begin); |
| 163 | FrameInfos.push_back(Frame); |
Rafael Espindola | cdfecc8 | 2010-11-22 14:27:24 +0000 | [diff] [blame] | 164 | } |
| 165 | |
Rafael Espindola | 066c2f4 | 2011-04-12 23:59:07 +0000 | [diff] [blame] | 166 | void MCStreamer::EmitCFIEndProc() { |
Rafael Espindola | 89b9372 | 2010-12-10 07:39:47 +0000 | [diff] [blame] | 167 | EnsureValidFrame(); |
| 168 | MCDwarfFrameInfo *CurFrame = getCurrentFrameInfo(); |
| 169 | CurFrame->End = getContext().CreateTempSymbol(); |
| 170 | EmitLabel(CurFrame->End); |
Rafael Espindola | cdfecc8 | 2010-11-22 14:27:24 +0000 | [diff] [blame] | 171 | } |
| 172 | |
Rafael Espindola | 066c2f4 | 2011-04-12 23:59:07 +0000 | [diff] [blame] | 173 | void MCStreamer::EmitCFIDefCfa(int64_t Register, int64_t Offset) { |
Rafael Espindola | b40a71f | 2010-12-29 01:42:56 +0000 | [diff] [blame] | 174 | EnsureValidFrame(); |
| 175 | MCDwarfFrameInfo *CurFrame = getCurrentFrameInfo(); |
| 176 | MCSymbol *Label = getContext().CreateTempSymbol(); |
| 177 | EmitLabel(Label); |
| 178 | MachineLocation Dest(MachineLocation::VirtualFP); |
| 179 | MachineLocation Source(Register, -Offset); |
| 180 | MCCFIInstruction Instruction(Label, Dest, Source); |
| 181 | CurFrame->Instructions.push_back(Instruction); |
Rafael Espindola | b40a71f | 2010-12-29 01:42:56 +0000 | [diff] [blame] | 182 | } |
| 183 | |
Rafael Espindola | 066c2f4 | 2011-04-12 23:59:07 +0000 | [diff] [blame] | 184 | void MCStreamer::EmitCFIDefCfaOffset(int64_t Offset) { |
Rafael Espindola | 89b9372 | 2010-12-10 07:39:47 +0000 | [diff] [blame] | 185 | EnsureValidFrame(); |
Rafael Espindola | 5bba084 | 2010-12-28 04:15:37 +0000 | [diff] [blame] | 186 | MCDwarfFrameInfo *CurFrame = getCurrentFrameInfo(); |
| 187 | MCSymbol *Label = getContext().CreateTempSymbol(); |
| 188 | EmitLabel(Label); |
| 189 | MachineLocation Dest(MachineLocation::VirtualFP); |
| 190 | MachineLocation Source(MachineLocation::VirtualFP, -Offset); |
Rafael Espindola | fe024d0 | 2010-12-28 18:36:23 +0000 | [diff] [blame] | 191 | MCCFIInstruction Instruction(Label, Dest, Source); |
| 192 | CurFrame->Instructions.push_back(Instruction); |
Rafael Espindola | cdfecc8 | 2010-11-22 14:27:24 +0000 | [diff] [blame] | 193 | } |
| 194 | |
Rafael Espindola | 5d7dcd3 | 2011-04-12 18:53:30 +0000 | [diff] [blame] | 195 | void MCStreamer::EmitCFIAdjustCfaOffset(int64_t Adjustment) { |
| 196 | EnsureValidFrame(); |
| 197 | MCDwarfFrameInfo *CurFrame = getCurrentFrameInfo(); |
| 198 | MCSymbol *Label = getContext().CreateTempSymbol(); |
| 199 | EmitLabel(Label); |
| 200 | MachineLocation Dest(MachineLocation::VirtualFP); |
| 201 | MachineLocation Source(MachineLocation::VirtualFP, Adjustment); |
| 202 | MCCFIInstruction Instruction(MCCFIInstruction::RelMove, Label, Dest, Source); |
| 203 | CurFrame->Instructions.push_back(Instruction); |
| 204 | } |
| 205 | |
Rafael Espindola | 066c2f4 | 2011-04-12 23:59:07 +0000 | [diff] [blame] | 206 | void MCStreamer::EmitCFIDefCfaRegister(int64_t Register) { |
Rafael Espindola | 89b9372 | 2010-12-10 07:39:47 +0000 | [diff] [blame] | 207 | EnsureValidFrame(); |
Rafael Espindola | b4601bd | 2010-12-29 00:26:06 +0000 | [diff] [blame] | 208 | MCDwarfFrameInfo *CurFrame = getCurrentFrameInfo(); |
| 209 | MCSymbol *Label = getContext().CreateTempSymbol(); |
| 210 | EmitLabel(Label); |
| 211 | MachineLocation Dest(Register); |
| 212 | MachineLocation Source(MachineLocation::VirtualFP); |
| 213 | MCCFIInstruction Instruction(Label, Dest, Source); |
| 214 | CurFrame->Instructions.push_back(Instruction); |
Rafael Espindola | cdfecc8 | 2010-11-22 14:27:24 +0000 | [diff] [blame] | 215 | } |
| 216 | |
Rafael Espindola | 066c2f4 | 2011-04-12 23:59:07 +0000 | [diff] [blame] | 217 | void MCStreamer::EmitCFIOffset(int64_t Register, int64_t Offset) { |
Rafael Espindola | 89b9372 | 2010-12-10 07:39:47 +0000 | [diff] [blame] | 218 | EnsureValidFrame(); |
Rafael Espindola | b790a17 | 2010-12-29 00:09:59 +0000 | [diff] [blame] | 219 | MCDwarfFrameInfo *CurFrame = getCurrentFrameInfo(); |
| 220 | MCSymbol *Label = getContext().CreateTempSymbol(); |
| 221 | EmitLabel(Label); |
| 222 | MachineLocation Dest(Register, Offset); |
| 223 | MachineLocation Source(Register, Offset); |
| 224 | MCCFIInstruction Instruction(Label, Dest, Source); |
| 225 | CurFrame->Instructions.push_back(Instruction); |
Rafael Espindola | cdfecc8 | 2010-11-22 14:27:24 +0000 | [diff] [blame] | 226 | } |
| 227 | |
Rafael Espindola | 25f492e | 2011-04-12 16:12:03 +0000 | [diff] [blame] | 228 | void MCStreamer::EmitCFIRelOffset(int64_t Register, int64_t Offset) { |
| 229 | EnsureValidFrame(); |
| 230 | MCDwarfFrameInfo *CurFrame = getCurrentFrameInfo(); |
| 231 | MCSymbol *Label = getContext().CreateTempSymbol(); |
| 232 | EmitLabel(Label); |
| 233 | MachineLocation Dest(Register, Offset); |
| 234 | MachineLocation Source(Register, Offset); |
| 235 | MCCFIInstruction Instruction(MCCFIInstruction::RelMove, Label, Dest, Source); |
| 236 | CurFrame->Instructions.push_back(Instruction); |
| 237 | } |
| 238 | |
Rafael Espindola | 066c2f4 | 2011-04-12 23:59:07 +0000 | [diff] [blame] | 239 | void MCStreamer::EmitCFIPersonality(const MCSymbol *Sym, |
Rafael Espindola | 3a83c40 | 2010-12-27 00:36:05 +0000 | [diff] [blame] | 240 | unsigned Encoding) { |
Rafael Espindola | 89b9372 | 2010-12-10 07:39:47 +0000 | [diff] [blame] | 241 | EnsureValidFrame(); |
| 242 | MCDwarfFrameInfo *CurFrame = getCurrentFrameInfo(); |
| 243 | CurFrame->Personality = Sym; |
Rafael Espindola | 3a83c40 | 2010-12-27 00:36:05 +0000 | [diff] [blame] | 244 | CurFrame->PersonalityEncoding = Encoding; |
Rafael Espindola | cdfecc8 | 2010-11-22 14:27:24 +0000 | [diff] [blame] | 245 | } |
| 246 | |
Rafael Espindola | 066c2f4 | 2011-04-12 23:59:07 +0000 | [diff] [blame] | 247 | void MCStreamer::EmitCFILsda(const MCSymbol *Sym, unsigned Encoding) { |
Rafael Espindola | 89b9372 | 2010-12-10 07:39:47 +0000 | [diff] [blame] | 248 | EnsureValidFrame(); |
| 249 | MCDwarfFrameInfo *CurFrame = getCurrentFrameInfo(); |
| 250 | CurFrame->Lsda = Sym; |
Rafael Espindola | bdc3167 | 2010-12-27 15:56:22 +0000 | [diff] [blame] | 251 | CurFrame->LsdaEncoding = Encoding; |
Rafael Espindola | cdfecc8 | 2010-11-22 14:27:24 +0000 | [diff] [blame] | 252 | } |
| 253 | |
Rafael Espindola | 066c2f4 | 2011-04-12 23:59:07 +0000 | [diff] [blame] | 254 | void MCStreamer::EmitCFIRememberState() { |
Rafael Espindola | fe024d0 | 2010-12-28 18:36:23 +0000 | [diff] [blame] | 255 | EnsureValidFrame(); |
| 256 | MCDwarfFrameInfo *CurFrame = getCurrentFrameInfo(); |
| 257 | MCSymbol *Label = getContext().CreateTempSymbol(); |
| 258 | EmitLabel(Label); |
| 259 | MCCFIInstruction Instruction(MCCFIInstruction::Remember, Label); |
| 260 | CurFrame->Instructions.push_back(Instruction); |
Rafael Espindola | fe024d0 | 2010-12-28 18:36:23 +0000 | [diff] [blame] | 261 | } |
| 262 | |
Rafael Espindola | 066c2f4 | 2011-04-12 23:59:07 +0000 | [diff] [blame] | 263 | void MCStreamer::EmitCFIRestoreState() { |
Rafael Espindola | fe024d0 | 2010-12-28 18:36:23 +0000 | [diff] [blame] | 264 | // FIXME: Error if there is no matching cfi_remember_state. |
| 265 | EnsureValidFrame(); |
| 266 | MCDwarfFrameInfo *CurFrame = getCurrentFrameInfo(); |
| 267 | MCSymbol *Label = getContext().CreateTempSymbol(); |
| 268 | EmitLabel(Label); |
| 269 | MCCFIInstruction Instruction(MCCFIInstruction::Restore, Label); |
| 270 | CurFrame->Instructions.push_back(Instruction); |
Rafael Espindola | fe024d0 | 2010-12-28 18:36:23 +0000 | [diff] [blame] | 271 | } |
| 272 | |
Rafael Espindola | c575439 | 2011-04-12 15:31:05 +0000 | [diff] [blame] | 273 | void MCStreamer::EmitCFISameValue(int64_t Register) { |
| 274 | EnsureValidFrame(); |
| 275 | MCDwarfFrameInfo *CurFrame = getCurrentFrameInfo(); |
| 276 | MCSymbol *Label = getContext().CreateTempSymbol(); |
| 277 | EmitLabel(Label); |
| 278 | MCCFIInstruction Instruction(MCCFIInstruction::SameValue, Label, Register); |
| 279 | CurFrame->Instructions.push_back(Instruction); |
| 280 | } |
| 281 | |
Anton Korobeynikov | b5e16af | 2011-03-05 18:43:15 +0000 | [diff] [blame] | 282 | void MCStreamer::EmitFnStart() { |
| 283 | errs() << "Not implemented yet\n"; |
| 284 | abort(); |
| 285 | } |
| 286 | |
| 287 | void MCStreamer::EmitFnEnd() { |
| 288 | errs() << "Not implemented yet\n"; |
| 289 | abort(); |
| 290 | } |
| 291 | |
| 292 | void MCStreamer::EmitCantUnwind() { |
| 293 | errs() << "Not implemented yet\n"; |
| 294 | abort(); |
| 295 | } |
| 296 | |
| 297 | void MCStreamer::EmitHandlerData() { |
| 298 | errs() << "Not implemented yet\n"; |
| 299 | abort(); |
| 300 | } |
| 301 | |
| 302 | void MCStreamer::EmitPersonality(const MCSymbol *Personality) { |
| 303 | errs() << "Not implemented yet\n"; |
| 304 | abort(); |
| 305 | } |
| 306 | |
Anton Korobeynikov | 57caad7 | 2011-03-05 18:43:32 +0000 | [diff] [blame] | 307 | void MCStreamer::EmitSetFP(unsigned FpReg, unsigned SpReg, int64_t Offset) { |
| 308 | errs() << "Not implemented yet\n"; |
| 309 | abort(); |
| 310 | } |
| 311 | |
| 312 | void MCStreamer::EmitPad(int64_t Offset) { |
| 313 | errs() << "Not implemented yet\n"; |
| 314 | abort(); |
| 315 | } |
| 316 | |
| 317 | void MCStreamer::EmitRegSave(const SmallVectorImpl<unsigned> &RegList, bool) { |
| 318 | errs() << "Not implemented yet\n"; |
| 319 | abort(); |
| 320 | } |
| 321 | |
Matt Fleming | ab3b365 | 2010-05-20 19:45:09 +0000 | [diff] [blame] | 322 | /// EmitRawText - If this file is backed by an assembly streamer, this dumps |
Chris Lattner | 91bead7 | 2010-04-03 21:35:55 +0000 | [diff] [blame] | 323 | /// the specified string in the output .s file. This capability is |
| 324 | /// indicated by the hasRawTextSupport() predicate. |
| 325 | void MCStreamer::EmitRawText(StringRef String) { |
| 326 | errs() << "EmitRawText called on an MCStreamer that doesn't support it, " |
| 327 | " something must not be fully mc'ized\n"; |
| 328 | abort(); |
| 329 | } |
Chris Lattner | 58bc4dd | 2010-04-03 22:12:35 +0000 | [diff] [blame] | 330 | |
| 331 | void MCStreamer::EmitRawText(const Twine &T) { |
| 332 | SmallString<128> Str; |
| 333 | T.toVector(Str); |
| 334 | EmitRawText(Str.str()); |
| 335 | } |