mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-21 16:31:16 +00:00
0e68771536
A brief description about PIC16: =============================== PIC16 is an 8-bit microcontroller with only one 8-bit register which is the accumulator. All arithmetic/load/store operations are 8-bit only. The architecture has two address spaces: program and data. The program memory is divided into 2K pages and the data memory is divided into banks of 128 byte, with only 80 usable bytes, resulting in an non-contiguous data memory. It supports direct data memory access (by specifying the address as part of the instruction) and indirect data and program memory access (in an unorthodox fashion which utilize a 16 bit pointer register). Two classes of registers exist: (8-bit class which is only one accumulator) (16-bit class, which contains one or more 16 bit pointer(s)) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51027 91177308-0d34-0410-b5e6-96231b3b80d8
76 lines
2.8 KiB
C++
76 lines
2.8 KiB
C++
//===- PIC16ConstantPoolValue.h - PIC16 constantpool value ------*- C++ -*-===//
|
|
//
|
|
// The LLVM Compiler Infrastructure
|
|
//
|
|
// This file is distributed under the University of Illinois Open Source
|
|
// License. See LICENSE.TXT for details.
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
//
|
|
// This file implements the PIC16 specific constantpool value class.
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#ifndef LLVM_TARGET_PIC16_CONSTANTPOOLVALUE_H
|
|
#define LLVM_TARGET_PIC16_CONSTANTPOOLVALUE_H
|
|
|
|
#include "llvm/CodeGen/MachineConstantPool.h"
|
|
|
|
namespace llvm {
|
|
|
|
namespace PIC16CP {
|
|
enum PIC16CPKind {
|
|
CPValue,
|
|
CPNonLazyPtr,
|
|
CPStub
|
|
};
|
|
}
|
|
|
|
/// PIC16ConstantPoolValue - PIC16 specific constantpool value. This is used to
|
|
/// represent PC relative displacement between the address of the load
|
|
/// instruction and the global value being loaded, i.e. (&GV-(LPIC+8)).
|
|
class PIC16ConstantPoolValue : public MachineConstantPoolValue {
|
|
GlobalValue *GV; // GlobalValue being loaded.
|
|
const char *S; // ExtSymbol being loaded.
|
|
unsigned LabelId; // Label id of the load.
|
|
PIC16CP::PIC16CPKind Kind; // non_lazy_ptr or stub?
|
|
unsigned char PCAdjust; // Extra adjustment if constantpool is pc relative.
|
|
// 8 for PIC16
|
|
const char *Modifier; // GV modifier i.e. (&GV(modifier)-(LPIC+8))
|
|
bool AddCurrentAddress;
|
|
|
|
public:
|
|
PIC16ConstantPoolValue(GlobalValue *gv, unsigned id,
|
|
PIC16CP::PIC16CPKind Kind = PIC16CP::CPValue,
|
|
unsigned char PCAdj = 0, const char *Modifier = NULL,
|
|
bool AddCurrentAddress = false);
|
|
PIC16ConstantPoolValue(const char *s, unsigned id,
|
|
PIC16CP::PIC16CPKind Kind = PIC16CP::CPValue,
|
|
unsigned char PCAdj = 0, const char *Modifier = NULL,
|
|
bool AddCurrentAddress = false);
|
|
PIC16ConstantPoolValue(GlobalValue *GV, PIC16CP::PIC16CPKind Kind,
|
|
const char *Modifier);
|
|
|
|
|
|
GlobalValue *getGV() const { return GV; }
|
|
const char *getSymbol() const { return S; }
|
|
const char *getModifier() const { return Modifier; }
|
|
bool hasModifier() const { return Modifier != NULL; }
|
|
bool mustAddCurrentAddress() const { return AddCurrentAddress; }
|
|
unsigned getLabelId() const { return LabelId; }
|
|
bool isNonLazyPointer() const { return Kind == PIC16CP::CPNonLazyPtr; }
|
|
bool isStub() const { return Kind == PIC16CP::CPStub; }
|
|
unsigned char getPCAdjustment() const { return PCAdjust; }
|
|
|
|
virtual int getExistingMachineCPValue(MachineConstantPool *CP,
|
|
unsigned Alignment);
|
|
|
|
virtual void AddSelectionDAGCSEId(FoldingSetNodeID &ID);
|
|
|
|
virtual void print(std::ostream &O) const;
|
|
};
|
|
|
|
}
|
|
|
|
#endif
|