Use set directive for StartMinusEndExpr.

This is a fix for llvm-gcc-i386-darwin9 buildbot failure.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120742 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Devang Patel 2010-12-02 21:32:30 +00:00
parent 1d9582cf96
commit ee4854faf3
9 changed files with 45 additions and 11 deletions

View File

@ -60,7 +60,8 @@ public:
/// @{
virtual void EmitLabel(MCSymbol *Symbol);
virtual void EmitValue(const MCExpr *Value, unsigned Size,unsigned AddrSpace);
virtual void EmitValue(const MCExpr *Value, unsigned Size,unsigned AddrSpace,
bool UseSet = false);
virtual void EmitULEB128Value(const MCExpr *Value, unsigned AddrSpace = 0);
virtual void EmitSLEB128Value(const MCExpr *Value, unsigned AddrSpace = 0);
virtual void EmitWeakReference(MCSymbol *Alias, const MCSymbol *Symbol);

View File

@ -242,7 +242,7 @@ namespace llvm {
/// @param Size - The size of the integer (in bytes) to emit. This must
/// match a native machine width.
virtual void EmitValue(const MCExpr *Value, unsigned Size,
unsigned AddrSpace = 0) = 0;
unsigned AddrSpace = 0, bool UseSet = false) = 0;
/// EmitIntValue - Special case of EmitValue that avoids the client having
/// to pass in a MCExpr for constant integers.

View File

@ -147,7 +147,8 @@ public:
virtual void EmitBytes(StringRef Data, unsigned AddrSpace);
virtual void EmitValue(const MCExpr *Value, unsigned Size,unsigned AddrSpace);
virtual void EmitValue(const MCExpr *Value, unsigned Size,unsigned AddrSpace,
bool UseSet = false);
virtual void EmitULEB128Value(const MCExpr *Value, unsigned AddrSpace = 0);
@ -495,7 +496,7 @@ void MCAsmStreamer::EmitBytes(StringRef Data, unsigned AddrSpace) {
}
void MCAsmStreamer::EmitValue(const MCExpr *Value, unsigned Size,
unsigned AddrSpace) {
unsigned AddrSpace, bool UseSet) {
assert(CurSection && "Cannot emit contents before setting section!");
const char *Directive = 0;
switch (Size) {
@ -521,6 +522,14 @@ void MCAsmStreamer::EmitValue(const MCExpr *Value, unsigned Size,
}
assert(Directive && "Invalid size for machine code value!");
if (UseSet && MAI.hasSetDirective()) {
MCSymbol *SetLabel = getContext().CreateTempSymbol();
EmitAssignment(SetLabel, Value);
OS << Directive << *SetLabel;
EmitEOL();
return;
}
OS << Directive << *Value;
EmitEOL();
}

View File

@ -256,7 +256,7 @@ void MCDwarfFileTable::Emit(MCStreamer *MCOS,
// The first 4 bytes is the total length of the information for this
// compilation unit (not including these 4 bytes for the length).
MCOS->EmitValue(MakeStartMinusEndExpr(MCOS, LineStartSym, LineEndSym, 4),
4, 0);
4, 0, true /*UseSet*/);
// Next 2 bytes is the Version, which is Dwarf 2.
MCOS->EmitIntValue(2, 2);
@ -270,7 +270,7 @@ void MCDwarfFileTable::Emit(MCStreamer *MCOS,
// length of the prologue.
MCOS->EmitValue(MakeStartMinusEndExpr(MCOS, LineStartSym, ProEndSym,
(4 + 2 + 4)),
4, 0);
4, 0, true /*UseSet*/);
// Parameters of the state machine, are next.
MCOS->EmitIntValue(DWARF2_LINE_MIN_INSN_LENGTH, 1);

View File

@ -147,7 +147,8 @@ public:
return Child->EmitBytes(Data, AddrSpace);
}
virtual void EmitValue(const MCExpr *Value, unsigned Size,unsigned AddrSpace){
virtual void EmitValue(const MCExpr *Value, unsigned Size,unsigned AddrSpace,
bool UseSet = false){
LogCall("EmitValue");
return Child->EmitValue(Value, Size, AddrSpace);
}

View File

@ -66,7 +66,7 @@ namespace {
virtual void EmitBytes(StringRef Data, unsigned AddrSpace) {}
virtual void EmitValue(const MCExpr *Value, unsigned Size,
unsigned AddrSpace) {}
unsigned AddrSpace, bool UseSet = false) {}
virtual void EmitULEB128Value(const MCExpr *Value,
unsigned AddrSpace = 0) {}
virtual void EmitSLEB128Value(const MCExpr *Value,

View File

@ -77,7 +77,7 @@ const MCExpr *MCObjectStreamer::AddValueSymbols(const MCExpr *Value) {
}
void MCObjectStreamer::EmitValue(const MCExpr *Value, unsigned Size,
unsigned AddrSpace) {
unsigned AddrSpace, bool UseSet) {
assert(AddrSpace == 0 && "Address space must be 0!");
MCDataFragment *DF = getOrCreateDataFragment();

View File

@ -143,7 +143,8 @@ public:
virtual void EmitBytes(StringRef Data, unsigned AddrSpace);
virtual void EmitValue(const MCExpr *Value, unsigned Size,unsigned AddrSpace);
virtual void EmitValue(const MCExpr *Value, unsigned Size,unsigned AddrSpace,
bool UseSet = false);
virtual void EmitULEB128Value(const MCExpr *Value, unsigned AddrSpace = 0);
virtual void EmitSLEB128Value(const MCExpr *Value, unsigned AddrSpace = 0);
virtual void EmitGPRel32Value(const MCExpr *Value);
@ -350,7 +351,7 @@ void PTXMCAsmStreamer::EmitBytes(StringRef Data, unsigned AddrSpace) {
}
void PTXMCAsmStreamer::EmitValue(const MCExpr *Value, unsigned Size,
unsigned AddrSpace) {
unsigned AddrSpace, bool UseSet) {
assert(CurSection && "Cannot emit contents before setting section!");
const char *Directive = 0;
switch (Size) {

View File

@ -0,0 +1,22 @@
; RUN: llc < %s -disable-dot-loc -mtriple=x86_64-apple-darwin -O0 | FileCheck %s
define void @foo() nounwind ssp {
entry:
ret void, !dbg !5
}
!llvm.dbg.sp = !{!0}
!0 = metadata !{i32 589870, i32 0, metadata !1, metadata !"foo", metadata !"foo", metadata !"", metadata !1, i32 3, metadata !3, i1 false, i1 true, i32 0, i32 0, null, i32 256, i1 false, void ()* @foo} ; [ DW_TAG_subprogram ]
!1 = metadata !{i32 589865, metadata !"e.c", metadata !"/private/tmp", metadata !2} ; [ DW_TAG_file_type ]
!2 = metadata !{i32 589841, i32 0, i32 12, metadata !"e.c", metadata !"/private/tmp", metadata !"clang version 2.9 (trunk 120563)", i1 true, i1 false, metadata !"", i32 0} ; [ DW_TAG_compile_unit ]
!3 = metadata !{i32 589845, metadata !1, metadata !"", metadata !1, i32 0, i64 0, i64 0, i64 0, i32 0, null, metadata !4, i32 0, null} ; [ DW_TAG_subroutine_type ]
!4 = metadata !{null}
!5 = metadata !{i32 5, i32 1, metadata !6, null}
!6 = metadata !{i32 589835, metadata !0, i32 3, i32 16, metadata !1, i32 0} ; [ DW_TAG_lexical_block ]
; CHECK: .subsections_via_symbols
; CHECK-NEXT: __debug_line
; CHECK-NEXT: Ltmp
; CHECK-NEXT: Ltmp{{[0-9]}} = (Ltmp