//===- lib/MC/MCAssembler.cpp - Assembler Backend Implementation ----------===////// The LLVM Compiler Infrastructure//// This file is distributed under the University of Illinois Open Source// License. See LICENSE.TXT for details.////===----------------------------------------------------------------------===//#define DEBUG_TYPE "assembler"#include"llvm/MC/MCAssembler.h"#include"llvm/MC/MCExpr.h"#include"llvm/MC/MCSectionMachO.h"#include"llvm/MC/MCSymbol.h"#include"llvm/MC/MCValue.h"#include"llvm/ADT/DenseMap.h"#include"llvm/ADT/SmallString.h"#include"llvm/ADT/Statistic.h"#include"llvm/ADT/StringExtras.h"#include"llvm/ADT/StringMap.h"#include"llvm/ADT/Twine.h"#include"llvm/Support/ErrorHandling.h"#include"llvm/Support/MachO.h"#include"llvm/Support/raw_ostream.h"#include"llvm/Support/Debug.h"// FIXME: Gross.#include"../Target/X86/X86FixupKinds.h"#include<vector>usingnamespacellvm;classMachObjectWriter;STATISTIC(EmittedFragments,"Number of emitted assembler fragments");// FIXME FIXME FIXME: There are number of places in this file where we convert// what is a 64-bit assembler value used for computation into a value in the// object file, which may truncate it. We should detect that truncation where// invalid and report errors back.staticvoidWriteFileData(raw_ostream&OS,constMCSectionData&SD,MachObjectWriter&MOW);/// isVirtualSection - Check if this is a section which does not actually exist/// in the object file.staticboolisVirtualSection(constMCSection&Section){// FIXME: Lame.constMCSectionMachO&SMO=static_cast<constMCSectionMachO&>(Section);unsignedType=SMO.getTypeAndAttributes()&MCSectionMachO::SECTION_TYPE;return(Type==MCSectionMachO::S_ZEROFILL);}staticunsignedgetFixupKindLog2Size(MCFixupKindKind){switch(Kind){default:llvm_unreachable("invalid fixup kind!");caseX86::reloc_pcrel_1byte:caseFK_Data_1:return0;caseFK_Data_2:return1;caseX86::reloc_pcrel_4byte:caseX86::reloc_riprel_4byte:caseFK_Data_4:return2;caseFK_Data_8:return3;}}sta