mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-18 11:24:01 +00:00
Enable rematerialization of constants using AliasAnalysis::pointsToConstantMemory,
and knowledge of PseudoSourceValues. This unfortunately isn't sufficient to allow constants to be rematerialized in PIC mode -- the extra indirection is a complication. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54000 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -11,6 +11,7 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "llvm/CodeGen/MachineFrameInfo.h"
|
||||
#include "llvm/CodeGen/PseudoSourceValue.h"
|
||||
#include "llvm/DerivedTypes.h"
|
||||
#include "llvm/Support/Compiler.h"
|
||||
@ -51,6 +52,9 @@ namespace llvm {
|
||||
const int FI;
|
||||
public:
|
||||
explicit FixedStackPseudoSourceValue(int fi) : FI(fi) {}
|
||||
|
||||
virtual bool isConstant(const MachineFrameInfo *MFI) const;
|
||||
|
||||
virtual void print(std::ostream &OS) const {
|
||||
OS << "FixedStack" << FI;
|
||||
}
|
||||
@ -64,4 +68,20 @@ namespace llvm {
|
||||
V = new FixedStackPseudoSourceValue(FI);
|
||||
return V;
|
||||
}
|
||||
|
||||
bool PseudoSourceValue::isConstant(const MachineFrameInfo *) const {
|
||||
if (this == getStack())
|
||||
return false;
|
||||
if (this == getGOT() ||
|
||||
this == getConstantPool() ||
|
||||
this == getJumpTable())
|
||||
return true;
|
||||
assert(0 && "Unknown PseudoSourceValue!");
|
||||
return false;
|
||||
}
|
||||
|
||||
bool
|
||||
FixedStackPseudoSourceValue::isConstant(const MachineFrameInfo *MFI) const {
|
||||
return MFI && MFI->isImmutableObjectIndex(FI);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user