Added support for machine specific constantpool values. These are useful for

representing expressions that can only be resolved at link time, etc.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30278 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Evan Cheng
2006-09-12 21:00:35 +00:00
parent cd5731d98b
commit d6594ae54c
11 changed files with 275 additions and 61 deletions
@@ -15,6 +15,7 @@
#include "llvm/Function.h"
#include "llvm/Assembly/Writer.h"
#include "llvm/CodeGen/SelectionDAG.h"
#include "llvm/CodeGen/MachineConstantPool.h"
#include "llvm/CodeGen/MachineFunction.h"
#include "llvm/Target/MRegisterInfo.h"
#include "llvm/Target/TargetMachine.h"
@@ -80,14 +81,20 @@ std::string DOTGraphTraits<SelectionDAG*>::getNodeLabel(const SDNode *Node,
} else if (const FrameIndexSDNode *FIDN = dyn_cast<FrameIndexSDNode>(Node)) {
Op += " " + itostr(FIDN->getIndex());
} else if (const ConstantPoolSDNode *CP = dyn_cast<ConstantPoolSDNode>(Node)){
if (ConstantFP *CFP = dyn_cast<ConstantFP>(CP->get()))
Op += "<" + ftostr(CFP->getValue()) + ">";
else if (ConstantInt *CI = dyn_cast<ConstantInt>(CP->get()))
Op += "<" + utostr(CI->getZExtValue()) + ">";
else {
if (CP->isMachineConstantPoolEntry()) {
std::ostringstream SS;
WriteAsOperand(SS, CP->get(), false);
CP->getMachineCPVal()->print(SS);
Op += "<" + SS.str() + ">";
} else {
if (ConstantFP *CFP = dyn_cast<ConstantFP>(CP->getConstVal()))
Op += "<" + ftostr(CFP->getValue()) + ">";
else if (ConstantInt *CI = dyn_cast<ConstantInt>(CP->getConstVal()))
Op += "<" + utostr(CI->getZExtValue()) + ">";
else {
std::ostringstream SS;
WriteAsOperand(SS, CP->getConstVal(), false);
Op += "<" + SS.str() + ">";
}
}
} else if (const BasicBlockSDNode *BBDN = dyn_cast<BasicBlockSDNode>(Node)) {
Op = "BB: ";