|
LLVM
3.7.0
|
#include "llvm/CodeGen/AsmPrinter.h"#include "DwarfDebug.h"#include "DwarfException.h"#include "WinException.h"#include "WinCodeViewLineTables.h"#include "llvm/ADT/SmallString.h"#include "llvm/ADT/Statistic.h"#include "llvm/Analysis/ConstantFolding.h"#include "llvm/CodeGen/Analysis.h"#include "llvm/CodeGen/GCMetadataPrinter.h"#include "llvm/CodeGen/MachineConstantPool.h"#include "llvm/CodeGen/MachineFrameInfo.h"#include "llvm/CodeGen/MachineFunction.h"#include "llvm/CodeGen/MachineInstrBundle.h"#include "llvm/CodeGen/MachineJumpTableInfo.h"#include "llvm/CodeGen/MachineLoopInfo.h"#include "llvm/CodeGen/MachineModuleInfoImpls.h"#include "llvm/IR/DataLayout.h"#include "llvm/IR/DebugInfo.h"#include "llvm/IR/Mangler.h"#include "llvm/IR/Module.h"#include "llvm/IR/Operator.h"#include "llvm/MC/MCAsmInfo.h"#include "llvm/MC/MCContext.h"#include "llvm/MC/MCExpr.h"#include "llvm/MC/MCInst.h"#include "llvm/MC/MCSection.h"#include "llvm/MC/MCStreamer.h"#include "llvm/MC/MCSymbolELF.h"#include "llvm/MC/MCValue.h"#include "llvm/Support/ErrorHandling.h"#include "llvm/Support/Format.h"#include "llvm/Support/MathExtras.h"#include "llvm/Support/TargetRegistry.h"#include "llvm/Support/Timer.h"#include "llvm/Target/TargetFrameLowering.h"#include "llvm/Target/TargetInstrInfo.h"#include "llvm/Target/TargetLowering.h"#include "llvm/Target/TargetLoweringObjectFile.h"#include "llvm/Target/TargetRegisterInfo.h"#include "llvm/Target/TargetSubtargetInfo.h"Go to the source code of this file.
Macros | |
| #define | DEBUG_TYPE "asm-printer" |
Typedefs | |
| typedef DenseMap< GCStrategy *, std::unique_ptr < GCMetadataPrinter > > | gcp_map_type |
Functions | |
| STATISTIC (EmittedInsts,"Number of machine instrs printed") | |
| static gcp_map_type & | getGCMap (void *&P) |
| static unsigned | getGVAlignmentLog2 (const GlobalValue *GV, const DataLayout &DL, unsigned InBits=0) |
| getGVAlignmentLog2 - Return the alignment to use for the specified global value in log2 form. More... | |
| static bool | canBeHidden (const GlobalValue *GV, const MCAsmInfo &MAI) |
| static void | emitComments (const MachineInstr &MI, raw_ostream &CommentOS) |
| emitComments - Pretty-print comments for instructions. More... | |
| static void | emitKill (const MachineInstr *MI, AsmPrinter &AP) |
| static bool | emitDebugValueComment (const MachineInstr *MI, AsmPrinter &AP) |
| emitDebugValueComment - This method handles the target-independent form of DBG_VALUE, returning true if it was able to do so. More... | |
| static unsigned | getNumGlobalVariableUses (const Constant *C) |
| Compute the number of Global Variables that uses a Constant. More... | |
| static bool | isGOTEquivalentCandidate (const GlobalVariable *GV, unsigned &NumGOTEquivUsers) |
| Only consider global GOT equivalents if at least one user is a cstexpr inside an initializer of another global variables. More... | |
| static void | emitGlobalConstantImpl (const Constant *C, AsmPrinter &AP, const Constant *BaseCV=nullptr, uint64_t Offset=0) |
| static int | isRepeatedByteSequence (const ConstantDataSequential *V) |
| isRepeatedByteSequence - Determine whether the given value is composed of a repeated sequence of identical bytes and return the byte value. More... | |
| static int | isRepeatedByteSequence (const Value *V, TargetMachine &TM) |
| isRepeatedByteSequence - Determine whether the given value is composed of a repeated sequence of identical bytes and return the byte value. More... | |
| static void | emitGlobalConstantDataSequential (const ConstantDataSequential *CDS, AsmPrinter &AP) |
| static void | emitGlobalConstantArray (const ConstantArray *CA, AsmPrinter &AP, const Constant *BaseCV, uint64_t Offset) |
| static void | emitGlobalConstantVector (const ConstantVector *CV, AsmPrinter &AP) |
| static void | emitGlobalConstantStruct (const ConstantStruct *CS, AsmPrinter &AP, const Constant *BaseCV, uint64_t Offset) |
| static void | emitGlobalConstantFP (const ConstantFP *CFP, AsmPrinter &AP) |
| static void | emitGlobalConstantLargeInt (const ConstantInt *CI, AsmPrinter &AP) |
| static void | handleIndirectSymViaGOTPCRel (AsmPrinter &AP, const MCExpr **ME, const Constant *BaseCst, uint64_t Offset) |
| Transform a not absolute MCExpr containing a reference to a GOT equivalent global, by a target specific GOT pc relative access to the final symbol. More... | |
| static void | PrintParentLoopComment (raw_ostream &OS, const MachineLoop *Loop, unsigned FunctionNumber) |
| PrintParentLoopComment - Print comments about parent loops of this one. More... | |
| static void | PrintChildLoopComment (raw_ostream &OS, const MachineLoop *Loop, unsigned FunctionNumber) |
| PrintChildLoopComment - Print comments about child loops within the loop for this basic block, with nesting. More... | |
| static void | emitBasicBlockLoopComments (const MachineBasicBlock &MBB, const MachineLoopInfo *LI, const AsmPrinter &AP) |
| emitBasicBlockLoopComments - Pretty-print comments for basic blocks. More... | |
Variables | |
| static const char *const | DWARFGroupName = "DWARF Emission" |
| static const char *const | DbgTimerName = "Debug Info Emission" |
| static const char *const | EHTimerName = "DWARF Exception Writer" |
| static const char *const | CodeViewLineTablesGroupName = "CodeView Line Tables" |
| #define DEBUG_TYPE "asm-printer" |
Definition at line 57 of file AsmPrinter.cpp.
| typedef DenseMap<GCStrategy*, std::unique_ptr<GCMetadataPrinter> > gcp_map_type |
Definition at line 68 of file AsmPrinter.cpp.
|
static |
Definition at line 282 of file AsmPrinter.cpp.
References llvm::canBeOmittedFromSymbolTable(), and llvm::MCAsmInfo::hasWeakDefCanBeHiddenDirective().
|
static |
emitBasicBlockLoopComments - Pretty-print comments for basic blocks.
Definition at line 2337 of file AsmPrinter.cpp.
References llvm::LoopBase< N, M >::empty(), llvm::AsmPrinter::getFunctionNumber(), llvm::LoopBase< N, M >::getHeader(), llvm::LoopBase< N, M >::getLoopDepth(), llvm::MachineLoopInfo::getLoopFor(), llvm::LoopBase< N, M >::getParentLoop(), llvm::raw_ostream::indent(), llvm::AsmPrinter::OutStreamer, PrintChildLoopComment(), and PrintParentLoopComment().
Referenced by llvm::AsmPrinter::EmitBasicBlockStart().
|
static |
emitComments - Pretty-print comments for instructions.
Definition at line 604 of file AsmPrinter.cpp.
References llvm::MachineInstr::getAsmPrinterFlag(), llvm::MachineFunction::getFrameInfo(), llvm::TargetSubtargetInfo::getInstrInfo(), llvm::MachineInstr::getParent(), llvm::MachineBasicBlock::getParent(), llvm::MachineMemOperand::getSize(), llvm::MachineFunction::getSubtarget(), llvm::TargetInstrInfo::hasLoadFromStackSlot(), llvm::TargetInstrInfo::hasStoreToStackSlot(), llvm::TargetInstrInfo::isLoadFromStackSlotPostFE(), llvm::MachineFrameInfo::isSpillSlotObjectIndex(), llvm::TargetInstrInfo::isStoreToStackSlotPostFE(), llvm::MachineInstr::memoperands_begin(), llvm::MachineInstr::ReloadReuse, and TII.
Referenced by llvm::AsmPrinter::EmitFunctionBody().
|
static |
emitDebugValueComment - This method handles the target-independent form of DBG_VALUE, returning true if it was able to do so.
A false return means the target will need to handle MI in EmitInstruction.
Definition at line 664 of file AsmPrinter.cpp.
References llvm::lltok::APFloat, llvm::APFloat::convert(), llvm::APFloat::convertToDouble(), llvm::APFloat::convertToFloat(), llvm::StringRef::empty(), llvm::DIExpression::getBitPieceOffset(), llvm::DIExpression::getBitPieceSize(), llvm::MachineOperand::getCImm(), llvm::MachineModuleInfo::getContext(), llvm::MachineInstr::getDebugExpression(), llvm::MachineInstr::getDebugVariable(), llvm::MachineOperand::getFPImm(), llvm::TargetFrameLowering::getFrameIndexReference(), llvm::TargetSubtargetInfo::getFrameLowering(), llvm::MachineOperand::getImm(), llvm::MachineOperand::getIndex(), llvm::MCRegisterInfo::getName(), llvm::DIVariable::getName(), llvm::MachineInstr::getNumOperands(), llvm::MachineInstr::getOperand(), llvm::MachineOperand::getReg(), llvm::MCContext::getRegisterInfo(), llvm::DILocalVariable::getScope(), llvm::MachineFunction::getSubtarget(), llvm::Value::getType(), llvm::ConstantInt::getValue(), llvm::ConstantFP::getValueAPF(), llvm::APFloat::IEEEdouble, llvm::DIExpression::isBitPiece(), llvm::MachineOperand::isCImm(), llvm::Type::isDoubleTy(), llvm::MachineOperand::isFI(), llvm::Type::isFloatTy(), llvm::MachineOperand::isFPImm(), llvm::MachineOperand::isImm(), llvm::MachineOperand::isReg(), llvm::AsmPrinter::MF, llvm::AsmPrinter::MMI, llvm::AsmPrinter::OutStreamer, llvm::APInt::print(), llvm::APFloat::rmNearestTiesToEven, llvm::SP, and llvm::raw_svector_ostream::str().
Referenced by llvm::AsmPrinter::EmitFunctionBody().
|
static |
Definition at line 1893 of file AsmPrinter.cpp.
References emitGlobalConstantImpl(), llvm::TargetMachine::getDataLayout(), llvm::User::getNumOperands(), llvm::User::getOperand(), llvm::Value::getType(), llvm::ConstantArray::getType(), llvm::DataLayout::getTypeAllocSize(), isRepeatedByteSequence(), llvm::AsmPrinter::OutStreamer, and llvm::AsmPrinter::TM.
Referenced by emitGlobalConstantImpl().
|
static |
Definition at line 1826 of file AsmPrinter.cpp.
References F(), llvm::format(), llvm::ConstantDataSequential::getAsString(), llvm::TargetMachine::getDataLayout(), llvm::ConstantDataSequential::getElementAsDouble(), llvm::ConstantDataSequential::getElementAsFloat(), llvm::ConstantDataSequential::getElementAsInteger(), llvm::ConstantDataSequential::getElementByteSize(), llvm::SequentialType::getElementType(), llvm::ConstantDataSequential::getElementType(), llvm::ConstantDataSequential::getNumElements(), llvm::ConstantDataSequential::getType(), llvm::DataLayout::getTypeAllocSize(), I, llvm::Type::isDoubleTy(), llvm::Type::isFloatTy(), isRepeatedByteSequence(), llvm::ConstantDataSequential::isString(), llvm::AsmPrinter::isVerbose(), llvm::AsmPrinter::OutStreamer, and llvm::AsmPrinter::TM.
Referenced by emitGlobalConstantImpl().
|
static |
Definition at line 1952 of file AsmPrinter.cpp.
References llvm::APFloat::bitcastToAPInt(), llvm::APInt::getBitWidth(), llvm::TargetMachine::getDataLayout(), llvm::APInt::getNumWords(), llvm::APInt::getRawData(), llvm::Value::getType(), llvm::DataLayout::getTypeAllocSize(), llvm::DataLayout::getTypeStoreSize(), llvm::ConstantFP::getValueAPF(), llvm::DataLayout::isBigEndian(), llvm::Type::isPPC_FP128Ty(), llvm::AsmPrinter::isVerbose(), llvm::AsmPrinter::OutStreamer, llvm::Type::print(), llvm::tgtok::StrVal, llvm::AsmPrinter::TM, and llvm::APFloat::toString().
Referenced by emitGlobalConstantImpl().
|
static |
Definition at line 2152 of file AsmPrinter.cpp.
References llvm::ConstantFoldConstantExpression(), emitGlobalConstantArray(), emitGlobalConstantDataSequential(), emitGlobalConstantFP(), emitGlobalConstantLargeInt(), emitGlobalConstantStruct(), emitGlobalConstantVector(), llvm::format(), llvm::TargetMachine::getDataLayout(), llvm::AsmPrinter::getObjFileLowering(), llvm::Value::getType(), llvm::DataLayout::getTypeAllocSize(), handleIndirectSymViaGOTPCRel(), llvm::Value::hasOneUse(), llvm::AsmPrinter::isVerbose(), llvm::AsmPrinter::lowerConstant(), llvm::AsmPrinter::OutStreamer, llvm::TargetLoweringObjectFile::supportIndirectSymViaGOTPCRel(), llvm::AsmPrinter::TM, and llvm::Value::user_back().
Referenced by llvm::AsmPrinter::EmitGlobalConstant(), emitGlobalConstantArray(), emitGlobalConstantStruct(), and emitGlobalConstantVector().
|
static |
Definition at line 2001 of file AsmPrinter.cpp.
References llvm::ConstantInt::getBitWidth(), llvm::TargetMachine::getDataLayout(), llvm::ConstantInt::getType(), llvm::DataLayout::getTypeAllocSize(), llvm::ConstantInt::getValue(), llvm::DataLayout::isBigEndian(), llvm::AsmPrinter::OutStreamer, and llvm::AsmPrinter::TM.
Referenced by emitGlobalConstantImpl().
|
static |
Definition at line 1924 of file AsmPrinter.cpp.
References emitGlobalConstantImpl(), llvm::tgtok::Field, llvm::TargetMachine::getDataLayout(), llvm::StructLayout::getElementOffset(), llvm::User::getNumOperands(), llvm::User::getOperand(), llvm::StructLayout::getSizeInBytes(), llvm::DataLayout::getStructLayout(), llvm::Value::getType(), llvm::ConstantStruct::getType(), llvm::DataLayout::getTypeAllocSize(), llvm::AsmPrinter::OutStreamer, and llvm::AsmPrinter::TM.
Referenced by emitGlobalConstantImpl().
|
static |
Definition at line 1912 of file AsmPrinter.cpp.
References emitGlobalConstantImpl(), llvm::TargetMachine::getDataLayout(), llvm::SequentialType::getElementType(), llvm::VectorType::getNumElements(), llvm::User::getOperand(), llvm::ConstantVector::getType(), llvm::DataLayout::getTypeAllocSize(), llvm::AsmPrinter::OutStreamer, and llvm::AsmPrinter::TM.
Referenced by emitGlobalConstantImpl().
|
static |
Definition at line 648 of file AsmPrinter.cpp.
References llvm::MachineModuleInfo::getContext(), llvm::MCRegisterInfo::getName(), llvm::MachineInstr::getNumOperands(), llvm::MachineInstr::getOperand(), llvm::MachineOperand::getReg(), llvm::MCContext::getRegisterInfo(), llvm::MachineOperand::isDef(), llvm::MachineOperand::isReg(), llvm::AsmPrinter::MMI, and llvm::AsmPrinter::OutStreamer.
Referenced by llvm::AsmPrinter::EmitFunctionBody().
|
static |
Definition at line 69 of file AsmPrinter.cpp.
Referenced by llvm::AsmPrinter::~AsmPrinter().
|
static |
getGVAlignmentLog2 - Return the alignment to use for the specified global value in log2 form.
This rounds up to the preferred alignment if possible and legal.
Definition at line 79 of file AsmPrinter.cpp.
References llvm::GlobalValue::getAlignment(), llvm::DataLayout::getPreferredAlignmentLog(), llvm::GlobalValue::hasSection(), and llvm::Log2_32().
Referenced by llvm::AsmPrinter::EmitAlignment(), and llvm::AsmPrinter::EmitGlobalVariable().
Compute the number of Global Variables that uses a Constant.
Definition at line 928 of file AsmPrinter.cpp.
References llvm::Value::users().
Referenced by isGOTEquivalentCandidate().
|
static |
Transform a not absolute MCExpr containing a reference to a GOT equivalent global, by a target specific GOT pc relative access to the final symbol.
Definition at line 2061 of file AsmPrinter.cpp.
References llvm::dyn_cast(), llvm::MCValue::getConstant(), llvm::TargetLoweringObjectFile::getIndirectSymViaGOTPCRel(), llvm::AsmPrinter::getObjFileLowering(), llvm::User::getOperand(), llvm::MCValue::getSymA(), llvm::MCValue::getSymB(), llvm::AsmPrinter::getSymbol(), llvm::MCSymbolRefExpr::getSymbol(), llvm::AsmPrinter::GlobalGOTEquivs, llvm::MCValue::isAbsolute(), llvm::AsmPrinter::MMI, llvm::AsmPrinter::OutStreamer, and llvm::TargetLoweringObjectFile::supportGOTPCRelWithOffset().
Referenced by emitGlobalConstantImpl().
|
static |
Only consider global GOT equivalents if at least one user is a cstexpr inside an initializer of another global variables.
Also, don't handle cstexpr inside instructions. During global variable emission, candidates are skipped and are emitted later in case at least one cstexpr isn't replaced by a PC relative GOT entry access.
Definition at line 947 of file AsmPrinter.cpp.
References llvm::dyn_cast(), getNumGlobalVariableUses(), llvm::User::getOperand(), llvm::GlobalVariable::hasInitializer(), llvm::GlobalValue::hasUnnamedAddr(), llvm::GlobalVariable::isConstant(), llvm::GlobalValue::isDiscardableIfUnused(), and llvm::Value::users().
Referenced by llvm::AsmPrinter::computeGlobalGOTEquivs().
|
static |
isRepeatedByteSequence - Determine whether the given value is composed of a repeated sequence of identical bytes and return the byte value.
If it is not a repeated sequence, return -1.
Definition at line 1779 of file AsmPrinter.cpp.
References llvm::Data, llvm::StringRef::empty(), llvm::ConstantDataSequential::getRawDataValues(), and llvm::StringRef::size().
Referenced by emitGlobalConstantArray(), emitGlobalConstantDataSequential(), and isRepeatedByteSequence().
|
static |
isRepeatedByteSequence - Determine whether the given value is composed of a repeated sequence of identical bytes and return the byte value.
If it is not a repeated sequence, return -1.
Definition at line 1792 of file AsmPrinter.cpp.
References llvm::TargetMachine::getDataLayout(), llvm::User::getOperand(), llvm::Value::getType(), llvm::DataLayout::getTypeAllocSizeInBits(), llvm::APInt::getZExtValue(), isRepeatedByteSequence(), llvm::APInt::isSplat(), llvm::APInt::zextOrSelf(), and llvm::APInt::zextOrTrunc().
|
static |
PrintChildLoopComment - Print comments about child loops within the loop for this basic block, with nesting.
Definition at line 2324 of file AsmPrinter.cpp.
References llvm::CL, and llvm::raw_ostream::indent().
Referenced by emitBasicBlockLoopComments().
|
static |
PrintParentLoopComment - Print comments about parent loops of this one.
Definition at line 2311 of file AsmPrinter.cpp.
References FunctionNumber(), llvm::LoopBase< N, M >::getHeader(), llvm::LoopBase< N, M >::getLoopDepth(), llvm::LoopBase< N, M >::getParentLoop(), and llvm::raw_ostream::indent().
Referenced by emitBasicBlockLoopComments().
| STATISTIC | ( | EmittedInsts | , |
| "Number of machine instrs printed" | |||
| ) |
Definition at line 62 of file AsmPrinter.cpp.
Referenced by llvm::AsmPrinter::doInitialization().
Definition at line 60 of file AsmPrinter.cpp.
Referenced by llvm::AsmPrinter::doInitialization().
Definition at line 59 of file AsmPrinter.cpp.
Referenced by llvm::AsmPrinter::doInitialization().
Definition at line 61 of file AsmPrinter.cpp.
Referenced by llvm::AsmPrinter::doInitialization().
1.8.6