forked from OSchip/llvm-project
eliminate some uses of AsmPrinter::EmitIntXXX
llvm-svn: 93996
This commit is contained in:
parent
ab62196c9d
commit
71601e8b3b
|
@ -1086,8 +1086,7 @@ static void EmitGlobalConstantArray(const ConstantArray *CA, unsigned AddrSpace,
|
||||||
|
|
||||||
static void EmitGlobalConstantVector(const ConstantVector *CV,
|
static void EmitGlobalConstantVector(const ConstantVector *CV,
|
||||||
unsigned AddrSpace, AsmPrinter &AP) {
|
unsigned AddrSpace, AsmPrinter &AP) {
|
||||||
const VectorType *VTy = CV->getType();
|
for (unsigned i = 0, e = CV->getType()->getNumElements(); i != e; ++i)
|
||||||
for (unsigned i = 0, e = VTy->getNumElements(); i != e; ++i)
|
|
||||||
AP.EmitGlobalConstant(CV->getOperand(i), AddrSpace);
|
AP.EmitGlobalConstant(CV->getOperand(i), AddrSpace);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1099,16 +1098,16 @@ static void EmitGlobalConstantStruct(const ConstantStruct *CS,
|
||||||
const StructLayout *Layout = TD->getStructLayout(CS->getType());
|
const StructLayout *Layout = TD->getStructLayout(CS->getType());
|
||||||
uint64_t SizeSoFar = 0;
|
uint64_t SizeSoFar = 0;
|
||||||
for (unsigned i = 0, e = CS->getNumOperands(); i != e; ++i) {
|
for (unsigned i = 0, e = CS->getNumOperands(); i != e; ++i) {
|
||||||
const Constant *field = CS->getOperand(i);
|
const Constant *Field = CS->getOperand(i);
|
||||||
|
|
||||||
// Check if padding is needed and insert one or more 0s.
|
// Check if padding is needed and insert one or more 0s.
|
||||||
uint64_t FieldSize = TD->getTypeAllocSize(field->getType());
|
uint64_t FieldSize = TD->getTypeAllocSize(Field->getType());
|
||||||
uint64_t PadSize = ((i == e-1 ? Size : Layout->getElementOffset(i+1))
|
uint64_t PadSize = ((i == e-1 ? Size : Layout->getElementOffset(i+1))
|
||||||
- Layout->getElementOffset(i)) - FieldSize;
|
- Layout->getElementOffset(i)) - FieldSize;
|
||||||
SizeSoFar += FieldSize + PadSize;
|
SizeSoFar += FieldSize + PadSize;
|
||||||
|
|
||||||
// Now print the actual field value.
|
// Now print the actual field value.
|
||||||
AP.EmitGlobalConstant(field, AddrSpace);
|
AP.EmitGlobalConstant(Field, AddrSpace);
|
||||||
|
|
||||||
// Insert padding - this may include padding to increase the size of the
|
// Insert padding - this may include padding to increase the size of the
|
||||||
// current field up to the ABI size (if the struct is not packed) as well
|
// current field up to the ABI size (if the struct is not packed) as well
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
#include "llvm/ADT/Twine.h"
|
#include "llvm/ADT/Twine.h"
|
||||||
#include "llvm/CodeGen/AsmPrinter.h"
|
#include "llvm/CodeGen/AsmPrinter.h"
|
||||||
#include "llvm/MC/MCAsmInfo.h"
|
#include "llvm/MC/MCAsmInfo.h"
|
||||||
|
#include "llvm/MC/MCStreamer.h"
|
||||||
#include "llvm/MC/MCSymbol.h"
|
#include "llvm/MC/MCSymbol.h"
|
||||||
#include "llvm/Target/TargetData.h"
|
#include "llvm/Target/TargetData.h"
|
||||||
#include "llvm/Support/Debug.h"
|
#include "llvm/Support/Debug.h"
|
||||||
|
@ -186,20 +187,22 @@ void DIEValue::dump() {
|
||||||
///
|
///
|
||||||
void DIEInteger::EmitValue(Dwarf *D, unsigned Form) const {
|
void DIEInteger::EmitValue(Dwarf *D, unsigned Form) const {
|
||||||
const AsmPrinter *Asm = D->getAsm();
|
const AsmPrinter *Asm = D->getAsm();
|
||||||
|
unsigned Size = ~0U;
|
||||||
switch (Form) {
|
switch (Form) {
|
||||||
case dwarf::DW_FORM_flag: // Fall thru
|
case dwarf::DW_FORM_flag: // Fall thru
|
||||||
case dwarf::DW_FORM_ref1: // Fall thru
|
case dwarf::DW_FORM_ref1: // Fall thru
|
||||||
case dwarf::DW_FORM_data1: Asm->EmitInt8(Integer); break;
|
case dwarf::DW_FORM_data1: Size = 1; break;
|
||||||
case dwarf::DW_FORM_ref2: // Fall thru
|
case dwarf::DW_FORM_ref2: // Fall thru
|
||||||
case dwarf::DW_FORM_data2: Asm->EmitInt16(Integer); break;
|
case dwarf::DW_FORM_data2: Size = 2; break;
|
||||||
case dwarf::DW_FORM_ref4: // Fall thru
|
case dwarf::DW_FORM_ref4: // Fall thru
|
||||||
case dwarf::DW_FORM_data4: Asm->EmitInt32(Integer); break;
|
case dwarf::DW_FORM_data4: Size = 4; break;
|
||||||
case dwarf::DW_FORM_ref8: // Fall thru
|
case dwarf::DW_FORM_ref8: // Fall thru
|
||||||
case dwarf::DW_FORM_data8: Asm->EmitInt64(Integer); break;
|
case dwarf::DW_FORM_data8: Size = 8; break;
|
||||||
case dwarf::DW_FORM_udata: Asm->EmitULEB128Bytes(Integer); break;
|
case dwarf::DW_FORM_udata: Asm->EmitULEB128Bytes(Integer); return;
|
||||||
case dwarf::DW_FORM_sdata: Asm->EmitSLEB128Bytes(Integer); break;
|
case dwarf::DW_FORM_sdata: Asm->EmitSLEB128Bytes(Integer); return;
|
||||||
default: llvm_unreachable("DIE Value form not supported yet");
|
default: llvm_unreachable("DIE Value form not supported yet");
|
||||||
}
|
}
|
||||||
|
Asm->OutStreamer.EmitIntValue(Integer, Size, 0/*addrspace*/);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// SizeOf - Determine size of integer value in bytes.
|
/// SizeOf - Determine size of integer value in bytes.
|
||||||
|
|
|
@ -119,7 +119,7 @@ void DwarfException::EmitCIE(const Function *PersonalityFn, unsigned Index) {
|
||||||
|
|
||||||
// EH frame header.
|
// EH frame header.
|
||||||
EmitLabel("eh_frame_common_begin", Index);
|
EmitLabel("eh_frame_common_begin", Index);
|
||||||
Asm->EmitInt32((int)0);
|
Asm->OutStreamer.EmitIntValue(0, 4/*size*/, 0/*addrspace*/);
|
||||||
Asm->EOL("CIE Identifier Tag");
|
Asm->EOL("CIE Identifier Tag");
|
||||||
Asm->EmitInt8(dwarf::DW_CIE_VERSION);
|
Asm->EmitInt8(dwarf::DW_CIE_VERSION);
|
||||||
Asm->EOL("CIE Version");
|
Asm->EOL("CIE Version");
|
||||||
|
@ -281,7 +281,6 @@ void DwarfException::EmitFDE(const FunctionEHFrameInfo &EHFrameInfo) {
|
||||||
// If there is a personality and landing pads then point to the language
|
// If there is a personality and landing pads then point to the language
|
||||||
// specific data area in the exception table.
|
// specific data area in the exception table.
|
||||||
if (MMI->getPersonalities()[0] != NULL) {
|
if (MMI->getPersonalities()[0] != NULL) {
|
||||||
bool is4Byte = TD->getPointerSize() == sizeof(int32_t);
|
|
||||||
|
|
||||||
if (Asm->TM.getLSDAEncoding() != DwarfLSDAEncoding::EightByte) {
|
if (Asm->TM.getLSDAEncoding() != DwarfLSDAEncoding::EightByte) {
|
||||||
Asm->EmitULEB128Bytes(4);
|
Asm->EmitULEB128Bytes(4);
|
||||||
|
@ -290,18 +289,16 @@ void DwarfException::EmitFDE(const FunctionEHFrameInfo &EHFrameInfo) {
|
||||||
if (EHFrameInfo.hasLandingPads)
|
if (EHFrameInfo.hasLandingPads)
|
||||||
EmitReference("exception", EHFrameInfo.Number, true, true);
|
EmitReference("exception", EHFrameInfo.Number, true, true);
|
||||||
else
|
else
|
||||||
Asm->EmitInt32((int)0);
|
Asm->OutStreamer.EmitIntValue(0, 4/*size*/, 0/*addrspace*/);
|
||||||
} else {
|
} else {
|
||||||
Asm->EmitULEB128Bytes(is4Byte ? 4 : 8);
|
Asm->EmitULEB128Bytes(TD->getPointerSize());
|
||||||
Asm->EOL("Augmentation size");
|
Asm->EOL("Augmentation size");
|
||||||
|
|
||||||
if (EHFrameInfo.hasLandingPads) {
|
if (EHFrameInfo.hasLandingPads) {
|
||||||
EmitReference("exception", EHFrameInfo.Number, true, false);
|
EmitReference("exception", EHFrameInfo.Number, true, false);
|
||||||
} else {
|
} else {
|
||||||
if (is4Byte)
|
Asm->OutStreamer.EmitIntValue(0, TD->getPointerSize(),
|
||||||
Asm->EmitInt32((int)0);
|
0/*addrspace*/);
|
||||||
else
|
|
||||||
Asm->EmitInt64((int)0);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -885,7 +882,7 @@ void DwarfException::EmitExceptionTable() {
|
||||||
// Offset of the landing pad, counted in 16-byte bundles relative to the
|
// Offset of the landing pad, counted in 16-byte bundles relative to the
|
||||||
// @LPStart address.
|
// @LPStart address.
|
||||||
if (!S.PadLabel)
|
if (!S.PadLabel)
|
||||||
Asm->EmitInt32(0);
|
Asm->OutStreamer.EmitIntValue(0, 4/*size*/, 0/*addrspace*/);
|
||||||
else
|
else
|
||||||
EmitSectionOffset("label", "eh_func_begin", S.PadLabel, SubprogramCount,
|
EmitSectionOffset("label", "eh_func_begin", S.PadLabel, SubprogramCount,
|
||||||
true, true);
|
true, true);
|
||||||
|
|
Loading…
Reference in New Issue