aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt6
-rwxr-xr-xcmake/config-ix.cmake2
-rw-r--r--cmake/modules/LLVMLibDeps.cmake6
-rwxr-xr-xconfigure7
-rw-r--r--docs/ReleaseNotes.html2
-rw-r--r--include/llvm/MC/MCSection.h3
-rw-r--r--lib/CodeGen/VirtRegRewriter.cpp2
-rw-r--r--lib/Target/PIC16/AsmPrinter/CMakeLists.txt10
-rw-r--r--lib/Target/PIC16/AsmPrinter/Makefile15
-rw-r--r--lib/Target/PIC16/AsmPrinter/PIC16AsmPrinter.cpp512
-rw-r--r--lib/Target/PIC16/AsmPrinter/PIC16AsmPrinter.h88
-rw-r--r--lib/Target/PIC16/CMakeLists.txt26
-rw-r--r--lib/Target/PIC16/Makefile24
-rw-r--r--lib/Target/PIC16/PIC16.h134
-rw-r--r--lib/Target/PIC16/PIC16.td40
-rw-r--r--lib/Target/PIC16/PIC16ABINames.h399
-rw-r--r--lib/Target/PIC16/PIC16DebugInfo.cpp490
-rw-r--r--lib/Target/PIC16/PIC16DebugInfo.h156
-rw-r--r--lib/Target/PIC16/PIC16ISelDAGToDAG.cpp49
-rw-r--r--lib/Target/PIC16/PIC16ISelDAGToDAG.h60
-rw-r--r--lib/Target/PIC16/PIC16ISelLowering.cpp2000
-rw-r--r--lib/Target/PIC16/PIC16ISelLowering.h253
-rw-r--r--lib/Target/PIC16/PIC16InstrFormats.td117
-rw-r--r--lib/Target/PIC16/PIC16InstrInfo.cpp224
-rw-r--r--lib/Target/PIC16/PIC16InstrInfo.h76
-rw-r--r--lib/Target/PIC16/PIC16InstrInfo.td540
-rw-r--r--lib/Target/PIC16/PIC16MCAsmInfo.cpp59
-rw-r--r--lib/Target/PIC16/PIC16MCAsmInfo.h35
-rw-r--r--lib/Target/PIC16/PIC16MachineFunctionInfo.h52
-rw-r--r--lib/Target/PIC16/PIC16MemSelOpt.cpp254
-rw-r--r--lib/Target/PIC16/PIC16Passes/CMakeLists.txt4
-rw-r--r--lib/Target/PIC16/PIC16Passes/Makefile15
-rw-r--r--lib/Target/PIC16/PIC16Passes/PIC16Cloner.cpp299
-rw-r--r--lib/Target/PIC16/PIC16Passes/PIC16Cloner.h83
-rw-r--r--lib/Target/PIC16/PIC16Passes/PIC16Overlay.cpp182
-rw-r--r--lib/Target/PIC16/PIC16Passes/PIC16Overlay.h60
-rw-r--r--lib/Target/PIC16/PIC16RegisterInfo.cpp84
-rw-r--r--lib/Target/PIC16/PIC16RegisterInfo.h64
-rw-r--r--lib/Target/PIC16/PIC16RegisterInfo.td33
-rw-r--r--lib/Target/PIC16/PIC16Section.cpp108
-rw-r--r--lib/Target/PIC16/PIC16Section.h101
-rw-r--r--lib/Target/PIC16/PIC16SelectionDAGInfo.cpp23
-rw-r--r--lib/Target/PIC16/PIC16SelectionDAGInfo.h31
-rw-r--r--lib/Target/PIC16/PIC16Subtarget.cpp27
-rw-r--r--lib/Target/PIC16/PIC16Subtarget.h44
-rw-r--r--lib/Target/PIC16/PIC16TargetMachine.cpp55
-rw-r--r--lib/Target/PIC16/PIC16TargetMachine.h70
-rw-r--r--lib/Target/PIC16/PIC16TargetObjectFile.cpp384
-rw-r--r--lib/Target/PIC16/PIC16TargetObjectFile.h168
-rw-r--r--lib/Target/PIC16/TargetInfo/CMakeLists.txt7
-rw-r--r--lib/Target/PIC16/TargetInfo/Makefile15
-rw-r--r--lib/Target/PIC16/TargetInfo/PIC16TargetInfo.cpp22
-rw-r--r--test/CodeGen/PIC16/2009-07-17-PR4566-pic16.ll32
-rw-r--r--test/CodeGen/PIC16/2009-11-20-NewNode.ll36
-rw-r--r--test/CodeGen/PIC16/C16-11.ll40
-rw-r--r--test/CodeGen/PIC16/C16-15.ll45
-rw-r--r--test/CodeGen/PIC16/C16-49.ll15
-rw-r--r--test/CodeGen/PIC16/check_inc_files.ll9
-rw-r--r--test/CodeGen/PIC16/dg.exp5
-rw-r--r--test/CodeGen/PIC16/global-in-user-section.ll6
-rw-r--r--test/CodeGen/PIC16/globals.ll18
-rw-r--r--test/CodeGen/PIC16/result_direction.ll13
-rw-r--r--test/CodeGen/PIC16/sext.ll11
-rw-r--r--test/CodeGen/PIC16/test_indf_name.ll12
-rw-r--r--tools/llvmc/examples/Makefile2
-rw-r--r--tools/llvmc/examples/mcc16/Hooks.cpp109
-rw-r--r--tools/llvmc/examples/mcc16/Main.cpp57
-rw-r--r--tools/llvmc/examples/mcc16/Makefile15
-rw-r--r--tools/llvmc/examples/mcc16/PIC16.td234
-rw-r--r--tools/llvmc/examples/mcc16/README75
-rwxr-xr-xutils/GenLibDeps.pl2
71 files changed, 6 insertions, 8250 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index d473f51b59..414c32e005 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -64,7 +64,6 @@ set(LLVM_ALL_TARGETS
Mips
MBlaze
MSP430
- PIC16
PowerPC
PTX
Sparc
@@ -342,11 +341,6 @@ foreach(t ${LLVM_TARGETS_TO_BUILD})
set(CURRENT_LLVM_TARGET)
endforeach(t)
-# PIC16 contains an odd library:
-if( LLVM_TARGETS_TO_BUILD MATCHES ".*PIC16.*" )
- add_subdirectory(lib/Target/PIC16/PIC16Passes)
-endif()
-
# Produce llvm/Config/AsmPrinters.def
configure_file(
${LLVM_MAIN_INCLUDE_DIR}/llvm/Config/AsmPrinters.def.in
diff --git a/cmake/config-ix.cmake b/cmake/config-ix.cmake
index b84fa5d680..16c17e20ec 100755
--- a/cmake/config-ix.cmake
+++ b/cmake/config-ix.cmake
@@ -197,8 +197,6 @@ elseif (LLVM_NATIVE_ARCH MATCHES "arm")
set(LLVM_NATIVE_ARCH ARM)
elseif (LLVM_NATIVE_ARCH MATCHES "mips")
set(LLVM_NATIVE_ARCH Mips)
-elseif (LLVM_NATIVE_ARCH MATCHES "pic16")
- set(LLVM_NATIVE_ARCH "PIC16")
elseif (LLVM_NATIVE_ARCH MATCHES "xcore")
set(LLVM_NATIVE_ARCH XCore)
elseif (LLVM_NATIVE_ARCH MATCHES "msp430")
diff --git a/cmake/modules/LLVMLibDeps.cmake b/cmake/modules/LLVMLibDeps.cmake
index 77b2bcf2d4..67a016c641 100644
--- a/cmake/modules/LLVMLibDeps.cmake
+++ b/cmake/modules/LLVMLibDeps.cmake
@@ -34,7 +34,7 @@ set(MSVC_LIB_DEPS_LLVMMBlazeAsmPrinter LLVMAsmPrinter LLVMCodeGen LLVMCore LLVMM
set(MSVC_LIB_DEPS_LLVMMBlazeCodeGen LLVMCodeGen LLVMCore LLVMMBlazeInfo LLVMMC LLVMSelectionDAG LLVMSupport LLVMSystem LLVMTarget)
set(MSVC_LIB_DEPS_LLVMMBlazeInfo LLVMSupport)
set(MSVC_LIB_DEPS_LLVMMC LLVMSupport LLVMSystem)
-set(MSVC_LIB_DEPS_LLVMMCDisassembler LLVMARMAsmParser LLVMARMCodeGen LLVMARMDisassembler LLVMARMInfo LLVMAlphaAsmPrinter LLVMAlphaCodeGen LLVMAlphaInfo LLVMBlackfinAsmPrinter LLVMBlackfinCodeGen LLVMBlackfinInfo LLVMCBackend LLVMCBackendInfo LLVMCellSPUAsmPrinter LLVMCellSPUCodeGen LLVMCellSPUInfo LLVMCppBackend LLVMCppBackendInfo LLVMMBlazeAsmPrinter LLVMMBlazeCodeGen LLVMMBlazeInfo LLVMMC LLVMMCParser LLVMMSP430CodeGen LLVMMSP430Info LLVMMipsAsmPrinter LLVMMipsCodeGen LLVMMipsInfo LLVMPIC16AsmPrinter LLVMPIC16CodeGen LLVMPIC16Info LLVMPTXAsmPrinter LLVMPTXCodeGen LLVMPTXInfo LLVMPowerPCAsmPrinter LLVMPowerPCCodeGen LLVMPowerPCInfo LLVMSparcAsmPrinter LLVMSparcCodeGen LLVMSparcInfo LLVMSupport LLVMSystem LLVMSystemZAsmPrinter LLVMSystemZCodeGen LLVMSystemZInfo LLVMX86AsmParser LLVMX86CodeGen LLVMX86Disassembler LLVMX86Info LLVMXCoreAsmPrinter LLVMXCoreCodeGen LLVMXCoreInfo)
+set(MSVC_LIB_DEPS_LLVMMCDisassembler LLVMARMAsmParser LLVMARMCodeGen LLVMARMDisassembler LLVMARMInfo LLVMAlphaAsmPrinter LLVMAlphaCodeGen LLVMAlphaInfo LLVMBlackfinAsmPrinter LLVMBlackfinCodeGen LLVMBlackfinInfo LLVMCBackend LLVMCBackendInfo LLVMCellSPUAsmPrinter LLVMCellSPUCodeGen LLVMCellSPUInfo LLVMCppBackend LLVMCppBackendInfo LLVMMBlazeAsmPrinter LLVMMBlazeCodeGen LLVMMBlazeInfo LLVMMC LLVMMCParser LLVMMSP430CodeGen LLVMMSP430Info LLVMMipsAsmPrinter LLVMMipsCodeGen LLVMMipsInfo LLVMPTXAsmPrinter LLVMPTXCodeGen LLVMPTXInfo LLVMPowerPCAsmPrinter LLVMPowerPCCodeGen LLVMPowerPCInfo LLVMSparcAsmPrinter LLVMSparcCodeGen LLVMSparcInfo LLVMSupport LLVMSystem LLVMSystemZAsmPrinter LLVMSystemZCodeGen LLVMSystemZInfo LLVMX86AsmParser LLVMX86CodeGen LLVMX86Disassembler LLVMX86Info LLVMXCoreAsmPrinter LLVMXCoreCodeGen LLVMXCoreInfo)
set(MSVC_LIB_DEPS_LLVMMCParser LLVMMC LLVMSupport)
set(MSVC_LIB_DEPS_LLVMMSP430AsmPrinter LLVMMC LLVMSupport)
set(MSVC_LIB_DEPS_LLVMMSP430CodeGen LLVMAsmPrinter LLVMCodeGen LLVMCore LLVMMC LLVMMSP430AsmPrinter LLVMMSP430Info LLVMSelectionDAG LLVMSupport LLVMSystem LLVMTarget)
@@ -42,10 +42,6 @@ set(MSVC_LIB_DEPS_LLVMMSP430Info LLVMSupport)
set(MSVC_LIB_DEPS_LLVMMipsAsmPrinter LLVMAsmPrinter LLVMCodeGen LLVMCore LLVMMC LLVMMipsCodeGen LLVMMipsInfo LLVMSupport LLVMTarget)
set(MSVC_LIB_DEPS_LLVMMipsCodeGen LLVMCodeGen LLVMCore LLVMMC LLVMMipsInfo LLVMSelectionDAG LLVMSupport LLVMSystem LLVMTarget)
set(MSVC_LIB_DEPS_LLVMMipsInfo LLVMSupport)
-set(MSVC_LIB_DEPS_LLVMPIC16AsmPrinter LLVMAsmPrinter LLVMCodeGen LLVMCore LLVMMC LLVMPIC16CodeGen LLVMPIC16Info LLVMSupport LLVMTarget)
-set(MSVC_LIB_DEPS_LLVMPIC16CodeGen LLVMAnalysis LLVMCodeGen LLVMCore LLVMMC LLVMPIC16Info LLVMSelectionDAG LLVMSupport LLVMTarget)
-set(MSVC_LIB_DEPS_LLVMPIC16Info LLVMSupport)
-set(MSVC_LIB_DEPS_LLVMPIC16Passes LLVMCore LLVMSupport LLVMSystem LLVMTransformUtils LLVMipa)
set(MSVC_LIB_DEPS_LLVMPTXAsmPrinter LLVMAsmPrinter LLVMCodeGen LLVMCore LLVMPTXCodeGen LLVMPTXInfo LLVMSupport)
set(MSVC_LIB_DEPS_LLVMPTXCodeGen LLVMCodeGen LLVMCore LLVMMC LLVMPTXInfo LLVMSelectionDAG LLVMSupport LLVMTarget)
set(MSVC_LIB_DEPS_LLVMPTXInfo LLVMSupport)
diff --git a/configure b/configure
index ba31b9650c..365c1d7679 100755
--- a/configure
+++ b/configure
@@ -2356,7 +2356,6 @@ else
alpha*-*) llvm_cv_target_arch="Alpha" ;;
arm*-*) llvm_cv_target_arch="ARM" ;;
mips-*) llvm_cv_target_arch="Mips" ;;
- pic16-*) llvm_cv_target_arch="PIC16" ;;
xcore-*) llvm_cv_target_arch="XCore" ;;
msp430-*) llvm_cv_target_arch="MSP430" ;;
s390x-*) llvm_cv_target_arch="SystemZ" ;;
@@ -4818,8 +4817,6 @@ else
;;
Mips) TARGET_HAS_JIT=0
;;
- PIC16) TARGET_HAS_JIT=0
- ;;
XCore) TARGET_HAS_JIT=0
;;
MSP430) TARGET_HAS_JIT=0
@@ -4959,7 +4956,7 @@ if test "$enableval" = host-only ; then
enableval=host
fi
case "$enableval" in
- all) TARGETS_TO_BUILD="X86 Sparc PowerPC Alpha ARM Mips CellSPU PIC16 XCore MSP430 SystemZ Blackfin CBackend CppBackend MBlaze PTX" ;;
+ all) TARGETS_TO_BUILD="X86 Sparc PowerPC Alpha ARM Mips CellSPU XCore MSP430 SystemZ Blackfin CBackend CppBackend MBlaze PTX" ;;
*)for a_target in `echo $enableval|sed -e 's/,/ /g' ` ; do
case "$a_target" in
x86) TARGETS_TO_BUILD="X86 $TARGETS_TO_BUILD" ;;
@@ -4970,7 +4967,6 @@ case "$enableval" in
arm) TARGETS_TO_BUILD="ARM $TARGETS_TO_BUILD" ;;
mips) TARGETS_TO_BUILD="Mips $TARGETS_TO_BUILD" ;;
spu) TARGETS_TO_BUILD="CellSPU $TARGETS_TO_BUILD" ;;
- pic16) TARGETS_TO_BUILD="PIC16 $TARGETS_TO_BUILD" ;;
xcore) TARGETS_TO_BUILD="XCore $TARGETS_TO_BUILD" ;;
msp430) TARGETS_TO_BUILD="MSP430 $TARGETS_TO_BUILD" ;;
systemz) TARGETS_TO_BUILD="SystemZ $TARGETS_TO_BUILD" ;;
@@ -4989,7 +4985,6 @@ case "$enableval" in
Mips) TARGETS_TO_BUILD="Mips $TARGETS_TO_BUILD" ;;
MBlaze) TARGETS_TO_BUILD="MBlaze $TARGETS_TO_BUILD" ;;
CellSPU|SPU) TARGETS_TO_BUILD="CellSPU $TARGETS_TO_BUILD" ;;
- PIC16) TARGETS_TO_BUILD="PIC16 $TARGETS_TO_BUILD" ;;
XCore) TARGETS_TO_BUILD="XCore $TARGETS_TO_BUILD" ;;
MSP430) TARGETS_TO_BUILD="MSP430 $TARGETS_TO_BUILD" ;;
s390x) TARGETS_TO_BUILD="SystemZ $TARGETS_TO_BUILD" ;;
diff --git a/docs/ReleaseNotes.html b/docs/ReleaseNotes.html
index 826540afae..cc6937ebd8 100644
--- a/docs/ReleaseNotes.html
+++ b/docs/ReleaseNotes.html
@@ -1103,7 +1103,7 @@ components, please contact us on the <a
href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev">LLVMdev list</a>.</p>
<ul>
-<li>The Alpha, Blackfin, CellSPU, MicroBlaze, MSP430, MIPS, PIC16, SystemZ
+<li>The Alpha, Blackfin, CellSPU, MicroBlaze, MSP430, MIPS, SystemZ
and XCore backends are experimental.</li>
<li><tt>llc</tt> "<tt>-filetype=obj</tt>" is experimental on all targets
other than darwin-i386 and darwin-x86_64.</li>
diff --git a/include/llvm/MC/MCSection.h b/include/llvm/MC/MCSection.h
index 3e5b5f13f3..b741216f94 100644
--- a/include/llvm/MC/MCSection.h
+++ b/include/llvm/MC/MCSection.h
@@ -32,8 +32,7 @@ namespace llvm {
enum SectionVariant {
SV_COFF = 0,
SV_ELF,
- SV_MachO,
- SV_PIC16
+ SV_MachO
};
private:
diff --git a/lib/CodeGen/VirtRegRewriter.cpp b/lib/CodeGen/VirtRegRewriter.cpp
index 8b8fc73608..f44eccd40c 100644
--- a/lib/CodeGen/VirtRegRewriter.cpp
+++ b/lib/CodeGen/VirtRegRewriter.cpp
@@ -297,7 +297,7 @@ ComputeReloadLoc(MachineBasicBlock::iterator const InsertLoc,
const TargetLowering *TL = MF.getTarget().getTargetLowering();
if (!TL->isTypeLegal(TL->getPointerTy()))
- // Believe it or not, this is true on PIC16.
+ // Believe it or not, this is true on 16-bit targets like PIC16.
return InsertLoc;
const TargetRegisterClass *ptrRegClass =
diff --git a/lib/Target/PIC16/AsmPrinter/CMakeLists.txt b/lib/Target/PIC16/AsmPrinter/CMakeLists.txt
deleted file mode 100644
index f24c78a59d..0000000000
--- a/lib/Target/PIC16/AsmPrinter/CMakeLists.txt
+++ /dev/null
@@ -1,10 +0,0 @@
-include_directories(
- ${CMAKE_CURRENT_BINARY_DIR}/..
- ${CMAKE_CURRENT_SOURCE_DIR}/..
- )
-
-add_llvm_library(LLVMPIC16AsmPrinter
- PIC16AsmPrinter.cpp
- )
-
-add_dependencies(LLVMPIC16AsmPrinter PIC16CodeGenTable_gen)
diff --git a/lib/Target/PIC16/AsmPrinter/Makefile b/lib/Target/PIC16/AsmPrinter/Makefile
deleted file mode 100644
index e3c0684ebc..0000000000
--- a/lib/Target/PIC16/AsmPrinter/Makefile
+++ /dev/null
@@ -1,15 +0,0 @@
-##===- lib/Target/PIC16/AsmPrinter/Makefile ----------------*- Makefile -*-===##
-#
-# The LLVM Compiler Infrastructure
-#
-# This file is distributed under the University of Illinois Open Source
-# License. See LICENSE.TXT for details.
-#
-##===----------------------------------------------------------------------===##
-LEVEL = ../../../..
-LIBRARYNAME = LLVMPIC16AsmPrinter
-
-# Hack: we need to include 'main' pic16 target directory to grab private headers
-CPP.Flags += -I$(PROJ_OBJ_DIR)/.. -I$(PROJ_SRC_DIR)/..
-
-include $(LEVEL)/Makefile.common
diff --git a/lib/Target/PIC16/AsmPrinter/PIC16AsmPrinter.cpp b/lib/Target/PIC16/AsmPrinter/PIC16AsmPrinter.cpp
deleted file mode 100644
index b665817e61..0000000000
--- a/lib/Target/PIC16/AsmPrinter/PIC16AsmPrinter.cpp
+++ /dev/null
@@ -1,512 +0,0 @@
-//===-- PIC16AsmPrinter.cpp - PIC16 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 PIC16 assembly language.
-//
-//===----------------------------------------------------------------------===//
-
-#include "PIC16ABINames.h"
-#include "PIC16AsmPrinter.h"
-#include "PIC16Section.h"
-#include "PIC16MCAsmInfo.h"
-#include "PIC16MachineFunctionInfo.h"
-#include "llvm/DerivedTypes.h"
-#include "llvm/Function.h"
-#include "llvm/Module.h"
-#include "llvm/CodeGen/MachineFrameInfo.h"
-#include "llvm/CodeGen/MachineModuleInfo.h"
-#include "llvm/MC/MCStreamer.h"
-#include "llvm/MC/MCSymbol.h"
-#include "llvm/Target/Mangler.h"
-#include "llvm/Target/TargetRegistry.h"
-#include "llvm/Target/TargetLoweringObjectFile.h"
-#include "llvm/Support/ErrorHandling.h"
-#include "llvm/Support/raw_ostream.h"
-#include "llvm/ADT/SmallString.h"
-#include <cstring>
-using namespace llvm;
-
-#include "PIC16GenAsmWriter.inc"
-
-PIC16AsmPrinter::PIC16AsmPrinter(TargetMachine &TM, MCStreamer &Streamer)
-: AsmPrinter(TM, Streamer), DbgInfo(Streamer, TM.getMCAsmInfo()) {
- PMAI = static_cast<const PIC16MCAsmInfo*>(TM.getMCAsmInfo());
- PTOF = &getObjFileLowering();
-}
-
-void PIC16AsmPrinter::EmitInstruction(const MachineInstr *MI) {
- SmallString<128> Str;
- raw_svector_ostream OS(Str);
- printInstruction(MI, OS);
-
- OutStreamer.EmitRawText(OS.str());
-}
-
-static int getFunctionColor(const Function *F) {
- if (F->hasSection()) {
- std::string Sectn = F->getSection();
- std::string StrToFind = "Overlay=";
- std::string::size_type Pos = Sectn.find(StrToFind);
-
- // Retreive the color number if the key is found.
- if (Pos != std::string::npos) {
- Pos += StrToFind.length();
- std::string Color = "";
- char c = Sectn.at(Pos);
- // A Color can only consist of digits.
- while (c >= '0' && c<= '9') {
- Color.append(1,c);
- Pos++;
- if (Pos >= Sectn.length())
- break;
- c = Sectn.at(Pos);
- }
- return atoi(Color.c_str());
- }
- }
-
- // Color was not set for function, so return -1.
- return -1;
-}
-
-// Color the Auto section of the given function.
-void PIC16AsmPrinter::ColorAutoSection(const Function *F) {
- std::string SectionName = PAN::getAutosSectionName(CurrentFnSym->getName());
- PIC16Section* Section = PTOF->findPIC16Section(SectionName);
- if (Section != NULL) {
- int Color = getFunctionColor(F);
- if (Color >= 0)
- Section->setColor(Color);
- }
-}
-
-
-/// runOnMachineFunction - This emits the frame section, autos section and
-/// assembly for each instruction. Also takes care of function begin debug
-/// directive and file begin debug directive (if required) for the function.
-///
-bool PIC16AsmPrinter::runOnMachineFunction(MachineFunction &MF) {
- // This calls the base class function required to be called at beginning
- // of runOnMachineFunction.
- SetupMachineFunction(MF);
-
- // Put the color information from function to its auto section.
- const Function *F = MF.getFunction();
- ColorAutoSection(F);
-
- // Emit the function frame (args and temps).
- EmitFunctionFrame(MF);
-
- DbgInfo.BeginFunction(MF);
-
- // Now emit the instructions of function in its code section.
- const MCSection *fCodeSection =
- getObjFileLowering().SectionForCode(CurrentFnSym->getName(),
- PAN::isISR(F->getSection()));
-
- // Start the Code Section.
- OutStreamer.SwitchSection(fCodeSection);
-
- // Emit the frame address of the function at the beginning of code.
- OutStreamer.EmitRawText("\tretlw low(" +
- Twine(PAN::getFrameLabel(CurrentFnSym->getName())) +
- ")");
- OutStreamer.EmitRawText("\tretlw high(" +
- Twine(PAN::getFrameLabel(CurrentFnSym->getName())) +
- ")");
-
- // Emit function start label.
- OutStreamer.EmitLabel(CurrentFnSym);
-
- DebugLoc CurDL;
- // 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())
- EmitBasicBlockStart(I);
-
- // Print a basic block.
- for (MachineBasicBlock::const_iterator II = I->begin(), E = I->end();
- II != E; ++II) {
- // Emit the line directive if source line changed.
- DebugLoc DL = II->getDebugLoc();
- if (!DL.isUnknown() && DL != CurDL) {
- DbgInfo.ChangeDebugLoc(MF, DL);
- CurDL = DL;
- }
-
- // Print the assembly for the instruction.
- EmitInstruction(II);
- }
- }
-
- // Emit function end debug directives.
- DbgInfo.EndFunction(MF);
-
- return false; // we didn't modify anything.
-}
-
-
-// printOperand - print operand of insn.
-void PIC16AsmPrinter::printOperand(const MachineInstr *MI, int opNum,
- raw_ostream &O) {
- const MachineOperand &MO = MI->getOperand(opNum);
- const Function *F = MI->getParent()->getParent()->getFunction();
-
- switch (MO.getType()) {
- case MachineOperand::MO_Register:
- {
- // For indirect load/store insns, the fsr name is printed as INDF.
- std::string RegName = getRegisterName(MO.getReg());
- if ((MI->getOpcode() == PIC16::load_indirect) ||
- (MI->getOpcode() == PIC16::store_indirect))
- RegName.replace (0, 3, "INDF");
- O << RegName;
- }
- return;
-
- case MachineOperand::MO_Immediate:
- O << (int)MO.getImm();
- return;
-
- case MachineOperand::MO_GlobalAddress: {
- MCSymbol *Sym = Mang->getSymbol(MO.getGlobal());
- // FIXME: currently we do not have a memcpy def coming in the module
- // by any chance, as we do not link in those as .bc lib. So these calls
- // are always external and it is safe to emit an extern.
- if (PAN::isMemIntrinsic(Sym->getName()))
- LibcallDecls.insert(Sym->getName());
-
- O << *Sym;
- break;
- }
- case MachineOperand::MO_ExternalSymbol: {
- const char *Sname = MO.getSymbolName();
- std::string Printname = Sname;
-
- // Intrinsic stuff needs to be renamed if we are printing IL fn.
- if (PAN::isIntrinsicStuff(Printname)) {
- if (PAN::isISR(F->getSection())) {
- Printname = PAN::Rename(Sname);
- }
- // Record these decls, we need to print them in asm as extern.
- LibcallDecls.insert(Printname);
- }
-
- O << Printname;
- break;
- }
- case MachineOperand::MO_MachineBasicBlock:
- O << *MO.getMBB()->getSymbol();
- return;
-
- default:
- llvm_unreachable(" Operand type not supported.");
- }
-}
-
-/// printCCOperand - Print the cond code operand.
-///
-void PIC16AsmPrinter::printCCOperand(const MachineInstr *MI, int opNum,
- raw_ostream &O) {
- int CC = (int)MI->getOperand(opNum).getImm();
- O << PIC16CondCodeToString((PIC16CC::CondCodes)CC);
-}
-
-/// printLibcallDecls - print the extern declarations for compiler
-/// intrinsics.
-///
-void PIC16AsmPrinter::printLibcallDecls() {
- // If no libcalls used, return.
- if (LibcallDecls.empty()) return;
-
- OutStreamer.AddComment("External decls for libcalls - BEGIN");
- OutStreamer.AddBlankLine();
-
- for (std::set<std::string>::const_iterator I = LibcallDecls.begin(),
- E = LibcallDecls.end(); I != E; I++)
- OutStreamer.EmitRawText(MAI->getExternDirective() + Twine(*I));
-
- OutStreamer.AddComment("External decls for libcalls - END");
- OutStreamer.AddBlankLine();
-}
-
-/// doInitialization - Perform Module level initializations here.
-/// One task that we do here is to sectionize all global variables.
-/// The MemSelOptimizer pass depends on the sectionizing.
-///
-bool PIC16AsmPrinter::doInitialization(Module &M) {
- bool Result = AsmPrinter::doInitialization(M);
-
- // Every asmbly contains these std headers.
- OutStreamer.EmitRawText(StringRef("\n#include p16f1xxx.inc"));
- OutStreamer.EmitRawText(StringRef("#include stdmacros.inc"));
-
- // Set the section names for all globals.