mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-08 06:32:24 +00:00
Update function names to conform to guidelines. No functional change intended.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@163401 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
a7390fadba
commit
c53ade2889
@ -481,9 +481,8 @@ void AsmPrinter::EmitFunctionEntryLabel() {
|
||||
"' label emitted multiple times to assembly file");
|
||||
}
|
||||
|
||||
|
||||
/// EmitComments - Pretty-print comments for instructions.
|
||||
static void EmitComments(const MachineInstr &MI, raw_ostream &CommentOS) {
|
||||
/// emitComments - Pretty-print comments for instructions.
|
||||
static void emitComments(const MachineInstr &MI, raw_ostream &CommentOS) {
|
||||
const MachineFunction *MF = MI.getParent()->getParent();
|
||||
const TargetMachine &TM = MF->getTarget();
|
||||
|
||||
@ -518,16 +517,16 @@ static void EmitComments(const MachineInstr &MI, raw_ostream &CommentOS) {
|
||||
CommentOS << " Reload Reuse\n";
|
||||
}
|
||||
|
||||
/// EmitImplicitDef - This method emits the specified machine instruction
|
||||
/// emitImplicitDef - This method emits the specified machine instruction
|
||||
/// that is an implicit def.
|
||||
static void EmitImplicitDef(const MachineInstr *MI, AsmPrinter &AP) {
|
||||
static void emitImplicitDef(const MachineInstr *MI, AsmPrinter &AP) {
|
||||
unsigned RegNo = MI->getOperand(0).getReg();
|
||||
AP.OutStreamer.AddComment(Twine("implicit-def: ") +
|
||||
AP.TM.getRegisterInfo()->getName(RegNo));
|
||||
AP.OutStreamer.AddBlankLine();
|
||||
}
|
||||
|
||||
static void EmitKill(const MachineInstr *MI, AsmPrinter &AP) {
|
||||
static void emitKill(const MachineInstr *MI, AsmPrinter &AP) {
|
||||
std::string Str = "kill:";
|
||||
for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) {
|
||||
const MachineOperand &Op = MI->getOperand(i);
|
||||
@ -540,10 +539,10 @@ static void EmitKill(const MachineInstr *MI, AsmPrinter &AP) {
|
||||
AP.OutStreamer.AddBlankLine();
|
||||
}
|
||||
|
||||
/// EmitDebugValueComment - This method handles the target-independent form
|
||||
/// 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.
|
||||
static bool EmitDebugValueComment(const MachineInstr *MI, AsmPrinter &AP) {
|
||||
static bool emitDebugValueComment(const MachineInstr *MI, AsmPrinter &AP) {
|
||||
// This code handles only the 3-operand target-independent form.
|
||||
if (MI->getNumOperands() != 3)
|
||||
return false;
|
||||
@ -673,7 +672,7 @@ void AsmPrinter::EmitFunctionBody() {
|
||||
}
|
||||
|
||||
if (isVerbose())
|
||||
EmitComments(*II, OutStreamer.GetCommentOS());
|
||||
emitComments(*II, OutStreamer.GetCommentOS());
|
||||
|
||||
switch (II->getOpcode()) {
|
||||
case TargetOpcode::PROLOG_LABEL:
|
||||
@ -689,15 +688,15 @@ void AsmPrinter::EmitFunctionBody() {
|
||||
break;
|
||||
case TargetOpcode::DBG_VALUE:
|
||||
if (isVerbose()) {
|
||||
if (!EmitDebugValueComment(II, *this))
|
||||
if (!emitDebugValueComment(II, *this))
|
||||
EmitInstruction(II);
|
||||
}
|
||||
break;
|
||||
case TargetOpcode::IMPLICIT_DEF:
|
||||
if (isVerbose()) EmitImplicitDef(II, *this);
|
||||
if (isVerbose()) emitImplicitDef(II, *this);
|
||||
break;
|
||||
case TargetOpcode::KILL:
|
||||
if (isVerbose()) EmitKill(II, *this);
|
||||
if (isVerbose()) emitKill(II, *this);
|
||||
break;
|
||||
default:
|
||||
if (!TM.hasMCUseLoc())
|
||||
@ -1421,9 +1420,9 @@ void AsmPrinter::EmitAlignment(unsigned NumBits, const GlobalValue *GV) const {
|
||||
// Constant emission.
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
/// LowerConstant - Lower the specified LLVM Constant to an MCExpr.
|
||||
/// lowerConstant - Lower the specified LLVM Constant to an MCExpr.
|
||||
///
|
||||
static const MCExpr *LowerConstant(const Constant *CV, AsmPrinter &AP) {
|
||||
static const MCExpr *lowerConstant(const Constant *CV, AsmPrinter &AP) {
|
||||
MCContext &Ctx = AP.OutContext;
|
||||
|
||||
if (CV->isNullValue() || isa<UndefValue>(CV))
|
||||
@ -1451,7 +1450,7 @@ static const MCExpr *LowerConstant(const Constant *CV, AsmPrinter &AP) {
|
||||
if (Constant *C =
|
||||
ConstantFoldConstantExpression(CE, AP.TM.getTargetData()))
|
||||
if (C != CE)
|
||||
return LowerConstant(C, AP);
|
||||
return lowerConstant(C, AP);
|
||||
|
||||
// Otherwise report the problem to the user.
|
||||
{
|
||||
@ -1469,7 +1468,7 @@ static const MCExpr *LowerConstant(const Constant *CV, AsmPrinter &AP) {
|
||||
SmallVector<Value*, 8> IdxVec(CE->op_begin()+1, CE->op_end());
|
||||
int64_t Offset = TD.getIndexedOffset(PtrVal->getType(), IdxVec);
|
||||
|
||||
const MCExpr *Base = LowerConstant(CE->getOperand(0), AP);
|
||||
const MCExpr *Base = lowerConstant(CE->getOperand(0), AP);
|
||||
if (Offset == 0)
|
||||
return Base;
|
||||
|
||||
@ -1489,7 +1488,7 @@ static const MCExpr *LowerConstant(const Constant *CV, AsmPrinter &AP) {
|
||||
// is reasonable to treat their delta as a 32-bit value.
|
||||
// FALL THROUGH.
|
||||
case Instruction::BitCast:
|
||||
return LowerConstant(CE->getOperand(0), AP);
|
||||
return lowerConstant(CE->getOperand(0), AP);
|
||||
|
||||
case Instruction::IntToPtr: {
|
||||
const TargetData &TD = *AP.TM.getTargetData();
|
||||
@ -1498,7 +1497,7 @@ static const MCExpr *LowerConstant(const Constant *CV, AsmPrinter &AP) {
|
||||
Constant *Op = CE->getOperand(0);
|
||||
Op = ConstantExpr::getIntegerCast(Op, TD.getIntPtrType(CV->getContext()),
|
||||
false/*ZExt*/);
|
||||
return LowerConstant(Op, AP);
|
||||
return lowerConstant(Op, AP);
|
||||
}
|
||||
|
||||
case Instruction::PtrToInt: {
|
||||
@ -1508,7 +1507,7 @@ static const MCExpr *LowerConstant(const Constant *CV, AsmPrinter &AP) {
|
||||
Constant *Op = CE->getOperand(0);
|
||||
Type *Ty = CE->getType();
|
||||
|
||||
const MCExpr *OpExpr = LowerConstant(Op, AP);
|
||||
const MCExpr *OpExpr = lowerConstant(Op, AP);
|
||||
|
||||
// We can emit the pointer value into this slot if the slot is an
|
||||
// integer slot equal to the size of the pointer.
|
||||
@ -1534,8 +1533,8 @@ static const MCExpr *LowerConstant(const Constant *CV, AsmPrinter &AP) {
|
||||
case Instruction::And:
|
||||
case Instruction::Or:
|
||||
case Instruction::Xor: {
|
||||
const MCExpr *LHS = LowerConstant(CE->getOperand(0), AP);
|
||||
const MCExpr *RHS = LowerConstant(CE->getOperand(1), AP);
|
||||
const MCExpr *LHS = lowerConstant(CE->getOperand(0), AP);
|
||||
const MCExpr *RHS = lowerConstant(CE->getOperand(1), AP);
|
||||
switch (CE->getOpcode()) {
|
||||
default: llvm_unreachable("Unknown binary operator constant cast expr");
|
||||
case Instruction::Add: return MCBinaryExpr::CreateAdd(LHS, RHS, Ctx);
|
||||
@ -1552,7 +1551,7 @@ static const MCExpr *LowerConstant(const Constant *CV, AsmPrinter &AP) {
|
||||
}
|
||||
}
|
||||
|
||||
static void EmitGlobalConstantImpl(const Constant *C, unsigned AddrSpace,
|
||||
static void emitGlobalConstantImpl(const Constant *C, unsigned AddrSpace,
|
||||
AsmPrinter &AP);
|
||||
|
||||
/// isRepeatedByteSequence - Determine whether the given value is
|
||||
@ -1614,7 +1613,7 @@ static int isRepeatedByteSequence(const Value *V, TargetMachine &TM) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
static void EmitGlobalConstantDataSequential(const ConstantDataSequential *CDS,
|
||||
static void emitGlobalConstantDataSequential(const ConstantDataSequential *CDS,
|
||||
unsigned AddrSpace,AsmPrinter &AP){
|
||||
|
||||
// See if we can aggregate this into a .fill, if so, emit it as such.
|
||||
@ -1679,7 +1678,7 @@ static void EmitGlobalConstantDataSequential(const ConstantDataSequential *CDS,
|
||||
|
||||
}
|
||||
|
||||
static void EmitGlobalConstantArray(const ConstantArray *CA, unsigned AddrSpace,
|
||||
static void emitGlobalConstantArray(const ConstantArray *CA, unsigned AddrSpace,
|
||||
AsmPrinter &AP) {
|
||||
// See if we can aggregate some values. Make sure it can be
|
||||
// represented as a series of bytes of the constant value.
|
||||
@ -1691,14 +1690,14 @@ static void EmitGlobalConstantArray(const ConstantArray *CA, unsigned AddrSpace,
|
||||
}
|
||||
else {
|
||||
for (unsigned i = 0, e = CA->getNumOperands(); i != e; ++i)
|
||||
EmitGlobalConstantImpl(CA->getOperand(i), AddrSpace, AP);
|
||||
emitGlobalConstantImpl(CA->getOperand(i), AddrSpace, AP);
|
||||
}
|
||||
}
|
||||
|
||||
static void EmitGlobalConstantVector(const ConstantVector *CV,
|
||||
static void emitGlobalConstantVector(const ConstantVector *CV,
|
||||
unsigned AddrSpace, AsmPrinter &AP) {
|
||||
for (unsigned i = 0, e = CV->getType()->getNumElements(); i != e; ++i)
|
||||
EmitGlobalConstantImpl(CV->getOperand(i), AddrSpace, AP);
|
||||
emitGlobalConstantImpl(CV->getOperand(i), AddrSpace, AP);
|
||||
|
||||
const TargetData &TD = *AP.TM.getTargetData();
|
||||
unsigned Size = TD.getTypeAllocSize(CV->getType());
|
||||
@ -1708,7 +1707,7 @@ static void EmitGlobalConstantVector(const ConstantVector *CV,
|
||||
AP.OutStreamer.EmitZeros(Padding, AddrSpace);
|
||||
}
|
||||
|
||||
static void EmitGlobalConstantStruct(const ConstantStruct *CS,
|
||||
static void emitGlobalConstantStruct(const ConstantStruct *CS,
|
||||
unsigned AddrSpace, AsmPrinter &AP) {
|
||||
// Print the fields in successive locations. Pad to align if needed!
|
||||
const TargetData *TD = AP.TM.getTargetData();
|
||||
@ -1725,7 +1724,7 @@ static void EmitGlobalConstantStruct(const ConstantStruct *CS,
|
||||
SizeSoFar += FieldSize + PadSize;
|
||||
|
||||
// Now print the actual field value.
|
||||
EmitGlobalConstantImpl(Field, AddrSpace, AP);
|
||||
emitGlobalConstantImpl(Field, AddrSpace, AP);
|
||||
|
||||
// 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
|
||||
@ -1736,7 +1735,7 @@ static void EmitGlobalConstantStruct(const ConstantStruct *CS,
|
||||
"Layout of constant struct may be incorrect!");
|
||||
}
|
||||
|
||||
static void EmitGlobalConstantFP(const ConstantFP *CFP, unsigned AddrSpace,
|
||||
static void emitGlobalConstantFP(const ConstantFP *CFP, unsigned AddrSpace,
|
||||
AsmPrinter &AP) {
|
||||
if (CFP->getType()->isHalfTy()) {
|
||||
if (AP.isVerbose()) {
|
||||
@ -1821,7 +1820,7 @@ static void EmitGlobalConstantFP(const ConstantFP *CFP, unsigned AddrSpace,
|
||||
}
|
||||
}
|
||||
|
||||
static void EmitGlobalConstantLargeInt(const ConstantInt *CI,
|
||||
static void emitGlobalConstantLargeInt(const ConstantInt *CI,
|
||||
unsigned AddrSpace, AsmPrinter &AP) {
|
||||
const TargetData *TD = AP.TM.getTargetData();
|
||||
unsigned BitWidth = CI->getBitWidth();
|
||||
@ -1837,7 +1836,7 @@ static void EmitGlobalConstantLargeInt(const ConstantInt *CI,
|
||||
}
|
||||
}
|
||||
|
||||
static void EmitGlobalConstantImpl(const Constant *CV, unsigned AddrSpace,
|
||||
static void emitGlobalConstantImpl(const Constant *CV, unsigned AddrSpace,
|
||||
AsmPrinter &AP) {
|
||||
const TargetData *TD = AP.TM.getTargetData();
|
||||
uint64_t Size = TD->getTypeAllocSize(CV->getType());
|
||||
@ -1856,13 +1855,13 @@ static void EmitGlobalConstantImpl(const Constant *CV, unsigned AddrSpace,
|
||||
AP.OutStreamer.EmitIntValue(CI->getZExtValue(), Size, AddrSpace);
|
||||
return;
|
||||
default:
|
||||
EmitGlobalConstantLargeInt(CI, AddrSpace, AP);
|
||||
emitGlobalConstantLargeInt(CI, AddrSpace, AP);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (const ConstantFP *CFP = dyn_cast<ConstantFP>(CV))
|
||||
return EmitGlobalConstantFP(CFP, AddrSpace, AP);
|
||||
return emitGlobalConstantFP(CFP, AddrSpace, AP);
|
||||
|
||||
if (isa<ConstantPointerNull>(CV)) {
|
||||
AP.OutStreamer.EmitIntValue(0, Size, AddrSpace);
|
||||
@ -1870,19 +1869,19 @@ static void EmitGlobalConstantImpl(const Constant *CV, unsigned AddrSpace,
|
||||
}
|
||||
|
||||
if (const ConstantDataSequential *CDS = dyn_cast<ConstantDataSequential>(CV))
|
||||
return EmitGlobalConstantDataSequential(CDS, AddrSpace, AP);
|
||||
return emitGlobalConstantDataSequential(CDS, AddrSpace, AP);
|
||||
|
||||
if (const ConstantArray *CVA = dyn_cast<ConstantArray>(CV))
|
||||
return EmitGlobalConstantArray(CVA, AddrSpace, AP);
|
||||
return emitGlobalConstantArray(CVA, AddrSpace, AP);
|
||||
|
||||
if (const ConstantStruct *CVS = dyn_cast<ConstantStruct>(CV))
|
||||
return EmitGlobalConstantStruct(CVS, AddrSpace, AP);
|
||||
return emitGlobalConstantStruct(CVS, AddrSpace, AP);
|
||||
|
||||
if (const ConstantExpr *CE = dyn_cast<ConstantExpr>(CV)) {
|
||||
// Look through bitcasts, which might not be able to be MCExpr'ized (e.g. of
|
||||
// vectors).
|
||||
if (CE->getOpcode() == Instruction::BitCast)
|
||||
return EmitGlobalConstantImpl(CE->getOperand(0), AddrSpace, AP);
|
||||
return emitGlobalConstantImpl(CE->getOperand(0), AddrSpace, AP);
|
||||
|
||||
if (Size > 8) {
|
||||
// If the constant expression's size is greater than 64-bits, then we have
|
||||
@ -1890,23 +1889,23 @@ static void EmitGlobalConstantImpl(const Constant *CV, unsigned AddrSpace,
|
||||
// that way.
|
||||
Constant *New = ConstantFoldConstantExpression(CE, TD);
|
||||
if (New && New != CE)
|
||||
return EmitGlobalConstantImpl(New, AddrSpace, AP);
|
||||
return emitGlobalConstantImpl(New, AddrSpace, AP);
|
||||
}
|
||||
}
|
||||
|
||||
if (const ConstantVector *V = dyn_cast<ConstantVector>(CV))
|
||||
return EmitGlobalConstantVector(V, AddrSpace, AP);
|
||||
return emitGlobalConstantVector(V, AddrSpace, AP);
|
||||
|
||||
// Otherwise, it must be a ConstantExpr. Lower it to an MCExpr, then emit it
|
||||
// thread the streamer with EmitValue.
|
||||
AP.OutStreamer.EmitValue(LowerConstant(CV, AP), Size, AddrSpace);
|
||||
AP.OutStreamer.EmitValue(lowerConstant(CV, AP), Size, AddrSpace);
|
||||
}
|
||||
|
||||
/// EmitGlobalConstant - Print a general LLVM constant to the .s file.
|
||||
void AsmPrinter::EmitGlobalConstant(const Constant *CV, unsigned AddrSpace) {
|
||||
uint64_t Size = TM.getTargetData()->getTypeAllocSize(CV->getType());
|
||||
if (Size)
|
||||
EmitGlobalConstantImpl(CV, AddrSpace, *this);
|
||||
emitGlobalConstantImpl(CV, AddrSpace, *this);
|
||||
else if (MAI->hasSubsectionsViaSymbols()) {
|
||||
// If the global has zero size, emit a single byte so that two labels don't
|
||||
// look like they are at the same location.
|
||||
@ -2021,8 +2020,8 @@ static void PrintChildLoopComment(raw_ostream &OS, const MachineLoop *Loop,
|
||||
}
|
||||
}
|
||||
|
||||
/// EmitBasicBlockLoopComments - Pretty-print comments for basic blocks.
|
||||
static void EmitBasicBlockLoopComments(const MachineBasicBlock &MBB,
|
||||
/// emitBasicBlockLoopComments - Pretty-print comments for basic blocks.
|
||||
static void emitBasicBlockLoopComments(const MachineBasicBlock &MBB,
|
||||
const MachineLoopInfo *LI,
|
||||
const AsmPrinter &AP) {
|
||||
// Add loop depth information
|
||||
@ -2088,7 +2087,7 @@ void AsmPrinter::EmitBasicBlockStart(const MachineBasicBlock *MBB) const {
|
||||
if (const BasicBlock *BB = MBB->getBasicBlock())
|
||||
if (BB->hasName())
|
||||
OutStreamer.AddComment("%" + BB->getName());
|
||||
EmitBasicBlockLoopComments(*MBB, LI, *this);
|
||||
emitBasicBlockLoopComments(*MBB, LI, *this);
|
||||
}
|
||||
|
||||
// Print the main label for the block.
|
||||
|
@ -43,10 +43,10 @@ namespace {
|
||||
};
|
||||
}
|
||||
|
||||
/// SrcMgrDiagHandler - This callback is invoked when the SourceMgr for an
|
||||
/// srcMgrDiagHandler - This callback is invoked when the SourceMgr for an
|
||||
/// inline asm has an error in it. diagInfo is a pointer to the SrcMgrDiagInfo
|
||||
/// struct above.
|
||||
static void SrcMgrDiagHandler(const SMDiagnostic &Diag, void *diagInfo) {
|
||||
static void srcMgrDiagHandler(const SMDiagnostic &Diag, void *diagInfo) {
|
||||
SrcMgrDiagInfo *DiagInfo = static_cast<SrcMgrDiagInfo *>(diagInfo);
|
||||
assert(DiagInfo && "Diagnostic context not passed down?");
|
||||
|
||||
@ -92,12 +92,12 @@ void AsmPrinter::EmitInlineAsm(StringRef Str, const MDNode *LocMDNode,
|
||||
LLVMContext &LLVMCtx = MMI->getModule()->getContext();
|
||||
bool HasDiagHandler = false;
|
||||
if (LLVMCtx.getInlineAsmDiagnosticHandler() != 0) {
|
||||
// If the source manager has an issue, we arrange for SrcMgrDiagHandler
|
||||
// If the source manager has an issue, we arrange for srcMgrDiagHandler
|
||||
// to be invoked, getting DiagInfo passed into it.
|
||||
DiagInfo.LocInfo = LocMDNode;
|
||||
DiagInfo.DiagHandler = LLVMCtx.getInlineAsmDiagnosticHandler();
|
||||
DiagInfo.DiagContext = LLVMCtx.getInlineAsmDiagnosticContext();
|
||||
SrcMgr.setDiagHandler(SrcMgrDiagHandler, &DiagInfo);
|
||||
SrcMgr.setDiagHandler(srcMgrDiagHandler, &DiagInfo);
|
||||
HasDiagHandler = true;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user