Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(125)

Delta Between Two Patch Sets: lib/ExecutionEngine/JIT/JITDwarfEmitter.cpp

Issue 91042: Implement LLVM JIT side of GDB JIT debugging interface (Closed) SVN Base: http://llvm.org/svn/llvm-project/llvm/trunk/
Left Patch Set: Move the object files off disk and into memory. Created 3 months, 2 weeks ago
Right Patch Set: Synced with TOT. Created 2 months, 2 weeks ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
LEFTRIGHT
1 //===----- JITDwarfEmitter.cpp - Write dwarf tables into memory -----------===// 1 //===----- JITDwarfEmitter.cpp - Write dwarf tables into memory -----------===//
2 // 2 //
3 // The LLVM Compiler Infrastructure 3 // The LLVM Compiler Infrastructure
4 // 4 //
5 // This file is distributed under the University of Illinois Open Source 5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details. 6 // License. See LICENSE.TXT for details.
7 // 7 //
8 //===----------------------------------------------------------------------===// 8 //===----------------------------------------------------------------------===//
9 // 9 //
10 // This file defines a JITDwarfEmitter object that is used by the JIT to 10 // This file defines a JITDwarfEmitter object that is used by the JIT to
11 // write dwarf tables to memory. 11 // write dwarf tables to memory.
12 // 12 //
13 //===----------------------------------------------------------------------===// 13 //===----------------------------------------------------------------------===//
14 14
15 #include "JIT.h" 15 #include "JIT.h"
16 #include "JITDwarfEmitter.h" 16 #include "JITDwarfEmitter.h"
17 #include "llvm/Function.h" 17 #include "llvm/Function.h"
18 #include "llvm/ADT/DenseMap.h" 18 #include "llvm/ADT/DenseMap.h"
19 #include "llvm/CodeGen/JITCodeEmitter.h" 19 #include "llvm/CodeGen/JITCodeEmitter.h"
20 #include "llvm/CodeGen/MachineFunction.h" 20 #include "llvm/CodeGen/MachineFunction.h"
21 #include "llvm/CodeGen/MachineLocation.h" 21 #include "llvm/CodeGen/MachineLocation.h"
22 #include "llvm/CodeGen/MachineModuleInfo.h" 22 #include "llvm/CodeGen/MachineModuleInfo.h"
23 #include "llvm/ExecutionEngine/JITMemoryManager.h" 23 #include "llvm/ExecutionEngine/JITMemoryManager.h"
24 #include "llvm/Support/ErrorHandling.h" 24 #include "llvm/Support/ErrorHandling.h"
25 #include "llvm/Target/TargetAsmInfo.h" 25 #include "llvm/MC/MCAsmInfo.h"
26 #include "llvm/Target/TargetData.h" 26 #include "llvm/Target/TargetData.h"
27 #include "llvm/Target/TargetInstrInfo.h" 27 #include "llvm/Target/TargetInstrInfo.h"
28 #include "llvm/Target/TargetFrameInfo.h" 28 #include "llvm/Target/TargetFrameInfo.h"
29 #include "llvm/Target/TargetMachine.h" 29 #include "llvm/Target/TargetMachine.h"
30 #include "llvm/Target/TargetRegisterInfo.h" 30 #include "llvm/Target/TargetRegisterInfo.h"
31
32 using namespace llvm; 31 using namespace llvm;
33 32
34 JITDwarfEmitter::JITDwarfEmitter(JIT& theJit) : Jit(theJit) {} 33 JITDwarfEmitter::JITDwarfEmitter(JIT& theJit) : Jit(theJit) {}
35 34
36 35
37 unsigned char* JITDwarfEmitter::EmitDwarfTable(MachineFunction& F, 36 unsigned char* JITDwarfEmitter::EmitDwarfTable(MachineFunction& F,
38 JITCodeEmitter& jce, 37 JITCodeEmitter& jce,
39 unsigned char* StartFunction, 38 unsigned char* StartFunction,
40 unsigned char* EndFunction, 39 unsigned char* EndFunction,
41 unsigned char* &EHFramePtr) { 40 unsigned char* &EHFramePtr) {
42 const TargetMachine& TM = F.getTarget(); 41 const TargetMachine& TM = F.getTarget();
43 TD = TM.getTargetData(); 42 TD = TM.getTargetData();
44 needsIndirectEncoding = TM.getTargetAsmInfo()->getNeedsIndirectEncoding();
45 stackGrowthDirection = TM.getFrameInfo()->getStackGrowthDirection(); 43 stackGrowthDirection = TM.getFrameInfo()->getStackGrowthDirection();
46 RI = TM.getRegisterInfo(); 44 RI = TM.getRegisterInfo();
47 JCE = &jce; 45 JCE = &jce;
48 46
49 unsigned char* ExceptionTable = EmitExceptionTable(&F, StartFunction, 47 unsigned char* ExceptionTable = EmitExceptionTable(&F, StartFunction,
50 EndFunction); 48 EndFunction);
51 49
52 unsigned char* Result = 0; 50 unsigned char* Result = 0;
53 51
54 const std::vector<Function *> Personalities = MMI->getPersonalities(); 52 const std::vector<Function *> Personalities = MMI->getPersonalities();
55 EHFramePtr = EmitCommonEHFrame(Personalities[MMI->getPersonalityIndex()]); 53 EHFramePtr = EmitCommonEHFrame(Personalities[MMI->getPersonalityIndex()]);
56 54
57 Result = EmitEHFrame(Personalities[MMI->getPersonalityIndex()], EHFramePtr, 55 Result = EmitEHFrame(Personalities[MMI->getPersonalityIndex()], EHFramePtr,
58 StartFunction, EndFunction, ExceptionTable); 56 StartFunction, EndFunction, ExceptionTable);
59 57
60 return Result; 58 return Result;
61 } 59 }
62 60
63 61
64 void 62 void
65 JITDwarfEmitter::EmitFrameMoves(intptr_t BaseLabelPtr, 63 JITDwarfEmitter::EmitFrameMoves(intptr_t BaseLabelPtr,
66 const std::vector<MachineMove> &Moves) const { 64 const std::vector<MachineMove> &Moves) const {
67 unsigned PointerSize = TD->getPointerSize(); 65 unsigned PointerSize = TD->getPointerSize();
68 int stackGrowth = stackGrowthDirection == TargetFrameInfo::StackGrowsUp ? 66 int stackGrowth = stackGrowthDirection == TargetFrameInfo::StackGrowsUp ?
69 PointerSize : -PointerSize; 67 PointerSize : -PointerSize;
(...skipping 30 matching lines...) Expand all
100 // If advancing cfa. 98 // If advancing cfa.
101 if (Dst.isReg() && Dst.getReg() == MachineLocation::VirtualFP) { 99 if (Dst.isReg() && Dst.getReg() == MachineLocation::VirtualFP) {
102 if (!Src.isReg()) { 100 if (!Src.isReg()) {
103 if (Src.getReg() == MachineLocation::VirtualFP) { 101 if (Src.getReg() == MachineLocation::VirtualFP) {
104 JCE->emitByte(dwarf::DW_CFA_def_cfa_offset); 102 JCE->emitByte(dwarf::DW_CFA_def_cfa_offset);
105 } else { 103 } else {
106 JCE->emitByte(dwarf::DW_CFA_def_cfa); 104 JCE->emitByte(dwarf::DW_CFA_def_cfa);
107 JCE->emitULEB128Bytes(RI->getDwarfRegNum(Src.getReg(), true)); 105 JCE->emitULEB128Bytes(RI->getDwarfRegNum(Src.getReg(), true));
108 } 106 }
109 107
110 int Offset = -Src.getOffset(); 108 JCE->emitULEB128Bytes(-Src.getOffset());
111
112 JCE->emitULEB128Bytes(Offset);
113 } else { 109 } else {
114 llvm_unreachable("Machine move no supported yet."); 110 llvm_unreachable("Machine move not supported yet.");
115 } 111 }
116 } else if (Src.isReg() && 112 } else if (Src.isReg() &&
117 Src.getReg() == MachineLocation::VirtualFP) { 113 Src.getReg() == MachineLocation::VirtualFP) {
118 if (Dst.isReg()) { 114 if (Dst.isReg()) {
119 JCE->emitByte(dwarf::DW_CFA_def_cfa_register); 115 JCE->emitByte(dwarf::DW_CFA_def_cfa_register);
120 JCE->emitULEB128Bytes(RI->getDwarfRegNum(Dst.getReg(), true)); 116 JCE->emitULEB128Bytes(RI->getDwarfRegNum(Dst.getReg(), true));
121 } else { 117 } else {
122 llvm_unreachable("Machine move no supported yet."); 118 llvm_unreachable("Machine move not supported yet.");
123 } 119 }
124 } else { 120 } else {
125 unsigned Reg = RI->getDwarfRegNum(Src.getReg(), true); 121 unsigned Reg = RI->getDwarfRegNum(Src.getReg(), true);
126 int Offset = Dst.getOffset() / stackGrowth; 122 int Offset = Dst.getOffset() / stackGrowth;
127 123
128 if (Offset < 0) { 124 if (Offset < 0) {
129 JCE->emitByte(dwarf::DW_CFA_offset_extended_sf); 125 JCE->emitByte(dwarf::DW_CFA_offset_extended_sf);
130 JCE->emitULEB128Bytes(Reg); 126 JCE->emitULEB128Bytes(Reg);
131 JCE->emitSLEB128Bytes(Offset); 127 JCE->emitSLEB128Bytes(Offset);
132 } else if (Reg < 64) { 128 } else if (Reg < 64) {
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 // entry as long as the value written is not too large, but can differ. 231 // entry as long as the value written is not too large, but can differ.
236 // This kind of complication does not occur for positive type ids because 232 // This kind of complication does not occur for positive type ids because
237 // type infos are output using a fixed width encoding. 233 // type infos are output using a fixed width encoding.
238 // FilterOffsets[i] holds the byte offset corresponding to FilterIds[i]. 234 // FilterOffsets[i] holds the byte offset corresponding to FilterIds[i].
239 SmallVector<int, 16> FilterOffsets; 235 SmallVector<int, 16> FilterOffsets;
240 FilterOffsets.reserve(FilterIds.size()); 236 FilterOffsets.reserve(FilterIds.size());
241 int Offset = -1; 237 int Offset = -1;
242 for(std::vector<unsigned>::const_iterator I = FilterIds.begin(), 238 for(std::vector<unsigned>::const_iterator I = FilterIds.begin(),
243 E = FilterIds.end(); I != E; ++I) { 239 E = FilterIds.end(); I != E; ++I) {
244 FilterOffsets.push_back(Offset); 240 FilterOffsets.push_back(Offset);
245 Offset -= TargetAsmInfo::getULEB128Size(*I); 241 Offset -= MCAsmInfo::getULEB128Size(*I);
246 } 242 }
247 243
248 // Compute the actions table and gather the first action index for each 244 // Compute the actions table and gather the first action index for each
249 // landing pad site. 245 // landing pad site.
250 SmallVector<ActionEntry, 32> Actions; 246 SmallVector<ActionEntry, 32> Actions;
251 SmallVector<unsigned, 64> FirstActions; 247 SmallVector<unsigned, 64> FirstActions;
252 FirstActions.reserve(LandingPads.size()); 248 FirstActions.reserve(LandingPads.size());
253 249
254 int FirstAction = 0; 250 int FirstAction = 0;
255 unsigned SizeActions = 0; 251 unsigned SizeActions = 0;
256 for (unsigned i = 0, N = LandingPads.size(); i != N; ++i) { 252 for (unsigned i = 0, N = LandingPads.size(); i != N; ++i) {
257 const LandingPadInfo *LP = LandingPads[i]; 253 const LandingPadInfo *LP = LandingPads[i];
258 const std::vector<int> &TypeIds = LP->TypeIds; 254 const std::vector<int> &TypeIds = LP->TypeIds;
259 const unsigned NumShared = i ? SharedTypeIds(LP, LandingPads[i-1]) : 0; 255 const unsigned NumShared = i ? SharedTypeIds(LP, LandingPads[i-1]) : 0;
260 unsigned SizeSiteActions = 0; 256 unsigned SizeSiteActions = 0;
261 257
262 if (NumShared < TypeIds.size()) { 258 if (NumShared < TypeIds.size()) {
263 unsigned SizeAction = 0; 259 unsigned SizeAction = 0;
264 ActionEntry *PrevAction = 0; 260 ActionEntry *PrevAction = 0;
265 261
266 if (NumShared) { 262 if (NumShared) {
267 const unsigned SizePrevIds = LandingPads[i-1]->TypeIds.size(); 263 const unsigned SizePrevIds = LandingPads[i-1]->TypeIds.size();
268 assert(Actions.size()); 264 assert(Actions.size());
269 PrevAction = &Actions.back(); 265 PrevAction = &Actions.back();
270 SizeAction = TargetAsmInfo::getSLEB128Size(PrevAction->NextAction) + 266 SizeAction = MCAsmInfo::getSLEB128Size(PrevAction->NextAction) +
271 TargetAsmInfo::getSLEB128Size(PrevAction->ValueForTypeID); 267 MCAsmInfo::getSLEB128Size(PrevAction->ValueForTypeID);
272 for (unsigned j = NumShared; j != SizePrevIds; ++j) { 268 for (unsigned j = NumShared; j != SizePrevIds; ++j) {
273 SizeAction -= TargetAsmInfo::getSLEB128Size(PrevAction->ValueForTypeID ); 269 SizeAction -= MCAsmInfo::getSLEB128Size(PrevAction->ValueForTypeID);
274 SizeAction += -PrevAction->NextAction; 270 SizeAction += -PrevAction->NextAction;
275 PrevAction = PrevAction->Previous; 271 PrevAction = PrevAction->Previous;
276 } 272 }
277 } 273 }
278 274
279 // Compute the actions. 275 // Compute the actions.
280 for (unsigned I = NumShared, M = TypeIds.size(); I != M; ++I) { 276 for (unsigned I = NumShared, M = TypeIds.size(); I != M; ++I) {
281 int TypeID = TypeIds[I]; 277 int TypeID = TypeIds[I];
282 assert(-1-TypeID < (int)FilterOffsets.size() && "Unknown filter id!"); 278 assert(-1-TypeID < (int)FilterOffsets.size() && "Unknown filter id!");
283 int ValueForTypeID = TypeID < 0 ? FilterOffsets[-1 - TypeID] : TypeID; 279 int ValueForTypeID = TypeID < 0 ? FilterOffsets[-1 - TypeID] : TypeID;
284 unsigned SizeTypeID = TargetAsmInfo::getSLEB128Size(ValueForTypeID); 280 unsigned SizeTypeID = MCAsmInfo::getSLEB128Size(ValueForTypeID);
285 281
286 int NextAction = SizeAction ? -(SizeAction + SizeTypeID) : 0; 282 int NextAction = SizeAction ? -(SizeAction + SizeTypeID) : 0;
287 SizeAction = SizeTypeID + TargetAsmInfo::getSLEB128Size(NextAction); 283 SizeAction = SizeTypeID + MCAsmInfo::getSLEB128Size(NextAction);
288 SizeSiteActions += SizeAction; 284 SizeSiteActions += SizeAction;
289 285
290 ActionEntry Action = {ValueForTypeID, NextAction, PrevAction}; 286 ActionEntry Action = {ValueForTypeID, NextAction, PrevAction};
291 Actions.push_back(Action); 287 Actions.push_back(Action);
292 288
293 PrevAction = &Actions.back(); 289 PrevAction = &Actions.back();
294 } 290 }
295 291
296 // Record the first action of the landing pad site. 292 // Record the first action of the landing pad site.
297 FirstAction = SizeActions + SizeSiteActions - SizeAction + 1; 293 FirstAction = SizeActions + SizeSiteActions - SizeAction + 1;
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
380 if (MayThrow) { 376 if (MayThrow) {
381 CallSiteEntry Site = {LastLabel, 0, 0, 0}; 377 CallSiteEntry Site = {LastLabel, 0, 0, 0};
382 CallSites.push_back(Site); 378 CallSites.push_back(Site);
383 } 379 }
384 380
385 // Final tallies. 381 // Final tallies.
386 unsigned SizeSites = CallSites.size() * (sizeof(int32_t) + // Site start. 382 unsigned SizeSites = CallSites.size() * (sizeof(int32_t) + // Site start.
387 sizeof(int32_t) + // Site length. 383 sizeof(int32_t) + // Site length.
388 sizeof(int32_t)); // Landing pad. 384 sizeof(int32_t)); // Landing pad.
389 for (unsigned i = 0, e = CallSites.size(); i < e; ++i) 385 for (unsigned i = 0, e = CallSites.size(); i < e; ++i)
390 SizeSites += TargetAsmInfo::getULEB128Size(CallSites[i].Action); 386 SizeSites += MCAsmInfo::getULEB128Size(CallSites[i].Action);
391 387
392 unsigned SizeTypes = TypeInfos.size() * TD->getPointerSize(); 388 unsigned SizeTypes = TypeInfos.size() * TD->getPointerSize();
393 389
394 unsigned TypeOffset = sizeof(int8_t) + // Call site format 390 unsigned TypeOffset = sizeof(int8_t) + // Call site format
395 // Call-site table length 391 // Call-site table length
396 TargetAsmInfo::getULEB128Size(SizeSites) + 392 MCAsmInfo::getULEB128Size(SizeSites) +
397 SizeSites + SizeActions + SizeTypes; 393 SizeSites + SizeActions + SizeTypes;
398 394
399 // Begin the exception table. 395 // Begin the exception table.
400 JCE->emitAlignmentWithFill(4, 0); 396 JCE->emitAlignmentWithFill(4, 0);
401 // Asm->EOL("Padding"); 397 // Asm->EOL("Padding");
402 398
403 unsigned char* DwarfExceptionTable = (unsigned char*)JCE->getCurrentPCValue(); 399 unsigned char* DwarfExceptionTable = (unsigned char*)JCE->getCurrentPCValue();
404 400
405 // Emit the header. 401 // Emit the header.
406 JCE->emitByte(dwarf::DW_EH_PE_omit); 402 JCE->emitByte(dwarf::DW_EH_PE_omit);
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
459 //Asm->EOL("TypeInfo index"); 455 //Asm->EOL("TypeInfo index");
460 JCE->emitSLEB128Bytes(Action.NextAction); 456 JCE->emitSLEB128Bytes(Action.NextAction);
461 //Asm->EOL("Next action"); 457 //Asm->EOL("Next action");
462 } 458 }
463 459
464 // Emit the type ids. 460 // Emit the type ids.
465 for (unsigned M = TypeInfos.size(); M; --M) { 461 for (unsigned M = TypeInfos.size(); M; --M) {
466 GlobalVariable *GV = TypeInfos[M - 1]; 462 GlobalVariable *GV = TypeInfos[M - 1];
467 463
468 if (GV) { 464 if (GV) {
469 if (TD->getPointerSize() == sizeof(int32_t)) { 465 if (TD->getPointerSize() == sizeof(int32_t))
470 JCE->emitInt32((intptr_t)Jit.getOrEmitGlobalVariable(GV)); 466 JCE->emitInt32((intptr_t)Jit.getOrEmitGlobalVariable(GV));
471 } else { 467 else
472 JCE->emitInt64((intptr_t)Jit.getOrEmitGlobalVariable(GV)); 468 JCE->emitInt64((intptr_t)Jit.getOrEmitGlobalVariable(GV));
473 }
474 } else { 469 } else {
475 if (TD->getPointerSize() == sizeof(int32_t)) 470 if (TD->getPointerSize() == sizeof(int32_t))
476 JCE->emitInt32(0); 471 JCE->emitInt32(0);
477 else 472 else
478 JCE->emitInt64(0); 473 JCE->emitInt64(0);
479 } 474 }
480 // Asm->EOL("TypeInfo"); 475 // Asm->EOL("TypeInfo");
481 } 476 }
482 477
483 // Emit the filter typeids. 478 // Emit the filter typeids.
(...skipping 17 matching lines...) Expand all
501 unsigned char* StartCommonPtr = (unsigned char*)JCE->getCurrentPCValue(); 496 unsigned char* StartCommonPtr = (unsigned char*)JCE->getCurrentPCValue();
502 // EH Common Frame header 497 // EH Common Frame header
503 JCE->allocateSpace(4, 0); 498 JCE->allocateSpace(4, 0);
504 unsigned char* FrameCommonBeginPtr = (unsigned char*)JCE->getCurrentPCValue(); 499 unsigned char* FrameCommonBeginPtr = (unsigned char*)JCE->getCurrentPCValue();
505 JCE->emitInt32((int)0); 500 JCE->emitInt32((int)0);
506 JCE->emitByte(dwarf::DW_CIE_VERSION); 501 JCE->emitByte(dwarf::DW_CIE_VERSION);
507 JCE->emitString(Personality ? "zPLR" : "zR"); 502 JCE->emitString(Personality ? "zPLR" : "zR");
508 JCE->emitULEB128Bytes(1); 503 JCE->emitULEB128Bytes(1);
509 JCE->emitSLEB128Bytes(stackGrowth); 504 JCE->emitSLEB128Bytes(stackGrowth);
510 JCE->emitByte(RI->getDwarfRegNum(RI->getRARegister(), true)); 505 JCE->emitByte(RI->getDwarfRegNum(RI->getRARegister(), true));
511 506
512 if (Personality) { 507 if (Personality) {
513 // Augmentation Size: 3 small ULEBs of one byte each, and the personality 508 // Augmentation Size: 3 small ULEBs of one byte each, and the personality
514 // function which size is PointerSize. 509 // function which size is PointerSize.
515 JCE->emitULEB128Bytes(3 + PointerSize); 510 JCE->emitULEB128Bytes(3 + PointerSize);
516 511
517 // We set the encoding of the personality as direct encoding because we use 512 // We set the encoding of the personality as direct encoding because we use
518 // the function pointer. The encoding is not relative because the current 513 // the function pointer. The encoding is not relative because the current
519 // PC value may be bigger than the personality function pointer. 514 // PC value may be bigger than the personality function pointer.
520 if (PointerSize == 4) { 515 if (PointerSize == 4) {
521 JCE->emitByte(dwarf::DW_EH_PE_sdata4); 516 JCE->emitByte(dwarf::DW_EH_PE_sdata4);
522 JCE->emitInt32(((intptr_t)Jit.getPointerToGlobal(Personality))); 517 JCE->emitInt32(((intptr_t)Jit.getPointerToGlobal(Personality)));
523 } else { 518 } else {
524 JCE->emitByte(dwarf::DW_EH_PE_sdata8); 519 JCE->emitByte(dwarf::DW_EH_PE_sdata8);
525 JCE->emitInt64(((intptr_t)Jit.getPointerToGlobal(Personality))); 520 JCE->emitInt64(((intptr_t)Jit.getPointerToGlobal(Personality)));
526 } 521 }
527 522
528 JCE->emitULEB128Bytes(dwarf::DW_EH_PE_pcrel | dwarf::DW_EH_PE_sdata4); 523 JCE->emitULEB128Bytes(dwarf::DW_EH_PE_pcrel | dwarf::DW_EH_PE_sdata4);
529 JCE->emitULEB128Bytes(dwarf::DW_EH_PE_pcrel | dwarf::DW_EH_PE_sdata4); 524 JCE->emitULEB128Bytes(dwarf::DW_EH_PE_pcrel | dwarf::DW_EH_PE_sdata4);
530
531 } else { 525 } else {
532 JCE->emitULEB128Bytes(1); 526 JCE->emitULEB128Bytes(1);
533 JCE->emitULEB128Bytes(dwarf::DW_EH_PE_pcrel | dwarf::DW_EH_PE_sdata4); 527 JCE->emitULEB128Bytes(dwarf::DW_EH_PE_pcrel | dwarf::DW_EH_PE_sdata4);
534 } 528 }
535 529
536 std::vector<MachineMove> Moves; 530 std::vector<MachineMove> Moves;
537 RI->getInitialFrameState(Moves); 531 RI->getInitialFrameState(Moves);
538 EmitFrameMoves(0, Moves); 532 EmitFrameMoves(0, Moves);
539 533
540 JCE->emitAlignmentWithFill(PointerSize, dwarf::DW_CFA_nop); 534 JCE->emitAlignmentWithFill(PointerSize, dwarf::DW_CFA_nop);
(...skipping 18 matching lines...) Expand all
559 unsigned char* StartEHPtr = (unsigned char*)JCE->getCurrentPCValue(); 553 unsigned char* StartEHPtr = (unsigned char*)JCE->getCurrentPCValue();
560 JCE->allocateSpace(4, 0); 554 JCE->allocateSpace(4, 0);
561 unsigned char* FrameBeginPtr = (unsigned char*)JCE->getCurrentPCValue(); 555 unsigned char* FrameBeginPtr = (unsigned char*)JCE->getCurrentPCValue();
562 // FDE CIE Offset 556 // FDE CIE Offset
563 JCE->emitInt32(FrameBeginPtr - StartCommonPtr); 557 JCE->emitInt32(FrameBeginPtr - StartCommonPtr);
564 JCE->emitInt32(StartFunction - (unsigned char*)JCE->getCurrentPCValue()); 558 JCE->emitInt32(StartFunction - (unsigned char*)JCE->getCurrentPCValue());
565 JCE->emitInt32(EndFunction - StartFunction); 559 JCE->emitInt32(EndFunction - StartFunction);
566 560
567 // If there is a personality and landing pads then point to the language 561 // If there is a personality and landing pads then point to the language
568 // specific data area in the exception table. 562 // specific data area in the exception table.
569 if (MMI->getPersonalityIndex()) { 563 if (Personality) {
570 JCE->emitULEB128Bytes(4); 564 JCE->emitULEB128Bytes(PointerSize == 4 ? 4 : 8);
571 565
572 if (!MMI->getLandingPads().empty()) { 566 if (PointerSize == 4) {
573 JCE->emitInt32(ExceptionTable - (unsigned char*)JCE->getCurrentPCValue()); 567 if (!MMI->getLandingPads().empty())
568 JCE->emitInt32(ExceptionTable-(unsigned char*)JCE->getCurrentPCValue());
569 else
570 JCE->emitInt32((int)0);
574 } else { 571 } else {
575 JCE->emitInt32((int)0); 572 if (!MMI->getLandingPads().empty())
573 JCE->emitInt64(ExceptionTable-(unsigned char*)JCE->getCurrentPCValue());
574 else
575 JCE->emitInt64((int)0);
576 } 576 }
577 } else { 577 } else {
578 JCE->emitULEB128Bytes(0); 578 JCE->emitULEB128Bytes(0);
579 } 579 }
580 580
581 // Indicate locations of function specific callee saved registers in 581 // Indicate locations of function specific callee saved registers in
582 // frame. 582 // frame.
583 EmitFrameMoves((intptr_t)StartFunction, MMI->getFrameMoves()); 583 EmitFrameMoves((intptr_t)StartFunction, MMI->getFrameMoves());
584 584
585 JCE->emitAlignmentWithFill(PointerSize, dwarf::DW_CFA_nop); 585 JCE->emitAlignmentWithFill(PointerSize, dwarf::DW_CFA_nop);
(...skipping 14 matching lines...) Expand all
600 600
601 return StartEHPtr; 601 return StartEHPtr;
602 } 602 }
603 603
604 unsigned JITDwarfEmitter::GetDwarfTableSizeInBytes(MachineFunction& F, 604 unsigned JITDwarfEmitter::GetDwarfTableSizeInBytes(MachineFunction& F,
605 JITCodeEmitter& jce, 605 JITCodeEmitter& jce,
606 unsigned char* StartFunction, 606 unsigned char* StartFunction,
607 unsigned char* EndFunction) { 607 unsigned char* EndFunction) {
608 const TargetMachine& TM = F.getTarget(); 608 const TargetMachine& TM = F.getTarget();
609 TD = TM.getTargetData(); 609 TD = TM.getTargetData();
610 needsIndirectEncoding = TM.getTargetAsmInfo()->getNeedsIndirectEncoding();
611 stackGrowthDirection = TM.getFrameInfo()->getStackGrowthDirection(); 610 stackGrowthDirection = TM.getFrameInfo()->getStackGrowthDirection();
612 RI = TM.getRegisterInfo(); 611 RI = TM.getRegisterInfo();
613 JCE = &jce; 612 JCE = &jce;
614 unsigned FinalSize = 0; 613 unsigned FinalSize = 0;
615 614
616 FinalSize += GetExceptionTableSizeInBytes(&F); 615 FinalSize += GetExceptionTableSizeInBytes(&F);
617 616
618 const std::vector<Function *> Personalities = MMI->getPersonalities(); 617 const std::vector<Function *> Personalities = MMI->getPersonalities();
619 FinalSize += 618 FinalSize +=
620 GetCommonEHFrameSizeInBytes(Personalities[MMI->getPersonalityIndex()]); 619 GetCommonEHFrameSizeInBytes(Personalities[MMI->getPersonalityIndex()]);
621 620
622 FinalSize += GetEHFrameSizeInBytes(Personalities[MMI->getPersonalityIndex()], 621 FinalSize += GetEHFrameSizeInBytes(Personalities[MMI->getPersonalityIndex()],
623 StartFunction); 622 StartFunction);
624 623
625 return FinalSize; 624 return FinalSize;
626 } 625 }
627 626
628 /// RoundUpToAlign - Add the specified alignment to FinalSize and returns 627 /// RoundUpToAlign - Add the specified alignment to FinalSize and returns
629 /// the new value. 628 /// the new value.
630 static unsigned RoundUpToAlign(unsigned FinalSize, unsigned Alignment) { 629 static unsigned RoundUpToAlign(unsigned FinalSize, unsigned Alignment) {
631 if (Alignment == 0) Alignment = 1; 630 if (Alignment == 0) Alignment = 1;
632 // Since we do not know where the buffer will be allocated, be pessimistic. 631 // Since we do not know where the buffer will be allocated, be pessimistic.
633 return FinalSize + Alignment; 632 return FinalSize + Alignment;
634 } 633 }
635 634
636 unsigned 635 unsigned
637 JITDwarfEmitter::GetEHFrameSizeInBytes(const Function* Personality, 636 JITDwarfEmitter::GetEHFrameSizeInBytes(const Function* Personality,
638 unsigned char* StartFunction) const { 637 unsigned char* StartFunction) const {
639 unsigned PointerSize = TD->getPointerSize(); 638 unsigned PointerSize = TD->getPointerSize();
640 unsigned FinalSize = 0; 639 unsigned FinalSize = 0;
641 // EH frame header. 640 // EH frame header.
642 FinalSize += PointerSize; 641 FinalSize += PointerSize;
643 // FDE CIE Offset 642 // FDE CIE Offset
644 FinalSize += 3 * PointerSize; 643 FinalSize += 3 * PointerSize;
645 // If there is a personality and landing pads then point to the language 644 // If there is a personality and landing pads then point to the language
646 // specific data area in the exception table. 645 // specific data area in the exception table.
647 if (MMI->getPersonalityIndex()) { 646 if (Personality) {
648 FinalSize += TargetAsmInfo::getULEB128Size(4); 647 FinalSize += MCAsmInfo::getULEB128Size(4);
649 FinalSize += PointerSize; 648 FinalSize += PointerSize;
650 } else { 649 } else {
651 FinalSize += TargetAsmInfo::getULEB128Size(0); 650 FinalSize += MCAsmInfo::getULEB128Size(0);
652 } 651 }
653 652
654 // Indicate locations of function specific callee saved registers in 653 // Indicate locations of function specific callee saved registers in
655 // frame. 654 // frame.
656 FinalSize += GetFrameMovesSizeInBytes((intptr_t)StartFunction, 655 FinalSize += GetFrameMovesSizeInBytes((intptr_t)StartFunction,
657 MMI->getFrameMoves()); 656 MMI->getFrameMoves());
658 657
659 FinalSize = RoundUpToAlign(FinalSize, 4); 658 FinalSize = RoundUpToAlign(FinalSize, 4);
660 659
661 // Double zeroes for the unwind runtime 660 // Double zeroes for the unwind runtime
662 FinalSize += 2 * PointerSize; 661 FinalSize += 2 * PointerSize;
663 662
664 return FinalSize; 663 return FinalSize;
665 } 664 }
666 665
667 unsigned JITDwarfEmitter::GetCommonEHFrameSizeInBytes(const Function* Personalit y) 666 unsigned JITDwarfEmitter::GetCommonEHFrameSizeInBytes(const Function* Personalit y)
668 const { 667 const {
669 668
670 unsigned PointerSize = TD->getPointerSize(); 669 unsigned PointerSize = TD->getPointerSize();
671 int stackGrowth = stackGrowthDirection == TargetFrameInfo::StackGrowsUp ? 670 int stackGrowth = stackGrowthDirection == TargetFrameInfo::StackGrowsUp ?
672 PointerSize : -PointerSize; 671 PointerSize : -PointerSize;
673 unsigned FinalSize = 0; 672 unsigned FinalSize = 0;
674 // EH Common Frame header 673 // EH Common Frame header
675 FinalSize += PointerSize; 674 FinalSize += PointerSize;
676 FinalSize += 4; 675 FinalSize += 4;
677 FinalSize += 1; 676 FinalSize += 1;
678 FinalSize += Personality ? 5 : 3; // "zPLR" or "zR" 677 FinalSize += Personality ? 5 : 3; // "zPLR" or "zR"
679 FinalSize += TargetAsmInfo::getULEB128Size(1); 678 FinalSize += MCAsmInfo::getULEB128Size(1);
680 FinalSize += TargetAsmInfo::getSLEB128Size(stackGrowth); 679 FinalSize += MCAsmInfo::getSLEB128Size(stackGrowth);
681 FinalSize += 1; 680 FinalSize += 1;
682 681
683 if (Personality) { 682 if (Personality) {
684 FinalSize += TargetAsmInfo::getULEB128Size(7); 683 FinalSize += MCAsmInfo::getULEB128Size(7);
685 684
686 // Encoding 685 // Encoding
687 FinalSize+= 1; 686 FinalSize+= 1;
688 //Personality 687 //Personality
689 FinalSize += PointerSize; 688 FinalSize += PointerSize;
690 689
691 FinalSize += TargetAsmInfo::getULEB128Size(dwarf::DW_EH_PE_pcrel); 690 FinalSize += MCAsmInfo::getULEB128Size(dwarf::DW_EH_PE_pcrel);
692 FinalSize += TargetAsmInfo::getULEB128Size(dwarf::DW_EH_PE_pcrel); 691 FinalSize += MCAsmInfo::getULEB128Size(dwarf::DW_EH_PE_pcrel);
693 692
694 } else { 693 } else {
695 FinalSize += TargetAsmInfo::getULEB128Size(1); 694 FinalSize += MCAsmInfo::getULEB128Size(1);
696 FinalSize += TargetAsmInfo::getULEB128Size(dwarf::DW_EH_PE_pcrel); 695 FinalSize += MCAsmInfo::getULEB128Size(dwarf::DW_EH_PE_pcrel);
697 } 696 }
698 697
699 std::vector<MachineMove> Moves; 698 std::vector<MachineMove> Moves;
700 RI->getInitialFrameState(Moves); 699 RI->getInitialFrameState(Moves);
701 FinalSize += GetFrameMovesSizeInBytes(0, Moves); 700 FinalSize += GetFrameMovesSizeInBytes(0, Moves);
702 FinalSize = RoundUpToAlign(FinalSize, 4); 701 FinalSize = RoundUpToAlign(FinalSize, 4);
703 return FinalSize; 702 return FinalSize;
704 } 703 }
705 704
706 unsigned 705 unsigned
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
738 } 737 }
739 738
740 // If advancing cfa. 739 // If advancing cfa.
741 if (Dst.isReg() && Dst.getReg() == MachineLocation::VirtualFP) { 740 if (Dst.isReg() && Dst.getReg() == MachineLocation::VirtualFP) {
742 if (!Src.isReg()) { 741 if (!Src.isReg()) {
743 if (Src.getReg() == MachineLocation::VirtualFP) { 742 if (Src.getReg() == MachineLocation::VirtualFP) {
744 ++FinalSize; 743 ++FinalSize;
745 } else { 744 } else {
746 ++FinalSize; 745 ++FinalSize;
747 unsigned RegNum = RI->getDwarfRegNum(Src.getReg(), true); 746 unsigned RegNum = RI->getDwarfRegNum(Src.getReg(), true);
748 FinalSize += TargetAsmInfo::getULEB128Size(RegNum); 747 FinalSize += MCAsmInfo::getULEB128Size(RegNum);
749 } 748 }
750 749
751 int Offset = -Src.getOffset(); 750 int Offset = -Src.getOffset();
752 751
753 FinalSize += TargetAsmInfo::getULEB128Size(Offset); 752 FinalSize += MCAsmInfo::getULEB128Size(Offset);
754 } else { 753 } else {
755 llvm_unreachable("Machine move no supported yet."); 754 llvm_unreachable("Machine move no supported yet.");
756 } 755 }
757 } else if (Src.isReg() && 756 } else if (Src.isReg() &&
758 Src.getReg() == MachineLocation::VirtualFP) { 757 Src.getReg() == MachineLocation::VirtualFP) {
759 if (Dst.isReg()) { 758 if (Dst.isReg()) {
760 ++FinalSize; 759 ++FinalSize;
761 unsigned RegNum = RI->getDwarfRegNum(Dst.getReg(), true); 760 unsigned RegNum = RI->getDwarfRegNum(Dst.getReg(), true);
762 FinalSize += TargetAsmInfo::getULEB128Size(RegNum); 761 FinalSize += MCAsmInfo::getULEB128Size(RegNum);
763 } else { 762 } else {
764 llvm_unreachable("Machine move no supported yet."); 763 llvm_unreachable("Machine move no supported yet.");
765 } 764 }
766 } else { 765 } else {
767 unsigned Reg = RI->getDwarfRegNum(Src.getReg(), true); 766 unsigned Reg = RI->getDwarfRegNum(Src.getReg(), true);
768 int Offset = Dst.getOffset() / stackGrowth; 767 int Offset = Dst.getOffset() / stackGrowth;
769 768
770 if (Offset < 0) { 769 if (Offset < 0) {
771 ++FinalSize; 770 ++FinalSize;
772 FinalSize += TargetAsmInfo::getULEB128Size(Reg); 771 FinalSize += MCAsmInfo::getULEB128Size(Reg);
773 FinalSize += TargetAsmInfo::getSLEB128Size(Offset); 772 FinalSize += MCAsmInfo::getSLEB128Size(Offset);
774 } else if (Reg < 64) { 773 } else if (Reg < 64) {
775 ++FinalSize; 774 ++FinalSize;
776 FinalSize += TargetAsmInfo::getULEB128Size(Offset); 775 FinalSize += MCAsmInfo::getULEB128Size(Offset);
777 } else { 776 } else {
778 ++FinalSize; 777 ++FinalSize;
779 FinalSize += TargetAsmInfo::getULEB128Size(Reg); 778 FinalSize += MCAsmInfo::getULEB128Size(Reg);
780 FinalSize += TargetAsmInfo::getULEB128Size(Offset); 779 FinalSize += MCAsmInfo::getULEB128Size(Offset);
781 } 780 }
782 } 781 }
783 } 782 }
784 return FinalSize; 783 return FinalSize;
785 } 784 }
786 785
787 unsigned 786 unsigned
788 JITDwarfEmitter::GetExceptionTableSizeInBytes(MachineFunction* MF) const { 787 JITDwarfEmitter::GetExceptionTableSizeInBytes(MachineFunction* MF) const {
789 unsigned FinalSize = 0; 788 unsigned FinalSize = 0;
790 789
(...skipping 22 matching lines...) Expand all
813 // entry as long as the value written is not too large, but can differ. 812 // entry as long as the value written is not too large, but can differ.
814 // This kind of complication does not occur for positive type ids because 813 // This kind of complication does not occur for positive type ids because
815 // type infos are output using a fixed width encoding. 814 // type infos are output using a fixed width encoding.
816 // FilterOffsets[i] holds the byte offset corresponding to FilterIds[i]. 815 // FilterOffsets[i] holds the byte offset corresponding to FilterIds[i].
817 SmallVector<int, 16> FilterOffsets; 816 SmallVector<int, 16> FilterOffsets;
818 FilterOffsets.reserve(FilterIds.size()); 817 FilterOffsets.reserve(FilterIds.size());
819 int Offset = -1; 818 int Offset = -1;
820 for(std::vector<unsigned>::const_iterator I = FilterIds.begin(), 819 for(std::vector<unsigned>::const_iterator I = FilterIds.begin(),
821 E = FilterIds.end(); I != E; ++I) { 820 E = FilterIds.end(); I != E; ++I) {
822 FilterOffsets.push_back(Offset); 821 FilterOffsets.push_back(Offset);
823 Offset -= TargetAsmInfo::getULEB128Size(*I); 822 Offset -= MCAsmInfo::getULEB128Size(*I);
824 } 823 }
825 824
826 // Compute the actions table and gather the first action index for each 825 // Compute the actions table and gather the first action index for each
827 // landing pad site. 826 // landing pad site.
828 SmallVector<ActionEntry, 32> Actions; 827 SmallVector<ActionEntry, 32> Actions;
829 SmallVector<unsigned, 64> FirstActions; 828 SmallVector<unsigned, 64> FirstActions;
830 FirstActions.reserve(LandingPads.size()); 829 FirstActions.reserve(LandingPads.size());
831 830
832 int FirstAction = 0; 831 int FirstAction = 0;
833 unsigned SizeActions = 0; 832 unsigned SizeActions = 0;
834 for (unsigned i = 0, N = LandingPads.size(); i != N; ++i) { 833 for (unsigned i = 0, N = LandingPads.size(); i != N; ++i) {
835 const LandingPadInfo *LP = LandingPads[i]; 834 const LandingPadInfo *LP = LandingPads[i];
836 const std::vector<int> &TypeIds = LP->TypeIds; 835 const std::vector<int> &TypeIds = LP->TypeIds;
837 const unsigned NumShared = i ? SharedTypeIds(LP, LandingPads[i-1]) : 0; 836 const unsigned NumShared = i ? SharedTypeIds(LP, LandingPads[i-1]) : 0;
838 unsigned SizeSiteActions = 0; 837 unsigned SizeSiteActions = 0;
839 838
840 if (NumShared < TypeIds.size()) { 839 if (NumShared < TypeIds.size()) {
841 unsigned SizeAction = 0; 840 unsigned SizeAction = 0;
842 ActionEntry *PrevAction = 0; 841 ActionEntry *PrevAction = 0;
843 842
844 if (NumShared) { 843 if (NumShared) {
845 const unsigned SizePrevIds = LandingPads[i-1]->TypeIds.size(); 844 const unsigned SizePrevIds = LandingPads[i-1]->TypeIds.size();
846 assert(Actions.size()); 845 assert(Actions.size());
847 PrevAction = &Actions.back(); 846 PrevAction = &Actions.back();
848 SizeAction = TargetAsmInfo::getSLEB128Size(PrevAction->NextAction) + 847 SizeAction = MCAsmInfo::getSLEB128Size(PrevAction->NextAction) +
849 TargetAsmInfo::getSLEB128Size(PrevAction->ValueForTypeID); 848 MCAsmInfo::getSLEB128Size(PrevAction->ValueForTypeID);
850 for (unsigned j = NumShared; j != SizePrevIds; ++j) { 849 for (unsigned j = NumShared; j != SizePrevIds; ++j) {
851 SizeAction -= TargetAsmInfo::getSLEB128Size(PrevAction->ValueForTypeID ); 850 SizeAction -= MCAsmInfo::getSLEB128Size(PrevAction->ValueForTypeID);
852 SizeAction += -PrevAction->NextAction; 851 SizeAction += -PrevAction->NextAction;
853 PrevAction = PrevAction->Previous; 852 PrevAction = PrevAction->Previous;
854 } 853 }
855 } 854 }
856 855
857 // Compute the actions. 856 // Compute the actions.
858 for (unsigned I = NumShared, M = TypeIds.size(); I != M; ++I) { 857 for (unsigned I = NumShared, M = TypeIds.size(); I != M; ++I) {
859 int TypeID = TypeIds[I]; 858 int TypeID = TypeIds[I];
860 assert(-1-TypeID < (int)FilterOffsets.size() && "Unknown filter id!"); 859 assert(-1-TypeID < (int)FilterOffsets.size() && "Unknown filter id!");
861 int ValueForTypeID = TypeID < 0 ? FilterOffsets[-1 - TypeID] : TypeID; 860 int ValueForTypeID = TypeID < 0 ? FilterOffsets[-1 - TypeID] : TypeID;
862 unsigned SizeTypeID = TargetAsmInfo::getSLEB128Size(ValueForTypeID); 861 unsigned SizeTypeID = MCAsmInfo::getSLEB128Size(ValueForTypeID);
863 862
864 int NextAction = SizeAction ? -(SizeAction + SizeTypeID) : 0; 863 int NextAction = SizeAction ? -(SizeAction + SizeTypeID) : 0;
865 SizeAction = SizeTypeID + TargetAsmInfo::getSLEB128Size(NextAction); 864 SizeAction = SizeTypeID + MCAsmInfo::getSLEB128Size(NextAction);
866 SizeSiteActions += SizeAction; 865 SizeSiteActions += SizeAction;
867 866
868 ActionEntry Action = {ValueForTypeID, NextAction, PrevAction}; 867 ActionEntry Action = {ValueForTypeID, NextAction, PrevAction};
869 Actions.push_back(Action); 868 Actions.push_back(Action);
870 869
871 PrevAction = &Actions.back(); 870 PrevAction = &Actions.back();
872 } 871 }
873 872
874 // Record the first action of the landing pad site. 873 // Record the first action of the landing pad site.
875 FirstAction = SizeActions + SizeSiteActions - SizeAction + 1; 874 FirstAction = SizeActions + SizeSiteActions - SizeAction + 1;
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
958 if (MayThrow) { 957 if (MayThrow) {
959 CallSiteEntry Site = {LastLabel, 0, 0, 0}; 958 CallSiteEntry Site = {LastLabel, 0, 0, 0};
960 CallSites.push_back(Site); 959 CallSites.push_back(Site);
961 } 960 }
962 961
963 // Final tallies. 962 // Final tallies.
964 unsigned SizeSites = CallSites.size() * (sizeof(int32_t) + // Site start. 963 unsigned SizeSites = CallSites.size() * (sizeof(int32_t) + // Site start.
965 sizeof(int32_t) + // Site length. 964 sizeof(int32_t) + // Site length.
966 sizeof(int32_t)); // Landing pad. 965 sizeof(int32_t)); // Landing pad.
967 for (unsigned i = 0, e = CallSites.size(); i < e; ++i) 966 for (unsigned i = 0, e = CallSites.size(); i < e; ++i)
968 SizeSites += TargetAsmInfo::getULEB128Size(CallSites[i].Action); 967 SizeSites += MCAsmInfo::getULEB128Size(CallSites[i].Action);
969 968
970 unsigned SizeTypes = TypeInfos.size() * TD->getPointerSize(); 969 unsigned SizeTypes = TypeInfos.size() * TD->getPointerSize();
971 970
972 unsigned TypeOffset = sizeof(int8_t) + // Call site format 971 unsigned TypeOffset = sizeof(int8_t) + // Call site format
973 // Call-site table length 972 // Call-site table length
974 TargetAsmInfo::getULEB128Size(SizeSites) + 973 MCAsmInfo::getULEB128Size(SizeSites) +
975 SizeSites + SizeActions + SizeTypes; 974 SizeSites + SizeActions + SizeTypes;
976 975
977 unsigned TotalSize = sizeof(int8_t) + // LPStart format 976 unsigned TotalSize = sizeof(int8_t) + // LPStart format
978 sizeof(int8_t) + // TType format 977 sizeof(int8_t) + // TType format
979 TargetAsmInfo::getULEB128Size(TypeOffset) + // TType base offset 978 MCAsmInfo::getULEB128Size(TypeOffset) + // TType base off set
980 TypeOffset; 979 TypeOffset;
981 980
982 unsigned SizeAlign = (4 - TotalSize) & 3; 981 unsigned SizeAlign = (4 - TotalSize) & 3;
983 982
984 // Begin the exception table. 983 // Begin the exception table.
985 FinalSize = RoundUpToAlign(FinalSize, 4); 984 FinalSize = RoundUpToAlign(FinalSize, 4);
986 for (unsigned i = 0; i != SizeAlign; ++i) { 985 for (unsigned i = 0; i != SizeAlign; ++i) {
987 ++FinalSize; 986 ++FinalSize;
988 } 987 }
989 988
(...skipping 17 matching lines...) Expand all
1007 1006
1008 // Asm->EOL("Region start"); 1007 // Asm->EOL("Region start");
1009 FinalSize += PointerSize; 1008 FinalSize += PointerSize;
1010 1009
1011 //Asm->EOL("Region length"); 1010 //Asm->EOL("Region length");
1012 FinalSize += PointerSize; 1011 FinalSize += PointerSize;
1013 1012
1014 // Asm->EOL("Landing pad"); 1013 // Asm->EOL("Landing pad");
1015 FinalSize += PointerSize; 1014 FinalSize += PointerSize;
1016 1015
1017 FinalSize += TargetAsmInfo::getULEB128Size(S.Action); 1016 FinalSize += MCAsmInfo::getULEB128Size(S.Action);
1018 // Asm->EOL("Action"); 1017 // Asm->EOL("Action");
1019 } 1018 }
1020 1019
1021 // Emit the actions. 1020 // Emit the actions.
1022 for (unsigned I = 0, N = Actions.size(); I != N; ++I) { 1021 for (unsigned I = 0, N = Actions.size(); I != N; ++I) {
1023 ActionEntry &Action = Actions[I]; 1022 ActionEntry &Action = Actions[I];
1024 1023
1025 //Asm->EOL("TypeInfo index"); 1024 //Asm->EOL("TypeInfo index");
1026 FinalSize += TargetAsmInfo::getSLEB128Size(Action.ValueForTypeID); 1025 FinalSize += MCAsmInfo::getSLEB128Size(Action.ValueForTypeID);
1027 //Asm->EOL("Next action"); 1026 //Asm->EOL("Next action");
1028 FinalSize += TargetAsmInfo::getSLEB128Size(Action.NextAction); 1027 FinalSize += MCAsmInfo::getSLEB128Size(Action.NextAction);
1029 } 1028 }
1030 1029
1031 // Emit the type ids. 1030 // Emit the type ids.
1032 for (unsigned M = TypeInfos.size(); M; --M) { 1031 for (unsigned M = TypeInfos.size(); M; --M) {
1033 // Asm->EOL("TypeInfo"); 1032 // Asm->EOL("TypeInfo");
1034 FinalSize += PointerSize; 1033 FinalSize += PointerSize;
1035 } 1034 }
1036 1035
1037 // Emit the filter typeids. 1036 // Emit the filter typeids.
1038 for (unsigned j = 0, M = FilterIds.size(); j < M; ++j) { 1037 for (unsigned j = 0, M = FilterIds.size(); j < M; ++j) {
1039 unsigned TypeID = FilterIds[j]; 1038 unsigned TypeID = FilterIds[j];
1040 FinalSize += TargetAsmInfo::getULEB128Size(TypeID); 1039 FinalSize += MCAsmInfo::getULEB128Size(TypeID);
1041 //Asm->EOL("Filter TypeInfo index"); 1040 //Asm->EOL("Filter TypeInfo index");
1042 } 1041 }
1043 1042
1044 FinalSize = RoundUpToAlign(FinalSize, 4); 1043 FinalSize = RoundUpToAlign(FinalSize, 4);
1045 1044
1046 return FinalSize; 1045 return FinalSize;
1047 } 1046 }
LEFTRIGHT

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld r497