LLVM API Documentation

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Macros | Typedefs | Functions | Variables
AsmPrinter.cpp File Reference
#include "llvm/CodeGen/AsmPrinter.h"
#include "DwarfDebug.h"
#include "DwarfException.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/Analysis/ConstantFolding.h"
#include "llvm/Assembly/Writer.h"
#include "llvm/CodeGen/GCMetadataPrinter.h"
#include "llvm/CodeGen/MachineConstantPool.h"
#include "llvm/CodeGen/MachineFrameInfo.h"
#include "llvm/CodeGen/MachineFunction.h"
#include "llvm/CodeGen/MachineJumpTableInfo.h"
#include "llvm/CodeGen/MachineLoopInfo.h"
#include "llvm/CodeGen/MachineModuleInfo.h"
#include "llvm/DebugInfo.h"
#include "llvm/IR/DataLayout.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/MCSymbol.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/Format.h"
#include "llvm/Support/MathExtras.h"
#include "llvm/Support/Timer.h"
#include "llvm/Target/Mangler.h"
#include "llvm/Target/TargetFrameLowering.h"
#include "llvm/Target/TargetInstrInfo.h"
#include "llvm/Target/TargetLowering.h"
#include "llvm/Target/TargetLoweringObjectFile.h"
#include "llvm/Target/TargetOptions.h"
#include "llvm/Target/TargetRegisterInfo.h"
#include "llvm/Transforms/Utils/GlobalStatus.h"
Include dependency graph for AsmPrinter.cpp:

Go to the source code of this file.

Macros

#define DEBUG_TYPE   "asm-printer"
 

Typedefs

typedef DenseMap< GCStrategy
*, GCMetadataPrinter * > 
gcp_map_type
 

Functions

 STATISTIC (EmittedInsts,"Number of machine instrs printed")
 
static gcp_map_typegetGCMap (void *&P)
 
static unsigned getGVAlignmentLog2 (const GlobalValue *GV, const DataLayout &TD, unsigned InBits=0)
 
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)
 
static const MCExprlowerConstant (const Constant *CV, AsmPrinter &AP)
 
static void emitGlobalConstantImpl (const Constant *C, AsmPrinter &AP)
 
static int isRepeatedByteSequence (const ConstantDataSequential *V)
 
static int isRepeatedByteSequence (const Value *V, TargetMachine &TM)
 
static void emitGlobalConstantDataSequential (const ConstantDataSequential *CDS, AsmPrinter &AP)
 
static void emitGlobalConstantArray (const ConstantArray *CA, AsmPrinter &AP)
 
static void emitGlobalConstantVector (const ConstantVector *CV, AsmPrinter &AP)
 
static void emitGlobalConstantStruct (const ConstantStruct *CS, AsmPrinter &AP)
 
static void emitGlobalConstantFP (const ConstantFP *CFP, AsmPrinter &AP)
 
static void emitGlobalConstantLargeInt (const ConstantInt *CI, AsmPrinter &AP)
 
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)
 
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 = "DWARF Debug Writer"
 
static const char *const EHTimerName = "DWARF Exception Writer"
 

Macro Definition Documentation

#define DEBUG_TYPE   "asm-printer"

Definition at line 14 of file AsmPrinter.cpp.

Typedef Documentation

Definition at line 62 of file AsmPrinter.cpp.

Function Documentation

static void emitBasicBlockLoopComments ( const MachineBasicBlock MBB,
const MachineLoopInfo LI,
const AsmPrinter AP 
)
static
static void emitComments ( const MachineInstr MI,
raw_ostream CommentOS 
)
static
static bool emitDebugValueComment ( const MachineInstr MI,
AsmPrinter AP 
)
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 572 of file AsmPrinter.cpp.

References llvm::lltok::APFloat, llvm::APFloat::convert(), llvm::APFloat::convertToDouble(), llvm::APFloat::convertToFloat(), llvm::MCStreamer::EmitRawText(), llvm::StringRef::empty(), llvm::MachineOperand::getCImm(), llvm::MCAsmInfo::getCommentString(), llvm::DIVariable::getContext(), llvm::MachineOperand::getFPImm(), llvm::TargetFrameLowering::getFrameIndexReference(), llvm::TargetMachine::getFrameLowering(), llvm::MachineOperand::getImm(), llvm::MachineOperand::getIndex(), llvm::MachineOperand::getMetadata(), llvm::MCRegisterInfo::getName(), llvm::DIVariable::getName(), llvm::MachineInstr::getNumOperands(), llvm::MachineInstr::getOperand(), llvm::MachineOperand::getReg(), llvm::TargetMachine::getRegisterInfo(), llvm::Value::getType(), llvm::ConstantInt::getValue(), llvm::ConstantFP::getValueAPF(), llvm::APFloat::IEEEdouble, llvm::MachineOperand::isCImm(), llvm::Type::isDoubleTy(), llvm::MachineOperand::isFI(), llvm::Type::isFloatTy(), llvm::MachineOperand::isFPImm(), llvm::MachineOperand::isImm(), llvm::MachineOperand::isReg(), llvm::DIDescriptor::isSubprogram(), llvm::AsmPrinter::MAI, llvm::AsmPrinter::MF, llvm::AsmPrinter::OutStreamer, llvm::APInt::print(), llvm::APFloat::rmNearestTiesToEven, llvm::raw_svector_ostream::str(), and llvm::AsmPrinter::TM.

Referenced by llvm::AsmPrinter::EmitFunctionBody().

static void emitGlobalConstantArray ( const ConstantArray CA,
AsmPrinter AP 
)
static
static void emitGlobalConstantDataSequential ( const ConstantDataSequential CDS,
AsmPrinter AP 
)
static
static void emitGlobalConstantFP ( const ConstantFP CFP,
AsmPrinter AP 
)
static
static void emitGlobalConstantImpl ( const Constant C,
AsmPrinter AP 
)
static
static void emitGlobalConstantLargeInt ( const ConstantInt CI,
AsmPrinter AP 
)
static
static void emitGlobalConstantStruct ( const ConstantStruct CS,
AsmPrinter AP 
)
static
static void emitGlobalConstantVector ( const ConstantVector CV,
AsmPrinter AP 
)
static
static void emitKill ( const MachineInstr MI,
AsmPrinter AP 
)
static
static gcp_map_type& getGCMap ( void *&  P)
static

Definition at line 63 of file AsmPrinter.cpp.

Referenced by llvm::AsmPrinter::~AsmPrinter().

static unsigned getGVAlignmentLog2 ( const GlobalValue GV,
const DataLayout TD,
unsigned  InBits = 0 
)
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 73 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().

static int isRepeatedByteSequence ( const ConstantDataSequential V)
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 1627 of file AsmPrinter.cpp.

References llvm::CallingConv::C, llvm::StringRef::empty(), llvm::ConstantDataSequential::getRawDataValues(), and llvm::StringRef::size().

Referenced by emitGlobalConstantArray(), emitGlobalConstantDataSequential(), and isRepeatedByteSequence().

static int isRepeatedByteSequence ( const Value V,
TargetMachine TM 
)
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 1640 of file AsmPrinter.cpp.

References llvm::TargetMachine::getDataLayout(), llvm::Value::getType(), llvm::DataLayout::getTypeAllocSize(), llvm::isPowerOf2_64(), isRepeatedByteSequence(), and llvm::SystemZISD::TM.

static const MCExpr* lowerConstant ( const Constant CV,
AsmPrinter AP 
)
static
static void PrintChildLoopComment ( raw_ostream OS,
const MachineLoop Loop,
unsigned  FunctionNumber 
)
static

PrintChildLoopComment - Print comments about child loops within the loop for this basic block, with nesting.

Definition at line 2074 of file AsmPrinter.cpp.

References llvm::LoopBase< N, M >::begin(), llvm::LoopBase< N, M >::end(), and llvm::raw_ostream::indent().

Referenced by emitBasicBlockLoopComments().

static void PrintParentLoopComment ( raw_ostream OS,
const MachineLoop Loop,
unsigned  FunctionNumber 
)
static

PrintParentLoopComment - Print comments about parent loops of this one.

Definition at line 2061 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"   
)

Variable Documentation

const char* const DbgTimerName = "DWARF Debug Writer"
static
const char* const DWARFGroupName = "DWARF Emission"
static
const char* const EHTimerName = "DWARF Exception Writer"
static