[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
Jim Laskey
jlaskey at apple.com
Wed Mar 8 10:11:22 PST 2006
Changes in directory llvm/lib/CodeGen/SelectionDAG:
SelectionDAGISel.cpp updated: 1.182 -> 1.183
---
Log message:
Get rid of the multiple copies of getStringValue. Now a Constant:: method.
---
Diffs of the changes: (+1 -19)
SelectionDAGISel.cpp | 20 +-------------------
1 files changed, 1 insertion(+), 19 deletions(-)
Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.182 llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.183
--- llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.182 Tue Mar 7 22:25:44 2006
+++ llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Wed Mar 8 12:11:06 2006
@@ -873,24 +873,6 @@
CurMBB->getParent()->getFrameInfo()->CreateVariableSizedObject();
}
-/// getStringValue - Turn an LLVM constant pointer that eventually points to a
-/// global into a string value. Return an empty string if we can't do it.
-///
-static std::string getStringValue(GlobalVariable *GV, unsigned Offset = 0) {
- if (GV->hasInitializer() && isa<ConstantArray>(GV->getInitializer())) {
- ConstantArray *Init = cast<ConstantArray>(GV->getInitializer());
- if (Init->isString()) {
- std::string Result = Init->getAsString();
- if (Offset < Result.size()) {
- // If we are pointing INTO The string, erase the beginning...
- Result.erase(Result.begin(), Result.begin()+Offset);
- return Result;
- }
- }
- }
- return "";
-}
-
void SelectionDAGLowering::visitLoad(LoadInst &I) {
SDOperand Ptr = getValue(I.getOperand(0));
@@ -1962,7 +1944,7 @@
if (G) {
GlobalVariable *GV = dyn_cast<GlobalVariable>(G->getGlobal());
if (GV) {
- Str = getStringValue(GV);
+ Str = GV->getStringValue();
if (!Str.empty()) {
CopyFromStr = true;
SrcOff += SrcDelta;
More information about the llvm-commits
mailing list