mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-17 04:24:00 +00:00
Factor some duplicated code into MCObjectStreamer::EmitLabel.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120245 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -14,6 +14,7 @@
|
||||
#include "llvm/MC/MCCodeEmitter.h"
|
||||
#include "llvm/MC/MCDwarf.h"
|
||||
#include "llvm/MC/MCExpr.h"
|
||||
#include "llvm/MC/MCSymbol.h"
|
||||
#include "llvm/Target/TargetAsmBackend.h"
|
||||
using namespace llvm;
|
||||
|
||||
@ -75,6 +76,25 @@ const MCExpr *MCObjectStreamer::AddValueSymbols(const MCExpr *Value) {
|
||||
return Value;
|
||||
}
|
||||
|
||||
void MCObjectStreamer::EmitLabel(MCSymbol *Symbol) {
|
||||
assert(Symbol->isUndefined() && "Cannot define a symbol twice!");
|
||||
assert(!Symbol->isVariable() && "Cannot emit a variable symbol!");
|
||||
assert(CurSection && "Cannot emit before setting section!");
|
||||
|
||||
Symbol->setSection(*CurSection);
|
||||
|
||||
MCSymbolData &SD = getAssembler().getOrCreateSymbolData(*Symbol);
|
||||
|
||||
// FIXME: This is wasteful, we don't necessarily need to create a data
|
||||
// fragment. Instead, we should mark the symbol as pointing into the data
|
||||
// fragment if it exists, otherwise we should just queue the label and set its
|
||||
// fragment pointer when we emit the next fragment.
|
||||
MCDataFragment *F = getOrCreateDataFragment();
|
||||
assert(!SD.getFragment() && "Unexpected fragment on symbol data!");
|
||||
SD.setFragment(F);
|
||||
SD.setOffset(F->getContents().size());
|
||||
}
|
||||
|
||||
void MCObjectStreamer::EmitULEB128Value(const MCExpr *Value,
|
||||
unsigned AddrSpace) {
|
||||
new MCLEBFragment(*Value, false, getCurrentSectionData());
|
||||
|
Reference in New Issue
Block a user