mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-09-01 04:29:57 +00:00
use raw_ostream instead of std::ostream. Among other goodness, this speeds up llvm-dis of kc++ with a release build from 0.85s to 0.49s (88% faster). Other interesting changes: 1) This makes Value::print be non-virtual. 2) AP[S]Int and ConstantRange can no longer print to ostream directly, use raw_ostream instead. 3) This fixes a bug in raw_os_ostream where it didn't flush itself when destroyed. 4) This adds a new SDNode::print method, instead of only allowing "dump". A lot of APIs have both std::ostream and raw_ostream versions, it would be useful to go through and systematically anihilate the std::ostream versions. This passes dejagnu, but there may be minor fallout, plz let me know if so and I'll fix it. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55263 91177308-0d34-0410-b5e6-96231b3b80d8
78 lines
2.8 KiB
C++
78 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 {
|
|
|
|
class GlobalValue;
|
|
|
|
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(raw_ostream &O) const;
|
|
};
|
|
|
|
}
|
|
|
|
#endif
|