2008-11-07 10:59:00 +00:00
|
|
|
//===-- XCoreAsmPrinter.cpp - XCore LLVM assembly writer ------------------===//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// This file contains a printer that converts from our internal representation
|
|
|
|
// of machine-dependent LLVM code to the XAS-format XCore assembly language.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#define DEBUG_TYPE "asm-printer"
|
|
|
|
#include "XCore.h"
|
|
|
|
#include "XCoreInstrInfo.h"
|
|
|
|
#include "XCoreSubtarget.h"
|
|
|
|
#include "XCoreTargetMachine.h"
|
|
|
|
#include "llvm/Constants.h"
|
|
|
|
#include "llvm/DerivedTypes.h"
|
|
|
|
#include "llvm/Module.h"
|
|
|
|
#include "llvm/CodeGen/AsmPrinter.h"
|
|
|
|
#include "llvm/CodeGen/DwarfWriter.h"
|
|
|
|
#include "llvm/CodeGen/MachineModuleInfo.h"
|
|
|
|
#include "llvm/CodeGen/MachineFunctionPass.h"
|
|
|
|
#include "llvm/CodeGen/MachineConstantPool.h"
|
|
|
|
#include "llvm/CodeGen/MachineInstr.h"
|
|
|
|
#include "llvm/Target/TargetAsmInfo.h"
|
|
|
|
#include "llvm/Target/TargetData.h"
|
|
|
|
#include "llvm/Support/Mangler.h"
|
|
|
|
#include "llvm/ADT/Statistic.h"
|
|
|
|
#include "llvm/ADT/StringExtras.h"
|
|
|
|
#include "llvm/Support/CommandLine.h"
|
2009-07-08 19:04:27 +00:00
|
|
|
#include "llvm/Support/ErrorHandling.h"
|
2009-07-14 20:18:05 +00:00
|
|
|
#include "llvm/Support/FormattedStream.h"
|
2008-11-07 10:59:00 +00:00
|
|
|
#include "llvm/Support/MathExtras.h"
|
|
|
|
#include <algorithm>
|
|
|
|
#include <cctype>
|
|
|
|
using namespace llvm;
|
|
|
|
|
|
|
|
STATISTIC(EmittedInsts, "Number of machine instrs printed");
|
|
|
|
|
|
|
|
static cl::opt<unsigned> MaxThreads("xcore-max-threads", cl::Optional,
|
|
|
|
cl::desc("Maximum number of threads (for emulation thread-local storage)"),
|
|
|
|
cl::Hidden,
|
|
|
|
cl::value_desc("number"),
|
|
|
|
cl::init(8));
|
|
|
|
|
|
|
|
namespace {
|
2009-02-24 08:30:20 +00:00
|
|
|
class VISIBILITY_HIDDEN XCoreAsmPrinter : public AsmPrinter {
|
2009-01-08 23:40:34 +00:00
|
|
|
DwarfWriter *DW;
|
2008-11-07 10:59:00 +00:00
|
|
|
const XCoreSubtarget &Subtarget;
|
2009-02-24 08:30:20 +00:00
|
|
|
public:
|
2009-07-15 23:17:20 +00:00
|
|
|
explicit XCoreAsmPrinter(formatted_raw_ostream &O, TargetMachine &TM,
|
2009-07-01 01:48:54 +00:00
|
|
|
const TargetAsmInfo *T, bool V)
|
|
|
|
: AsmPrinter(O, TM, T, V), DW(0),
|
2009-07-15 23:17:20 +00:00
|
|
|
Subtarget(TM.getSubtarget<XCoreSubtarget>()) {}
|
2008-11-07 10:59:00 +00:00
|
|
|
|
|
|
|
virtual const char *getPassName() const {
|
|
|
|
return "XCore Assembly Printer";
|
|
|
|
}
|
|
|
|
|
|
|
|
void printMemOperand(const MachineInstr *MI, int opNum);
|
|
|
|
void printOperand(const MachineInstr *MI, int opNum);
|
|
|
|
bool PrintAsmOperand(const MachineInstr *MI, unsigned OpNo,
|
|
|
|
unsigned AsmVariant, const char *ExtraCode);
|
2009-07-15 15:36:37 +00:00
|
|
|
|
2008-11-07 10:59:00 +00:00
|
|
|
void emitGlobalDirective(const std::string &name);
|
|
|
|
void emitExternDirective(const std::string &name);
|
|
|
|
|
|
|
|
void emitArrayBound(const std::string &name, const GlobalVariable *GV);
|
|
|
|
void emitGlobal(const GlobalVariable *GV);
|
|
|
|
|
|
|
|
void emitFunctionStart(MachineFunction &MF);
|
|
|
|
void emitFunctionEnd(MachineFunction &MF);
|
|
|
|
|
|
|
|
bool printInstruction(const MachineInstr *MI); // autogenerated.
|
|
|
|
void printMachineInstruction(const MachineInstr *MI);
|
|
|
|
bool runOnMachineFunction(MachineFunction &F);
|
|
|
|
bool doInitialization(Module &M);
|
|
|
|
bool doFinalization(Module &M);
|
|
|
|
|
|
|
|
void getAnalysisUsage(AnalysisUsage &AU) const {
|
|
|
|
AsmPrinter::getAnalysisUsage(AU);
|
|
|
|
AU.setPreservesAll();
|
|
|
|
AU.addRequired<MachineModuleInfo>();
|
2009-01-08 23:40:34 +00:00
|
|
|
AU.addRequired<DwarfWriter>();
|
2008-11-07 10:59:00 +00:00
|
|
|
}
|
|
|
|
};
|
|
|
|
} // end of anonymous namespace
|
|
|
|
|
|
|
|
#include "XCoreGenAsmWriter.inc"
|
|
|
|
|
|
|
|
/// createXCoreCodePrinterPass - Returns a pass that prints the XCore
|
|
|
|
/// assembly code for a MachineFunction to the given output stream,
|
|
|
|
/// using the given target machine description. This should work
|
|
|
|
/// regardless of whether the function is in SSA form.
|
|
|
|
///
|
2009-07-14 20:18:05 +00:00
|
|
|
FunctionPass *llvm::createXCoreCodePrinterPass(formatted_raw_ostream &o,
|
2009-07-15 23:17:20 +00:00
|
|
|
TargetMachine &tm,
|
2009-04-29 00:15:41 +00:00
|
|
|
bool verbose) {
|
2009-07-01 01:48:54 +00:00
|
|
|
return new XCoreAsmPrinter(o, tm, tm.getTargetAsmInfo(), verbose);
|
2008-11-07 10:59:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void XCoreAsmPrinter::
|
|
|
|
emitGlobalDirective(const std::string &name)
|
|
|
|
{
|
|
|
|
O << TAI->getGlobalDirective() << name;
|
|
|
|
O << "\n";
|
|
|
|
}
|
|
|
|
|
|
|
|
void XCoreAsmPrinter::
|
|
|
|
emitExternDirective(const std::string &name)
|
|
|
|
{
|
|
|
|
O << "\t.extern\t" << name;
|
|
|
|
O << '\n';
|
|
|
|
}
|
|
|
|
|
|
|
|
void XCoreAsmPrinter::
|
|
|
|
emitArrayBound(const std::string &name, const GlobalVariable *GV)
|
|
|
|
{
|
2008-11-07 11:21:09 +00:00
|
|
|
assert(((GV->hasExternalLinkage() ||
|
2008-11-07 10:59:00 +00:00
|
|
|
GV->hasWeakLinkage()) ||
|
2008-11-07 11:21:09 +00:00
|
|
|
GV->hasLinkOnceLinkage()) && "Unexpected linkage");
|
2008-11-07 10:59:00 +00:00
|
|
|
if (const ArrayType *ATy = dyn_cast<ArrayType>(
|
|
|
|
cast<PointerType>(GV->getType())->getElementType()))
|
|
|
|
{
|
|
|
|
O << TAI->getGlobalDirective() << name << ".globound" << "\n";
|
|
|
|
O << TAI->getSetDirective() << name << ".globound" << ","
|
|
|
|
<< ATy->getNumElements() << "\n";
|
|
|
|
if (GV->hasWeakLinkage() || GV->hasLinkOnceLinkage()) {
|
|
|
|
// TODO Use COMDAT groups for LinkOnceLinkage
|
|
|
|
O << TAI->getWeakDefDirective() << name << ".globound" << "\n";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void XCoreAsmPrinter::
|
|
|
|
emitGlobal(const GlobalVariable *GV)
|
|
|
|
{
|
|
|
|
const TargetData *TD = TM.getTargetData();
|
|
|
|
|
|
|
|
if (GV->hasInitializer()) {
|
|
|
|
// Check to see if this is a special global used by LLVM, if so, emit it.
|
|
|
|
if (EmitSpecialLLVMGlobal(GV))
|
|
|
|
return;
|
|
|
|
|
|
|
|
SwitchToSection(TAI->SectionForGlobal(GV));
|
|
|
|
|
2009-07-14 18:17:16 +00:00
|
|
|
std::string name = Mang->getMangledName(GV);
|
2008-11-07 10:59:00 +00:00
|
|
|
Constant *C = GV->getInitializer();
|
|
|
|
unsigned Align = (unsigned)TD->getPreferredTypeAlignmentShift(C->getType());
|
|
|
|
|
|
|
|
// Mark the start of the global
|
|
|
|
O << "\t.cc_top " << name << ".data," << name << "\n";
|
|
|
|
|
|
|
|
switch (GV->getLinkage()) {
|
|
|
|
case GlobalValue::AppendingLinkage:
|
2009-07-08 19:04:27 +00:00
|
|
|
llvm_report_error("AppendingLinkage is not supported by this target!");
|
Introduce new linkage types linkonce_odr, weak_odr, common_odr
and extern_weak_odr. These are the same as the non-odr versions,
except that they indicate that the global will only be overridden
by an *equivalent* global. In C, a function with weak linkage can
be overridden by a function which behaves completely differently.
This means that IP passes have to skip weak functions, since any
deductions made from the function definition might be wrong, since
the definition could be replaced by something completely different
at link time. This is not allowed in C++, thanks to the ODR
(One-Definition-Rule): if a function is replaced by another at
link-time, then the new function must be the same as the original
function. If a language knows that a function or other global can
only be overridden by an equivalent global, it can give it the
weak_odr linkage type, and the optimizers will understand that it
is alright to make deductions based on the function body. The
code generators on the other hand map weak and weak_odr linkage
to the same thing.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66339 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-07 15:45:40 +00:00
|
|
|
case GlobalValue::LinkOnceAnyLinkage:
|
|
|
|
case GlobalValue::LinkOnceODRLinkage:
|
|
|
|
case GlobalValue::WeakAnyLinkage:
|
|
|
|
case GlobalValue::WeakODRLinkage:
|
2008-11-07 10:59:00 +00:00
|
|
|
case GlobalValue::ExternalLinkage:
|
|
|
|
emitArrayBound(name, GV);
|
|
|
|
emitGlobalDirective(name);
|
|
|
|
// TODO Use COMDAT groups for LinkOnceLinkage
|
|
|
|
if (GV->hasWeakLinkage() || GV->hasLinkOnceLinkage()) {
|
|
|
|
O << TAI->getWeakDefDirective() << name << "\n";
|
|
|
|
}
|
|
|
|
// FALL THROUGH
|
|
|
|
case GlobalValue::InternalLinkage:
|
2009-01-15 20:18:42 +00:00
|
|
|
case GlobalValue::PrivateLinkage:
|
2008-11-07 10:59:00 +00:00
|
|
|
break;
|
|
|
|
case GlobalValue::GhostLinkage:
|
2009-07-14 16:55:14 +00:00
|
|
|
llvm_unreachable("Should not have any unmaterialized functions!");
|
2008-11-07 10:59:00 +00:00
|
|
|
case GlobalValue::DLLImportLinkage:
|
2009-07-14 16:55:14 +00:00
|
|
|
llvm_unreachable("DLLImport linkage is not supported by this target!");
|
2008-11-07 10:59:00 +00:00
|
|
|
case GlobalValue::DLLExportLinkage:
|
2009-07-14 16:55:14 +00:00
|
|
|
llvm_unreachable("DLLExport linkage is not supported by this target!");
|
2008-11-07 10:59:00 +00:00
|
|
|
default:
|
2009-07-14 16:55:14 +00:00
|
|
|
llvm_unreachable("Unknown linkage type!");
|
2008-11-07 10:59:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
EmitAlignment(Align, GV, 2);
|
|
|
|
|
2009-05-09 07:06:46 +00:00
|
|
|
unsigned Size = TD->getTypeAllocSize(C->getType());
|
2008-11-07 10:59:00 +00:00
|
|
|
if (GV->isThreadLocal()) {
|
|
|
|
Size *= MaxThreads;
|
|
|
|
}
|
|
|
|
if (TAI->hasDotTypeDotSizeDirective()) {
|
|
|
|
O << "\t.type " << name << ",@object\n";
|
|
|
|
O << "\t.size " << name << "," << Size << "\n";
|
|
|
|
}
|
|
|
|
O << name << ":\n";
|
|
|
|
|
|
|
|
EmitGlobalConstant(C);
|
|
|
|
if (GV->isThreadLocal()) {
|
|
|
|
for (unsigned i = 1; i < MaxThreads; ++i) {
|
|
|
|
EmitGlobalConstant(C);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (Size < 4) {
|
|
|
|
// The ABI requires that unsigned scalar types smaller than 32 bits
|
|
|
|
// are are padded to 32 bits.
|
|
|
|
EmitZeros(4 - Size);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Mark the end of the global
|
|
|
|
O << "\t.cc_bottom " << name << ".data\n";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/// Emit the directives on the start of functions
|
|
|
|
void XCoreAsmPrinter::
|
|
|
|
emitFunctionStart(MachineFunction &MF)
|
|
|
|
{
|
|
|
|
// Print out the label for the function.
|
|
|
|
const Function *F = MF.getFunction();
|
|
|
|
|
|
|
|
SwitchToSection(TAI->SectionForGlobal(F));
|
|
|
|
|
|
|
|
// Mark the start of the function
|
|
|
|
O << "\t.cc_top " << CurrentFnName << ".function," << CurrentFnName << "\n";
|
|
|
|
|
|
|
|
switch (F->getLinkage()) {
|
2009-07-14 16:55:14 +00:00
|
|
|
default: llvm_unreachable("Unknown linkage type!");
|
2008-11-07 10:59:00 +00:00
|
|
|
case Function::InternalLinkage: // Symbols default to internal.
|
2009-01-15 20:18:42 +00:00
|
|
|
case Function::PrivateLinkage:
|
2008-11-07 10:59:00 +00:00
|
|
|
break;
|
|
|
|
case Function::ExternalLinkage:
|
|
|
|
emitGlobalDirective(CurrentFnName);
|
|
|
|
break;
|
Introduce new linkage types linkonce_odr, weak_odr, common_odr
and extern_weak_odr. These are the same as the non-odr versions,
except that they indicate that the global will only be overridden
by an *equivalent* global. In C, a function with weak linkage can
be overridden by a function which behaves completely differently.
This means that IP passes have to skip weak functions, since any
deductions made from the function definition might be wrong, since
the definition could be replaced by something completely different
at link time. This is not allowed in C++, thanks to the ODR
(One-Definition-Rule): if a function is replaced by another at
link-time, then the new function must be the same as the original
function. If a language knows that a function or other global can
only be overridden by an equivalent global, it can give it the
weak_odr linkage type, and the optimizers will understand that it
is alright to make deductions based on the function body. The
code generators on the other hand map weak and weak_odr linkage
to the same thing.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66339 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-07 15:45:40 +00:00
|
|
|
case Function::LinkOnceAnyLinkage:
|
|
|
|
case Function::LinkOnceODRLinkage:
|
|
|
|
case Function::WeakAnyLinkage:
|
|
|
|
case Function::WeakODRLinkage:
|
2008-11-07 10:59:00 +00:00
|
|
|
// TODO Use COMDAT groups for LinkOnceLinkage
|
|
|
|
O << TAI->getGlobalDirective() << CurrentFnName << "\n";
|
|
|
|
O << TAI->getWeakDefDirective() << CurrentFnName << "\n";
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
// (1 << 1) byte aligned
|
2009-06-30 22:38:32 +00:00
|
|
|
EmitAlignment(MF.getAlignment(), F, 1);
|
2008-11-07 10:59:00 +00:00
|
|
|
if (TAI->hasDotTypeDotSizeDirective()) {
|
|
|
|
O << "\t.type " << CurrentFnName << ",@function\n";
|
|
|
|
}
|
|
|
|
O << CurrentFnName << ":\n";
|
|
|
|
}
|
|
|
|
|
|
|
|
/// Emit the directives on the end of functions
|
|
|
|
void XCoreAsmPrinter::
|
|
|
|
emitFunctionEnd(MachineFunction &MF)
|
|
|
|
{
|
|
|
|
// Mark the end of the function
|
|
|
|
O << "\t.cc_bottom " << CurrentFnName << ".function\n";
|
|
|
|
}
|
|
|
|
|
|
|
|
/// runOnMachineFunction - This uses the printMachineInstruction()
|
|
|
|
/// method to print assembly for each instruction.
|
|
|
|
///
|
|
|
|
bool XCoreAsmPrinter::runOnMachineFunction(MachineFunction &MF)
|
|
|
|
{
|
2009-02-24 08:30:20 +00:00
|
|
|
this->MF = &MF;
|
|
|
|
|
2008-11-07 10:59:00 +00:00
|
|
|
SetupMachineFunction(MF);
|
|
|
|
|
|
|
|
// Print out constants referenced by the function
|
|
|
|
EmitConstantPool(MF.getConstantPool());
|
|
|
|
|
|
|
|
// Print out jump tables referenced by the function
|
|
|
|
EmitJumpTableInfo(MF.getJumpTableInfo(), MF);
|
|
|
|
|
|
|
|
// Emit the function start directives
|
|
|
|
emitFunctionStart(MF);
|
|
|
|
|
|
|
|
// Emit pre-function debug information.
|
2009-01-08 23:40:34 +00:00
|
|
|
DW->BeginFunction(&MF);
|
2008-11-07 10:59:00 +00:00
|
|
|
|
|
|
|
// Print out code for the function.
|
|
|
|
for (MachineFunction::const_iterator I = MF.begin(), E = MF.end();
|
|
|
|
I != E; ++I) {
|
|
|
|
|
|
|
|
// Print a label for the basic block.
|
|
|
|
if (I != MF.begin()) {
|
|
|
|
printBasicBlockLabel(I, true , true);
|
|
|
|
O << '\n';
|
|
|
|
}
|
|
|
|
|
|
|
|
for (MachineBasicBlock::const_iterator II = I->begin(), E = I->end();
|
|
|
|
II != E; ++II) {
|
|
|
|
// Print the assembly for the instruction.
|
|
|
|
O << "\t";
|
|
|
|
printMachineInstruction(II);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Each Basic Block is separated by a newline
|
|
|
|
O << '\n';
|
|
|
|
}
|
|
|
|
|
|
|
|
// Emit function end directives
|
|
|
|
emitFunctionEnd(MF);
|
|
|
|
|
|
|
|
// Emit post-function debug information.
|
2009-01-08 23:40:34 +00:00
|
|
|
DW->EndFunction(&MF);
|
2008-11-07 10:59:00 +00:00
|
|
|
|
|
|
|
// We didn't modify anything.
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
void XCoreAsmPrinter::printMemOperand(const MachineInstr *MI, int opNum)
|
|
|
|
{
|
|
|
|
printOperand(MI, opNum);
|
|
|
|
|
|
|
|
if (MI->getOperand(opNum+1).isImm()
|
|
|
|
&& MI->getOperand(opNum+1).getImm() == 0)
|
|
|
|
return;
|
|
|
|
|
|
|
|
O << "+";
|
|
|
|
printOperand(MI, opNum+1);
|
|
|
|
}
|
|
|
|
|
|
|
|
void XCoreAsmPrinter::printOperand(const MachineInstr *MI, int opNum) {
|
|
|
|
const MachineOperand &MO = MI->getOperand(opNum);
|
|
|
|
switch (MO.getType()) {
|
|
|
|
case MachineOperand::MO_Register:
|
|
|
|
if (TargetRegisterInfo::isPhysicalRegister(MO.getReg()))
|
|
|
|
O << TM.getRegisterInfo()->get(MO.getReg()).AsmName;
|
|
|
|
else
|
2009-07-14 16:55:14 +00:00
|
|
|
llvm_unreachable("not implemented");
|
2008-11-07 10:59:00 +00:00
|
|
|
break;
|
|
|
|
case MachineOperand::MO_Immediate:
|
|
|
|
O << MO.getImm();
|
|
|
|
break;
|
|
|
|
case MachineOperand::MO_MachineBasicBlock:
|
|
|
|
printBasicBlockLabel(MO.getMBB());
|
|
|
|
break;
|
|
|
|
case MachineOperand::MO_GlobalAddress:
|
2009-07-14 18:17:16 +00:00
|
|
|
O << Mang->getMangledName(MO.getGlobal());
|
2008-11-07 10:59:00 +00:00
|
|
|
break;
|
|
|
|
case MachineOperand::MO_ExternalSymbol:
|
|
|
|
O << MO.getSymbolName();
|
|
|
|
break;
|
|
|
|
case MachineOperand::MO_ConstantPoolIndex:
|
|
|
|
O << TAI->getPrivateGlobalPrefix() << "CPI" << getFunctionNumber()
|
|
|
|
<< '_' << MO.getIndex();
|
|
|
|
break;
|
|
|
|
case MachineOperand::MO_JumpTableIndex:
|
|
|
|
O << TAI->getPrivateGlobalPrefix() << "JTI" << getFunctionNumber()
|
|
|
|
<< '_' << MO.getIndex();
|
|
|
|
break;
|
|
|
|
default:
|
2009-07-14 16:55:14 +00:00
|
|
|
llvm_unreachable("not implemented");
|
2008-11-07 10:59:00 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/// PrintAsmOperand - Print out an operand for an inline asm expression.
|
|
|
|
///
|
|
|
|
bool XCoreAsmPrinter::PrintAsmOperand(const MachineInstr *MI, unsigned OpNo,
|
|
|
|
unsigned AsmVariant,
|
|
|
|
const char *ExtraCode) {
|
|
|
|
printOperand(MI, OpNo);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
void XCoreAsmPrinter::printMachineInstruction(const MachineInstr *MI) {
|
|
|
|
++EmittedInsts;
|
|
|
|
|
|
|
|
// Check for mov mnemonic
|
2009-01-20 19:12:24 +00:00
|
|
|
unsigned src, dst, srcSR, dstSR;
|
|
|
|
if (TM.getInstrInfo()->isMoveInstr(*MI, src, dst, srcSR, dstSR)) {
|
2008-11-07 10:59:00 +00:00
|
|
|
O << "\tmov ";
|
|
|
|
O << TM.getRegisterInfo()->get(dst).AsmName;
|
|
|
|
O << ", ";
|
|
|
|
O << TM.getRegisterInfo()->get(src).AsmName;
|
|
|
|
O << "\n";
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (printInstruction(MI)) {
|
|
|
|
return;
|
|
|
|
}
|
2009-07-14 16:55:14 +00:00
|
|
|
llvm_unreachable("Unhandled instruction in asm writer!");
|
2008-11-07 10:59:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
bool XCoreAsmPrinter::doInitialization(Module &M) {
|
|
|
|
bool Result = AsmPrinter::doInitialization(M);
|
2009-06-19 21:54:26 +00:00
|
|
|
DW = getAnalysisIfAvailable<DwarfWriter>();
|
2008-11-07 10:59:00 +00:00
|
|
|
|
|
|
|
return Result;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool XCoreAsmPrinter::doFinalization(Module &M) {
|
|
|
|
|
|
|
|
// Print out module-level global variables.
|
|
|
|
for (Module::const_global_iterator I = M.global_begin(), E = M.global_end();
|
|
|
|
I != E; ++I) {
|
|
|
|
emitGlobal(I);
|
|
|
|
}
|
|
|
|
|
|
|
|
return AsmPrinter::doFinalization(M);
|
|
|
|
}
|