85 case Instruction::Add:
87 case Instruction::Sub:
89 case Instruction::Mul:
92 case Instruction::FDiv:
95 case Instruction::FRem:
137 switch (SynchScope) {
149 for (
unsigned i = 0, e = Str.
size(); i != e; ++i) {
263 if (AttrGrps.empty())
return;
268 for (
unsigned i = 0, e = AttrGrps.size(); i != e; ++i) {
270 for (
unsigned i = 0, e = AS.
getNumSlots(); i != e; ++i) {
311 if (Attrs.empty())
return;
316 for (
unsigned i = 0, e = Attrs.size(); i != e; ++i) {
318 for (
unsigned i = 0, e = A.
getNumSlots(); i != e; ++i)
351 unsigned FunctionAbbrev = Stream.
EmitAbbrev(Abbv);
360 unsigned StructAnonAbbrev = Stream.
EmitAbbrev(Abbv);
367 unsigned StructNameAbbrev = Stream.
EmitAbbrev(Abbv);
376 unsigned StructNamedAbbrev = Stream.
EmitAbbrev(Abbv);
384 unsigned ArrayAbbrev = Stream.
EmitAbbrev(Abbv);
392 for (
unsigned i = 0, e = TypeList.size(); i != e; ++i) {
393 Type *
T = TypeList[i];
420 if (AddressSpace == 0) AbbrevToUse = PtrAbbrev;
429 for (
unsigned i = 0, e = FT->
getNumParams(); i != e; ++i)
431 AbbrevToUse = FunctionAbbrev;
445 AbbrevToUse = StructAnonAbbrev;
451 AbbrevToUse = StructNamedAbbrev;
457 StructNameAbbrev, Stream);
467 AbbrevToUse = ArrayAbbrev;
481 Stream.
EmitRecord(Code, TypeVals, AbbrevToUse);
566 size_t Size =
C->getName().size();
569 for (
char Chr :
C->getName())
593 std::map<std::string, unsigned> SectionMap;
594 std::map<std::string, unsigned> GCMap;
595 unsigned MaxAlignment = 0;
596 unsigned MaxGlobalType = 0;
598 MaxAlignment = std::max(MaxAlignment, GV.getAlignment());
599 MaxGlobalType = std::max(MaxGlobalType, VE.
getTypeID(GV.getValueType()));
600 if (GV.hasSection()) {
602 unsigned &Entry = SectionMap[GV.getSection()];
606 Entry = SectionMap.size();
611 MaxAlignment = std::max(MaxAlignment,
F.getAlignment());
612 if (
F.hasSection()) {
614 unsigned &Entry = SectionMap[
F.getSection()];
618 Entry = SectionMap.size();
623 unsigned &Entry = GCMap[
F.getGC()];
627 Entry = GCMap.size();
633 unsigned SimpleGVarAbbrev = 0;
634 if (!M->global_empty()) {
645 if (MaxAlignment == 0)
648 unsigned MaxEncAlignment =
Log2_32(MaxAlignment)+1;
652 if (SectionMap.empty())
664 unsigned AbbrevToUse = 0;
671 Vals.
push_back(GV.getType()->getAddressSpace() << 2 | 2 | GV.isConstant());
676 Vals.
push_back(GV.hasSection() ? SectionMap[GV.getSection()] : 0);
677 if (GV.isThreadLocal() ||
679 GV.hasUnnamedAddr() || GV.isExternallyInitialized() ||
685 Vals.
push_back(GV.isExternallyInitialized());
689 AbbrevToUse = SimpleGVarAbbrev;
707 Vals.
push_back(
F.hasSection() ? SectionMap[
F.getSection()] : 0);
718 F.hasPersonalityFn() ? (VE.
getValueID(
F.getPersonalityFn()) + 1) : 0);
720 unsigned AbbrevToUse = 0;
735 unsigned AbbrevToUse = 0;
744 if (
const auto *OBO = dyn_cast<OverflowingBinaryOperator>(V)) {
745 if (OBO->hasNoSignedWrap())
747 if (OBO->hasNoUnsignedWrap())
749 }
else if (
const auto *PEO = dyn_cast<PossiblyExactOperator>(V)) {
752 }
else if (
const auto *FPMO = dyn_cast<FPMathOperator>(V)) {
753 if (FPMO->hasUnsafeAlgebra())
755 if (FPMO->hasNoNaNs())
757 if (FPMO->hasNoInfs())
759 if (FPMO->hasNoSignedZeros())
761 if (FPMO->hasAllowReciprocal())
785 assert(!(MD && isa<LocalAsMetadata>(MD)) &&
786 "Unexpected function-local metadata");
827 return I < 0 ? ~(U << 1) : U << 1;
1166 const auto &MDs = VE.
getMDs();
1172 unsigned MDSAbbrev = 0;
1183 #define HANDLE_MDNODE_LEAF(CLASS) unsigned CLASS##Abbrev = 0;
1184 #include "llvm/IR/Metadata.def"
1214 GenericDINodeAbbrev = Stream.
EmitAbbrev(Abbv);
1217 unsigned NameAbbrev = 0;
1229 if (
const MDNode *
N = dyn_cast<MDNode>(MD)) {
1230 assert(
N->isResolved() &&
"Expected forward references to be resolved");
1232 switch (
N->getMetadataID()) {
1235 #define HANDLE_MDNODE_LEAF(CLASS) \
1236 case Metadata::CLASS##Kind: \
1237 Write##CLASS(cast<CLASS>(N), VE, Stream, Record, CLASS##Abbrev); \
1239 #include "llvm/IR/Metadata.def"
1242 if (
const auto *MDC = dyn_cast<ConstantAsMetadata>(MD)) {
1246 const MDString *MDS = cast<MDString>(MD);
1264 for (
const MDNode *
N : NMD.operands())
1276 bool StartedMetadataBlock =
false;
1280 for (
unsigned i = 0, e = MDs.
size(); i != e; ++i) {
1281 assert(MDs[i] &&
"Expected valid function-local metadata");
1282 if (!StartedMetadataBlock) {
1284 StartedMetadataBlock =
true;
1289 if (StartedMetadataBlock)
1305 for (
const auto &
I : MDs) {
1317 I->getAllMetadataOtherThanDebugLoc(MDs);
1320 if (MDs.
empty())
continue;
1324 for (
unsigned i = 0, e = MDs.
size(); i != e; ++i) {
1343 if (Names.
empty())
return;
1347 for (
unsigned MDKindID = 0, e = Names.
size(); MDKindID != e; ++MDKindID) {
1360 if ((int64_t)V >= 0)
1369 if (FirstVal == LastVal)
return;
1373 unsigned AggregateAbbrev = 0;
1374 unsigned String8Abbrev = 0;
1375 unsigned CString7Abbrev = 0;
1376 unsigned CString6Abbrev = 0;
1409 Type *LastTy =
nullptr;
1410 for (
unsigned i = FirstVal; i != LastVal; ++i) {
1411 const Value *V = Vals[i].first;
1421 if (
const InlineAsm *IA = dyn_cast<InlineAsm>(V)) {
1422 Record.
push_back(
unsigned(IA->hasSideEffects()) |
1423 unsigned(IA->isAlignStack()) << 1 |
1424 unsigned(IA->getDialect()&1) << 2);
1427 const std::string &AsmStr = IA->getAsmString();
1429 Record.
append(AsmStr.begin(), AsmStr.end());
1432 const std::string &ConstraintStr = IA->getConstraintString();
1434 Record.
append(ConstraintStr.begin(), ConstraintStr.end());
1440 unsigned Code = -1U;
1441 unsigned AbbrevToUse = 0;
1444 }
else if (isa<UndefValue>(C)) {
1446 }
else if (
const ConstantInt *IV = dyn_cast<ConstantInt>(C)) {
1447 if (IV->getBitWidth() <= 64) {
1448 uint64_t V = IV->getSExtValue();
1457 unsigned NWords = IV->getValue().getActiveWords();
1458 const uint64_t *RawWords = IV->getValue().getRawData();
1459 for (
unsigned i = 0; i != NWords; ++i) {
1464 }
else if (
const ConstantFP *CFP = dyn_cast<ConstantFP>(C)) {
1466 Type *Ty = CFP->getType();
1468 Record.
push_back(CFP->getValueAPF().bitcastToAPInt().getZExtValue());
1472 APInt api = CFP->getValueAPF().bitcastToAPInt();
1474 Record.
push_back((p[1] << 48) | (p[0] >> 16));
1477 APInt api = CFP->getValueAPF().bitcastToAPInt();
1482 assert (0 &&
"Unknown FP type!");
1484 }
else if (isa<ConstantDataSequential>(C) &&
1485 cast<ConstantDataSequential>(C)->isString()) {
1495 AbbrevToUse = String8Abbrev;
1499 for (
unsigned i = 0; i != NumElts; ++i) {
1502 isCStr7 &= (V & 128) == 0;
1508 AbbrevToUse = CString6Abbrev;
1510 AbbrevToUse = CString7Abbrev;
1512 dyn_cast<ConstantDataSequential>(C)) {
1514 Type *EltTy = CDS->getType()->getElementType();
1515 if (isa<IntegerType>(EltTy)) {
1516 for (
unsigned i = 0, e = CDS->getNumElements(); i != e; ++i)
1517 Record.
push_back(CDS->getElementAsInteger(i));
1519 for (
unsigned i = 0, e = CDS->getNumElements(); i != e; ++i) {
1520 union {
float F; uint32_t
I; };
1521 F = CDS->getElementAsFloat(i);
1525 assert(EltTy->
isDoubleTy() &&
"Unknown ConstantData element type");
1526 for (
unsigned i = 0, e = CDS->getNumElements(); i != e; ++i) {
1527 union {
double F; uint64_t
I; };
1528 F = CDS->getElementAsDouble(i);
1532 }
else if (isa<ConstantArray>(C) || isa<ConstantStruct>(C) ||
1533 isa<ConstantVector>(C)) {
1537 AbbrevToUse = AggregateAbbrev;
1538 }
else if (
const ConstantExpr *CE = dyn_cast<ConstantExpr>(C)) {
1539 switch (CE->getOpcode()) {
1548 assert(CE->getNumOperands() == 2 &&
"Unknown constant expr!");
1558 case Instruction::GetElementPtr: {
1560 const auto *GO = cast<GEPOperator>(C);
1561 if (GO->isInBounds())
1564 for (
unsigned i = 0, e = CE->getNumOperands(); i != e; ++i) {
1583 case Instruction::InsertElement:
1590 case Instruction::ShuffleVector:
1605 case Instruction::ICmp:
1606 case Instruction::FCmp:
1614 }
else if (
const BlockAddress *BA = dyn_cast<BlockAddress>(C)) {
1625 Stream.
EmitRecord(Code, Record, AbbrevToUse);
1638 for (
unsigned i = 0, e = Vals.size(); i != e; ++i) {
1639 if (!isa<GlobalValue>(Vals[i].first)) {
1660 if (ValID >= InstID) {
1680 int64_t diff = ((int32_t)InstID - (int32_t)ValID);
1689 unsigned AbbrevToUse = 0;
1700 assert(isa<BinaryOperator>(I) &&
"Unknown instruction!");
1710 Vals.push_back(Flags);
1715 case Instruction::GetElementPtr: {
1718 auto &GEPInst = cast<GetElementPtrInst>(
I);
1725 case Instruction::ExtractValue: {
1729 Vals.append(EVI->idx_begin(), EVI->idx_end());
1732 case Instruction::InsertValue: {
1737 Vals.append(IVI->idx_begin(), IVI->idx_end());
1751 case Instruction::InsertElement:
1757 case Instruction::ShuffleVector:
1763 case Instruction::ICmp:
1764 case Instruction::FCmp: {
1769 Vals.push_back(cast<CmpInst>(I).getPredicate());
1772 Vals.push_back(Flags);
1780 if (NumOperands == 0)
1782 else if (NumOperands == 1) {
1786 for (
unsigned i = 0, e = NumOperands; i != e; ++i)
1791 case Instruction::Br:
1802 case Instruction::Switch:
1811 Vals.push_back(VE.
getValueID(i.getCaseValue()));
1812 Vals.push_back(VE.
getValueID(i.getCaseSuccessor()));
1816 case Instruction::IndirectBr:
1825 case Instruction::Invoke: {
1839 for (
unsigned i = 0, e = FTy->
getNumParams(); i != e; ++i)
1850 case Instruction::Resume:
1854 case Instruction::Unreachable:
1860 const PHINode &PN = cast<PHINode>(
I);
1872 Stream.
EmitRecord(Code, Vals64, AbbrevToUse);
1877 case Instruction::LandingPad: {
1893 case Instruction::Alloca: {
1901 "not enough bits for maximum alignment");
1902 assert(AlignRecord < 1 << 5 &&
"alignment greater than 1 << 64");
1904 AlignRecord |= 1 << 6;
1905 Vals.push_back(AlignRecord);
1910 if (cast<LoadInst>(I).
isAtomic()) {
1919 Vals.push_back(
Log2_32(cast<LoadInst>(I).getAlignment())+1);
1920 Vals.push_back(cast<LoadInst>(I).
isVolatile());
1921 if (cast<LoadInst>(I).
isAtomic()) {
1933 Vals.push_back(
Log2_32(cast<StoreInst>(I).getAlignment())+1);
1934 Vals.push_back(cast<StoreInst>(I).
isVolatile());
1935 if (cast<StoreInst>(I).
isAtomic()) {
1940 case Instruction::AtomicCmpXchg:
1945 Vals.push_back(cast<AtomicCmpXchgInst>(I).
isVolatile());
1947 cast<AtomicCmpXchgInst>(I).getSuccessOrdering()));
1949 cast<AtomicCmpXchgInst>(I).getSynchScope()));
1951 cast<AtomicCmpXchgInst>(I).getFailureOrdering()));
1952 Vals.push_back(cast<AtomicCmpXchgInst>(I).
isWeak());
1954 case Instruction::AtomicRMW:
1959 cast<AtomicRMWInst>(I).getOperation()));
1960 Vals.push_back(cast<AtomicRMWInst>(I).
isVolatile());
1963 cast<AtomicRMWInst>(I).getSynchScope()));
1965 case Instruction::Fence:
1983 for (
unsigned i = 0, e = FTy->getNumParams(); i != e; ++i) {
1985 if (FTy->getParamType(i)->isLabelTy())
1992 if (FTy->isVarArg()) {
1999 case Instruction::VAArg:
2015 if (VST.
empty())
return;
2029 bool isChar6 =
true;
2034 if ((
unsigned char)*C & 128) {
2045 if (isa<BasicBlock>(
SI->getValue())) {
2063 Stream.
EmitRecord(Code, NameVals, AbbrevToUse);
2071 assert(Order.Shuffle.size() >= 2 &&
"Shuffle too small");
2073 if (isa<BasicBlock>(Order.V))
2086 "Expected to be preserving use-list order");
2088 auto hasMore = [&]() {
2118 unsigned CstStart, CstEnd;
2126 unsigned InstID = CstEnd;
2138 if (!
I->getType()->isVoidTy())
2142 NeedsMetadataAttachment |=
I->hasMetadataOtherThanDebugLoc();
2168 if (NeedsMetadataAttachment)
2353 bool ShouldPreserveUseListOrder) {
2357 unsigned CurVersion = 1;
2400 if (!
F->isDeclaration())
2425 uint32_t &Position) {
2439 DARWIN_CPU_ARCH_ABI64 = 0x01000000,
2440 DARWIN_CPU_TYPE_X86 = 7,
2441 DARWIN_CPU_TYPE_ARM = 12,
2442 DARWIN_CPU_TYPE_POWERPC = 18
2447 CPUType = DARWIN_CPU_TYPE_X86 | DARWIN_CPU_ARCH_ABI64;
2449 CPUType = DARWIN_CPU_TYPE_X86;
2451 CPUType = DARWIN_CPU_TYPE_POWERPC;
2453 CPUType = DARWIN_CPU_TYPE_POWERPC | DARWIN_CPU_ARCH_ABI64;
2455 CPUType = DARWIN_CPU_TYPE_ARM;
2459 "Expected header size to be reserved");
2464 unsigned Position = 0;
2472 while (Buffer.
size() & 15)
2479 bool ShouldPreserveUseListOrder) {
2486 if (TT.isOSDarwin())
2494 Stream.
Emit((
unsigned)
'B', 8);
2495 Stream.
Emit((
unsigned)
'C', 8);
2496 Stream.
Emit(0x0, 4);
2497 Stream.
Emit(0xC, 4);
2498 Stream.
Emit(0xE, 4);
2499 Stream.
Emit(0xD, 4);
2502 WriteModule(M, Stream, ShouldPreserveUseListOrder);
2505 if (TT.isOSDarwin())
MDString * getRawGetterName() const
static unsigned getBitWidth(Type *Ty, const DataLayout &DL)
Returns the bitwidth of the given scalar or pointer type (if unknown returns 0).
DISubprogramArray getSubprograms() const
const Value * getCalledValue() const
getCalledValue - Get a pointer to the function that is invoked by this instruction.
static unsigned GetEncodedSynchScope(SynchronizationScope SynchScope)
void push_back(const T &Elt)
unsigned Log2_32_Ceil(uint32_t Value)
Log2_32_Ceil - This function returns the ceil log base 2 of the specified value, 32 if the value is z...
static void WriteDIExpression(const DIExpression *N, const ValueEnumerator &, BitstreamWriter &Stream, SmallVectorImpl< uint64_t > &Record, unsigned Abbrev)
LinkageTypes getLinkage() const
This class provides a symbol table of name/value pairs.
const ComdatSetType & getComdats() const
CaseIt case_end()
Returns a read/write iterator that points one past the last in the SwitchInst.
const ValueSymbolTable & getValueSymbolTable() const
Get the symbol table of global variable and function identifiers.
static void WriteAttributeTable(const ValueEnumerator &VE, BitstreamWriter &Stream)
Special purpose, only applies to global arrays.
VisibilityTypes getVisibility() const
*p = old <signed v ? old : v
DILocalScope * getScope() const
iterator begin()
Get an iterator that from the beginning of the symbol table.
Alignment of stack for function (3 bits) stored as log2 of alignment with +1 bias 0 means unaligned (...
size_t size() const
size - Get the string size.
static uint64_t GetOptimizationFlags(const Value *V)
static void WriteFunction(const Function &F, ValueEnumerator &VE, BitstreamWriter &Stream)
WriteFunction - Emit a function body to the module stream.
Sign extended before/after call.
bool isOpaque() const
isOpaque - Return true if this is a type with an identity that has no body specified yet...
StringMapEntry - This is used to represent one value that is inserted into a StringMap.
static void WriteDISubprogram(const DISubprogram *N, const ValueEnumerator &VE, BitstreamWriter &Stream, SmallVectorImpl< uint64_t > &Record, unsigned Abbrev)
DITypeRef getType() const
Force argument to be passed in register.
static void WriteDICompileUnit(const DICompileUnit *N, const ValueEnumerator &VE, BitstreamWriter &Stream, SmallVectorImpl< uint64_t > &Record, unsigned Abbrev)
A Module instance is used to store all the information related to an LLVM module. ...
Constant * getClause(unsigned Idx) const
Get the value of the clause at index Idx.
unsigned getNumParams() const
getNumParams - Return the number of fixed parameters this function type requires. ...
Function is called early and/or often, so lazy binding isn't worthwhile.
2: 32-bit floating point type
Same, but only replaced by something equivalent.
static bool PushValueAndType(const Value *V, unsigned InstID, SmallVectorImpl< unsigned > &Vals, ValueEnumerator &VE)
PushValueAndType - The file has to encode both the value and type id for many values, because we need to know what type to create for forward references.
static void WriteModuleMetadata(const Module *M, const ValueEnumerator &VE, BitstreamWriter &Stream)
static unsigned getEncodedThreadLocalMode(const GlobalValue &GV)
static void writeComdats(const ValueEnumerator &VE, BitstreamWriter &Stream)
static void WriteStringRecord(unsigned Code, StringRef Str, unsigned AbbrevToUse, BitstreamWriter &Stream)
static void WriteDISubrange(const DISubrange *N, const ValueEnumerator &, BitstreamWriter &Stream, SmallVectorImpl< uint64_t > &Record, unsigned Abbrev)
DILocalScope * getScope() const
Get the local scope for this variable.
unsigned getNumOperands() const
Available for inspection, not emission.
MDString * getRawName() const
Nested function static chain.
unsigned getNumOperands() const
Return number of MDNode operands.
BitCodeAbbrev - This class represents an abbreviation record.
uint64_t getAlignInBits() const
CallInst - This class represents a function call, abstracting a target machine's calling convention...
void setInstructionID(const Instruction *I)
CaseIt case_begin()
Returns a read/write iterator that points to the first case in SwitchInst.
uint64_t getValueAsInt() const
Return the attribute's value as an integer.
*p = old <unsigned v ? old : v
Like Internal, but omit from symbol table.
Source said inlining was desirable.
*p = old >unsigned v ? old : v
Externally visible function.
const unsigned char * bytes_end() const
bool isDoubleTy() const
isDoubleTy - Return true if this is 'double', a 64-bit IEEE fp type.
void Add(const BitCodeAbbrevOp &OpInfo)
iterator begin(unsigned Slot) const
unsigned getEmissionKind() const
The data referenced by the COMDAT must be the same size.
static void WriteConstants(unsigned FirstVal, unsigned LastVal, const ValueEnumerator &VE, BitstreamWriter &Stream, bool isGlobal)
4: 80-bit floating point type (X87)
DINodeArray getElements() const
Get the elements of the composite type.
unsigned getAddressSpace() const
Return the address space of the Pointer type.
1: 16-bit floating point type
DIScope * getScope() const
std::vector< std::pair< const Value *, unsigned > > ValueList
void reserve(size_type N)
static void WriteDILocalVariable(const DILocalVariable *N, const ValueEnumerator &VE, BitstreamWriter &Stream, SmallVectorImpl< uint64_t > &Record, unsigned Abbrev)
*p = old >signed v ? old : v
const std::string & getTargetTriple() const
Get the target triple which is a string describing the target host.
void EmitRecord(unsigned Code, SmallVectorImpl< uintty > &Vals, unsigned Abbrev=0)
EmitRecord - Emit the specified record to the stream, using an abbrev if we have one to compress the ...
static void WriteModuleConstants(const ValueEnumerator &VE, BitstreamWriter &Stream)
unsigned getColumn() const
MDString * getRawName() const
void EnterBlockInfoBlock(unsigned CodeWidth)
EnterBlockInfoBlock - Start emitting the BLOCKINFO_BLOCK.
MDString * getRawName() const
MDString * getRawDirectory() const
void incorporateFunction(const Function &F)
incorporateFunction/purgeFunction - If you'd like to deal with a function, use these two methods to g...
element_iterator element_end() const
static void WriteDILexicalBlock(const DILexicalBlock *N, const ValueEnumerator &VE, BitstreamWriter &Stream, SmallVectorImpl< uint64_t > &Record, unsigned Abbrev)
void getMDKindNames(SmallVectorImpl< StringRef > &Result) const
Populate client supplied SmallVector with the name for custom metadata IDs registered in this LLVMCon...
BlockAddress - The address of a basic block.
static void pushValueSigned(const Value *V, unsigned InstID, SmallVectorImpl< uint64_t > &Vals, ValueEnumerator &VE)
StringRef getKindAsString() const
Return the attribute's kind as a string.
unsigned getComdatID(const Comdat *C) const
DIScope * getScope() const
Type::subtype_iterator element_iterator
bool hasGenericDINode() const
const unsigned char * bytes_end() const
StructType - Class to represent struct types.
MDString * getRawName() const
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
unsigned getNumArgOperands() const
getNumArgOperands - Return the number of call arguments.
static void WriteAttributeGroupTable(const ValueEnumerator &VE, BitstreamWriter &Stream)
const unsigned char * bytes_begin() const
const Value * getCalledValue() const
getCalledValue - Get a pointer to the function that is invoked by this instruction ...
bool isLiteral() const
isLiteral - Return true if this type is uniqued by structural equivalence, false if it is a struct de...
No attributes have been set.
void Emit(uint32_t Val, unsigned NumBits)
The linker may choose any COMDAT.
MDString * getRawFlags() const
DITypeArray getRetainedTypes() const
bool isMustTailCall() const
Function must be in a unwind table.
element_iterator element_begin() const
static ConstantInt * ExtractElement(Constant *V, Constant *Idx)
static const unsigned MaximumAlignment
uint64_t computeBitsRequiredForTypeIndicies() const
Function does not access memory.
Hidden pointer to structure to return.
DITypeRefArray getTypeArray() const
Function creates no aliases of pointer.
unsigned getAttributeID(AttributeSet PAL) const
ConstantExpr - a constant value that is initialized with an expression using other constant values...
FunctionType - Class to represent function types.
bool hasDILocation() const
DITemplateParameterArray getTemplateParams() const
const TypeList & getTypes() const
bool LLVM_ATTRIBUTE_UNUSED_RESULT empty() const
ConstantDataSequential - A vector or array constant whose element type is a simple 1/2/4/8-byte integ...
BinOp
This enumeration lists the possible modifications atomicrmw can make.
unsigned getInstructionID(const Instruction *I) const
static void WriteDIObjCProperty(const DIObjCProperty *N, const ValueEnumerator &VE, BitstreamWriter &Stream, SmallVectorImpl< uint64_t > &Record, unsigned Abbrev)
unsigned getValueID(const Value *V) const
bool isHalfTy() const
isHalfTy - Return true if this is 'half', a 16-bit IEEE fp type.
ArrayType - Class to represent array types.
static void WriteDIBasicType(const DIBasicType *N, const ValueEnumerator &VE, BitstreamWriter &Stream, SmallVectorImpl< uint64_t > &Record, unsigned Abbrev)
BasicBlock * getSuccessor(unsigned i) const
bool named_metadata_empty() const
TypeID getTypeID() const
getTypeID - Return the type id for the type.
DIScopeRef getScope() const
unsigned getNumClauses() const
getNumClauses - Get the number of clauses for this landing pad.
ArchType getArch() const
getArch - Get the parsed architecture type of this triple.
DITypeRef getVTableHolder() const
void getFunctionConstantRange(unsigned &Start, unsigned &End) const
getFunctionConstantRange - Return the range of values that corresponds to function-local constants...
iterator end()
Get an iterator to the end of the symbol table.
MDString * getRawName() const
unsigned getNumElements() const
Return the number of elements in the Vector type.
element_iterator elements_begin() const
Structure to hold a use-list order.
ValueSymbolTable & getValueSymbolTable()
getSymbolTable() - Return the symbol table...
DIScopeRef getScope() const
void EnterSubblock(unsigned BlockID, unsigned CodeLen)
bool isPPC_FP128Ty() const
isPPC_FP128Ty - Return true if this is powerpc long double.
Type * getElementType() const
size_t size() const
size - Get the array size.
Considered to not alias after call.
BasicBlock * getNormalDest() const
PointerType - Class to represent pointers.
DIScope * getScope() const
unsigned getNumIncomingValues() const
getNumIncomingValues - Return the number of incoming edges
static unsigned getEncodedLinkage(const GlobalValue &GV)
10: Arbitrary bit width integers
MDString * getRawName() const
unsigned getRuntimeVersion() const
static void WriteDISubroutineType(const DISubroutineType *N, const ValueEnumerator &VE, BitstreamWriter &Stream, SmallVectorImpl< uint64_t > &Record, unsigned Abbrev)
ExternalWeak linkage description.
const ValueList & getValues() const
bool shouldPreserveUseListOrder() const
Same, but only replaced by something equivalent.
const std::vector< AttributeSet > & getAttributes() const
unsigned getNumSlots() const
Return the number of slots used in this attribute list.
Type * getParamType(unsigned i) const
Parameter type accessors.
MDString * getRawSplitDebugFilename() const
DITypeRef getType() const
element_iterator elements_end() const
No other Module may specify this COMDAT.
unsigned getTypeID(Type *T) const
MDString * getRawFilename() const
LandingPadInst - The landingpad instruction holds all of the information necessary to generate correc...
unsigned EmitAbbrev(BitCodeAbbrev *Abbv)
EmitAbbrev - This emits an abbreviation to the stream.
static void WriteDILocation(const DILocation *N, const ValueEnumerator &VE, BitstreamWriter &Stream, SmallVectorImpl< uint64_t > &Record, unsigned Abbrev)
The instances of the Type class are immutable: once they are created, they are never changed...
static uint64_t getAttrKindEncoding(Attribute::AttrKind Kind)
BranchInst - Conditional or Unconditional Branch instruction.
AttributeSet getSlotAttributes(unsigned Slot) const
Return the attributes at the given slot.
This is an important base class in LLVM.
void WriteBitcodeToFile(const Module *M, raw_ostream &Out, bool ShouldPreserveUseListOrder=false)
Write the specified module to the specified raw output stream.
This file contains the declarations for the subclasses of Constant, which represent the different fla...
bool isLocalToUnit() const
bool isFloatTy() const
isFloatTy - Return true if this is 'float', a 32-bit IEEE fp type.
APInt Or(const APInt &LHS, const APInt &RHS)
Bitwise OR function for APInt.
static unsigned getEncodedDLLStorageClass(const GlobalValue &GV)
BitCodeAbbrevOp - This describes one or more operands in an abbreviation.
unsigned getAlignment() const
getAlignment - Return the alignment of the memory that is being allocated by the instruction.
ConstantFP - Floating Point Values [float, double].
APInt Xor(const APInt &LHS, const APInt &RHS)
Bitwise XOR function for APInt.
static void WriteMetadataAttachment(const Function &F, const ValueEnumerator &VE, BitstreamWriter &Stream)
unsigned getSourceLanguage() const
Return value is always equal to this argument.
iterator_range< named_metadata_iterator > named_metadata()
bool hasMetadata() const
Check if this has any metadata.
unsigned getAttributeGroupID(AttributeSet PAL) const
static void WriteBlockInfo(const ValueEnumerator &VE, BitstreamWriter &Stream)
unsigned EmitBlockInfoAbbrev(unsigned BlockID, BitCodeAbbrev *Abbv)
EmitBlockInfoAbbrev - Emit a DEFINE_ABBREV record for the specified BlockID.
Pass structure in an alloca.
static void WriteDIFile(const DIFile *N, const ValueEnumerator &VE, BitstreamWriter &Stream, SmallVectorImpl< uint64_t > &Record, unsigned Abbrev)
BasicBlock * getIncomingBlock(unsigned i) const
getIncomingBlock - Return incoming basic block number i.
bool isUsedWithInAlloca() const
Return true if this alloca is used as an inalloca argument to a call.
uint64_t getNumElements() const
6: 128-bit floating point type (two 64-bits, PowerPC)
Value * getOperand(unsigned i) const
Zero extended before/after call.
Metadata * getValue() const
static void EmitDarwinBCHeaderAndTrailer(SmallVectorImpl< char > &Buffer, const Triple &TT)
static void WriteDIDerivedType(const DIDerivedType *N, const ValueEnumerator &VE, BitstreamWriter &Stream, SmallVectorImpl< uint64_t > &Record, unsigned Abbrev)
unsigned getDWOId() const
unsigned getEncoding() const
SelectionKind getSelectionKind() const
Function doesn't unwind stack.
uint64_t getOffsetInBits() const
DITypeRef getBaseType() const
void write32le(void *p, uint32_t v)
The data referenced by the COMDAT must be the same.
unsigned getAttributes() const
bool isEnumAttribute() const
Return true if the attribute is an Attribute::AttrKind type.
Marks function as being in a cold path.
Sentinal value useful for loops.
static void WriteGenericDINode(const GenericDINode *N, const ValueEnumerator &VE, BitstreamWriter &Stream, SmallVectorImpl< uint64_t > &Record, unsigned Abbrev)
Mark the function as not returning.
static unsigned getEncodedComdatSelectionKind(const Comdat &C)
uint64_t getElementAsInteger(unsigned i) const
getElementAsInteger - If this is a sequential container of integers (of any size), return the specified element in the low bits of a uint64_t.
DINodeRef getEntity() const
void append(in_iter in_start, in_iter in_end)
Add the specified range to the end of the SmallVector.
bool isFP128Ty() const
isFP128Ty - Return true if this is 'fp128'.
FunctionType * getFunctionType() const
static bool isAtomic(Instruction *I)
static uint64_t rotateSign(int64_t I)
static unsigned GetEncodedRMWOperation(AtomicRMWInst::BinOp Op)
Call cannot be duplicated.
bool isCString() const
isCString - This method returns true if the array "isString", ends with a nul byte, and does not contains any other nul bytes.
Triple - Helper class for working with autoconf configuration names.
DITypeRef getType() const
Pointer is known to be not null.
FunctionType * getFunctionType() const
An imported module (C++ using directive or similar).
raw_ostream & write(unsigned char C)
CallingConv::ID getCallingConv() const
getCallingConv/setCallingConv - Get or set the calling convention of this function call...
static void WriteModuleInfo(const Module *M, const ValueEnumerator &VE, BitstreamWriter &Stream)
void dump() const
Support for debugging, callable in GDB: V->dump()
const std::vector< const Metadata * > & getMDs() const
const std::string & getModuleInlineAsm() const
Get any module-scope inline assembly blocks.
bool isConditional() const
ArrayRef< uint64_t > getElements() const
DIImportedEntityArray getImportedEntities() const
static void WriteInstruction(const Instruction &I, unsigned InstID, ValueEnumerator &VE, BitstreamWriter &Stream, SmallVectorImpl< unsigned > &Vals)
WriteInstruction - Emit an instruction to the specified stream.
const MDOperand & getOperand(unsigned I) const
static void emitSignedInt64(SmallVectorImpl< uint64_t > &Vals, uint64_t V)
BasicBlock * getUnwindDest() const
This is the shared class of boolean and integer constants.
static void WriteDIEnumerator(const DIEnumerator *N, const ValueEnumerator &VE, BitstreamWriter &Stream, SmallVectorImpl< uint64_t > &Record, unsigned Abbrev)
Value * getIncomingValue(unsigned i) const
getIncomingValue - Return incoming value number x
15: SIMD 'packed' format, or other vector type
static void WriteModule(const Module *M, BitstreamWriter &Stream, bool ShouldPreserveUseListOrder)
WriteModule - Emit the specified module to the bitstream.
static void WriteDIModule(const DIModule *N, const ValueEnumerator &VE, BitstreamWriter &Stream, SmallVectorImpl< uint64_t > &Record, unsigned Abbrev)
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small...
Keep one copy of function when linking (inline)
Module.h This file contains the declarations for the Module class.
Type * getType() const
All values are typed, get the type of this value.
const SmallVectorImpl< const LocalAsMetadata * > & getFunctionLocalMDs() const
Callee is recognized as a builtin, despite nobuiltin attribute on its declaration.
Attribute::AttrKind getKindAsEnum() const
Return the attribute's kind as an enum (Attribute::AttrKind).
iterator end(unsigned Slot) const
void getAllMetadata(SmallVectorImpl< std::pair< unsigned, MDNode * >> &MDs) const
Get all current metadata attachments.
MDString * getRawLinkageName() const
static void WriteTypeTable(const ValueEnumerator &VE, BitstreamWriter &Stream)
WriteTypeTable - Write out the type table for a module.
const std::vector< AttributeSet > & getAttributeGroups() const
bool isIntAttribute() const
Return true if the attribute is an integer attribute.
static void WriteMDTuple(const MDTuple *N, const ValueEnumerator &VE, BitstreamWriter &Stream, SmallVectorImpl< uint64_t > &Record, unsigned Abbrev)
static unsigned GetEncodedOrdering(AtomicOrdering Ordering)
const char * getKeyData() const
getKeyData - Return the start of the string data that is the key for this value.
The linker will choose the largest COMDAT.
const std::vector< const BasicBlock * > & getBasicBlocks() const
bool isNullValue() const
isNullValue - Return true if this is the value that would be returned by getNullValue.
unsigned Log2_32(uint32_t Value)
Log2_32 - This function returns the floor log base 2 of the specified value, -1 if the value is zero...
Alignment of parameter (5 bits) stored as log2 of alignment with +1 bias 0 means unaligned (different...
static void pushValue(const Value *V, unsigned InstID, SmallVectorImpl< unsigned > &Vals, ValueEnumerator &VE)
pushValue - Like PushValueAndType, but where the type of the value is omitted (perhaps it was already...
Value * getArgOperand(unsigned i) const
getArgOperand/setArgOperand - Return/set the i-th call argument.
VectorType - Class to represent vector types.
static void WriteDICompositeType(const DICompositeType *N, const ValueEnumerator &VE, BitstreamWriter &Stream, SmallVectorImpl< uint64_t > &Record, unsigned Abbrev)
Class for arbitrary precision integers.
unsigned getDiscriminator() const
unsigned getMetadataID(const Metadata *MD) const
static bool isWeak(const MCSymbolELF &Sym)
A (clang) module that has been imported by the compile unit.
Function must not be optimized.
StringRef getName() const
getName - Return the name for this struct type if it has an identity.
Function only reads from memory.
UseListOrderStack UseListOrders
MDString * getRawIdentifier() const
Generic tagged DWARF-like metadata node.
Value * getCondition() const
iterator insert(iterator I, T &&Elt)
const AttributeSet & getAttributes() const
getAttributes - Return the parameter attributes for this call.
static void WriteUseListBlock(const Function *F, ValueEnumerator &VE, BitstreamWriter &Stream)
APInt And(const APInt &LHS, const APInt &RHS)
Bitwise AND function for APInt.
unsigned getMetadataOrNullID(const Metadata *MD) const
Metadata * getRawVariable() const
ThreadLocalMode getThreadLocalMode() const
static void WriteDIImportedEntity(const DIImportedEntity *N, const ValueEnumerator &VE, BitstreamWriter &Stream, SmallVectorImpl< uint64_t > &Record, unsigned Abbrev)
Type array for a subprogram.
static MDTuple * get(LLVMContext &Context, ArrayRef< Metadata * > MDs)
unsigned getRuntimeLang() const
static void WriteUseList(ValueEnumerator &VE, UseListOrder &&Order, BitstreamWriter &Stream)
Function to be accessible from DLL.
static void WriteDIGlobalVariable(const DIGlobalVariable *N, const ValueEnumerator &VE, BitstreamWriter &Stream, SmallVectorImpl< uint64_t > &Record, unsigned Abbrev)
Value * getCondition() const
const AttributeSet & getAttributes() const
getAttributes - Return the parameter attributes for this invoke.
bool isX86_FP80Ty() const
isX86_FP80Ty - Return true if this is x86 long double.
ValID - Represents a reference of a definition of some sort with no type.
BasicBlock * getDefaultDest() const
static unsigned GetEncodedBinaryOpcode(unsigned Opcode)
static void WriteDITemplateValueParameter(const DITemplateValueParameter *N, const ValueEnumerator &VE, BitstreamWriter &Stream, SmallVectorImpl< uint64_t > &Record, unsigned Abbrev)
static void WriteDINamespace(const DINamespace *N, const ValueEnumerator &VE, BitstreamWriter &Stream, SmallVectorImpl< uint64_t > &Record, unsigned Abbrev)
const uint64_t * getRawData() const
This function returns a pointer to the internal storage of the APInt.
unsigned getSlotIndex(unsigned Slot) const
Return the index for the given slot.
Callee isn't recognized as a builtin.
bool isCatch(unsigned Idx) const
isCatch - Return 'true' if the clause and index Idx is a catch clause.
bool empty() const
Determine if the symbol table is empty.
unsigned getKeyLength() const
unsigned getNumElements() const
getNumElements - Return the number of elements in the array or vector.
uint64_t getSizeInBits() const
Keep one copy of named function when linking (weak)
Rename collisions when linking (static functions).
op_range operands() const
static bool isChar6(char C)
isChar6 - Return true if this character is legal in the Char6 encoding.
static void WriteValueSymbolTable(const ValueSymbolTable &VST, const ValueEnumerator &VE, BitstreamWriter &Stream)
static void WriteDITemplateTypeParameter(const DITemplateTypeParameter *N, const ValueEnumerator &VE, BitstreamWriter &Stream, SmallVectorImpl< uint64_t > &Record, unsigned Abbrev)
Function to be imported from DLL.
Funciton can access memory only using pointers based on its arguments.
3: 64-bit floating point type
SwitchInst - Multiway switch.
StringRef getValueAsString() const
Return the attribute's value as a string.
Type * getReturnType() const
Function can return twice.
unsigned getFlags() const
unsigned getGlobalBasicBlockID(const BasicBlock *BB) const
getGlobalBasicBlockID - This returns the function-specific ID for the specified basic block...
const ARM::ArchExtKind Kind
MDString * getRawName() const
const unsigned char * bytes_begin() const
DICompositeTypeArray getEnumTypes() const
Pointer is known to be dereferenceable.
LLVM Value Representation.
DIDerivedType * getStaticDataMemberDeclaration() const
unsigned getOpcode() const
getOpcode() returns a member of one of the enums like Instruction::Add.
Disable implicit floating point insts.
static void WriteDILexicalBlockFile(const DILexicalBlockFile *N, const ValueEnumerator &VE, BitstreamWriter &Stream, SmallVectorImpl< uint64_t > &Record, unsigned Abbrev)
DLLStorageClassTypes getDLLStorageClass() const
bool isUInt< 16 >(uint64_t x)
bool isDefinition() const
This class implements an extremely fast bulk output stream that can only output to a stream...
InvokeInst - Invoke instruction.
std::vector< Type * > TypeList
bool isCleanup() const
isCleanup - Return 'true' if this landingpad instruction is a cleanup.
iterator_range< global_iterator > globals()
C - The default llvm calling convention, compatible with C.
StringRef - Represent a constant reference to a string, i.e.
CallingConv::ID getCallingConv() const
getCallingConv/setCallingConv - Get or set the calling convention of this function call...
const std::string & getDataLayoutStr() const
Get the data layout string for the module's target platform.
int64_t getLowerBound() const
MDString * getRawSetterName() const
static void WriteInt32ToBuffer(uint32_t Value, SmallVectorImpl< char > &Buffer, uint32_t &Position)
static bool isVolatile(Instruction *Inst)
unsigned getFlags() const
9: MMX vectors (64 bits, X86 specific)
DIGlobalVariableArray getGlobalVariables() const
Type * getAllocatedType() const
getAllocatedType - Return the type that is being allocated by the instruction.
Can only be moved to control-equivalent blocks.
Stack protection required.
Build jump-instruction tables and replace refs.
Pointer is either null or dereferenceable.
static unsigned GetEncodedCastOpcode(unsigned Opcode)
MDString * getRawProducer() const
AllocaInst - an instruction to allocate memory on the stack.
InsertValueInst - This instruction inserts a struct field of array element value into an aggregate va...
static void WriteModuleMetadataStore(const Module *M, BitstreamWriter &Stream)
AttrKind
This enumeration lists the attributes that can be associated with parameters, function results...
bool empty() const
empty - Check if the string is empty.
5: 128-bit floating point type (112-bit mantissa)
Basic type, like 'int' or 'float'.
static unsigned getEncodedVisibility(const GlobalValue &GV)
static void WriteValueAsMetadata(const ValueAsMetadata *MD, const ValueEnumerator &VE, BitstreamWriter &Stream, SmallVectorImpl< uint64_t > &Record)
static void WriteFunctionLocalMetadata(const Function &F, const ValueEnumerator &VE, BitstreamWriter &Stream)
Function must be optimized for size first.