OK, I guess I need further help. Out of these member functions:
DECLARE_TRANSPARENT_OPERAND_ACCESSORS<http://llvm.org/docs/doxygen/html/classllvm_1_1ConstantExpr.html#a3eb8942550fe94054aa53bb34ccd84a6>
(Constant <http://llvm.org/docs/doxygen/html/classllvm_1_1Constant.html>)
Transparently
provide more efficient getOperand methods.
<http://llvm.org/docs/doxygen/html/classllvm_1_1ConstantExpr.html#a3eb8942550fe94054aa53bb34ccd84a6>
bool<http://llvm.org/docs/doxygen/html/X86DisassemblerDecoder_8c.html#a6156fe0b594c9754f386f6c6a30c8165>
isCast<http://llvm.org/docs/doxygen/html/classllvm_1_1ConstantExpr.html#af5a739152c6b1f987b9d55a3c56e9aa8>
()
const Return true if this is a convert constant expression.
<http://llvm.org/docs/doxygen/html/classllvm_1_1ConstantExpr.html#af5a739152c6b1f987b9d55a3c56e9aa8>
bool<http://llvm.org/docs/doxygen/html/X86DisassemblerDecoder_8c.html#a6156fe0b594c9754f386f6c6a30c8165>
isCompare<http://llvm.org/docs/doxygen/html/classllvm_1_1ConstantExpr.html#a2afac88bd5194098a2fc77d6876e43fa>
()
const Return true if this is a compare constant expression.
<http://llvm.org/docs/doxygen/html/classllvm_1_1ConstantExpr.html#a2afac88bd5194098a2fc77d6876e43fa>
bool<http://llvm.org/docs/doxygen/html/X86DisassemblerDecoder_8c.html#a6156fe0b594c9754f386f6c6a30c8165>
hasIndices<http://llvm.org/docs/doxygen/html/classllvm_1_1ConstantExpr.html#a80509d4b1d9ffdc23d681ce3047a5916>
()
const Return true if this is an insertvalue or extractvalue expression, and
the
getIndices()<http://llvm.org/docs/doxygen/html/classllvm_1_1ConstantExpr.html#a82392cd97c83c4e01c0e957bb4bc68f6>
method
may be used.
<http://llvm.org/docs/doxygen/html/classllvm_1_1ConstantExpr.html#a80509d4b1d9ffdc23d681ce3047a5916>
bool<http://llvm.org/docs/doxygen/html/X86DisassemblerDecoder_8c.html#a6156fe0b594c9754f386f6c6a30c8165>
isGEPWithNoNotionalOverIndexing<http://llvm.org/docs/doxygen/html/classllvm_1_1ConstantExpr.html#ae739c577bd624ff893c050032e754212>
()
const Return true if this is a getelementptr expression and all the index
operands are compile-time known integers within the corresponding notional
static array extents. Note that this is not equivalant to, a subset of, or
a superset of the "inbounds" property.
<http://llvm.org/docs/doxygen/html/classllvm_1_1ConstantExpr.html#ae739c577bd624ff893c050032e754212>
unsigned <http://llvm.org/docs/doxygen/html/classunsigned.html>
getOpcode<http://llvm.org/docs/doxygen/html/classllvm_1_1ConstantExpr.html#a9c029996bf40f01fdebc1dfdf1cec4df>
()
const getOpcode - Return the opcode at the root of this constant
expression
<http://llvm.org/docs/doxygen/html/classllvm_1_1ConstantExpr.html#a9c029996bf40f01fdebc1dfdf1cec4df>
unsigned <http://llvm.org/docs/doxygen/html/classunsigned.html>
getPredicate<http://llvm.org/docs/doxygen/html/classllvm_1_1ConstantExpr.html#a2f8bff85624d13b40c325378321fa26e>
()
constArrayRef
<http://llvm.org/docs/doxygen/html/classllvm_1_1ArrayRef.html>
<unsigned <http://llvm.org/docs/doxygen/html/classunsigned.html> >
getIndices<http://llvm.org/docs/doxygen/html/classllvm_1_1ConstantExpr.html#a82392cd97c83c4e01c0e957bb4bc68f6>
()
constconst char *
getOpcodeName<http://llvm.org/docs/doxygen/html/classllvm_1_1ConstantExpr.html#ae4c4a080480dc15dadb10816a70c3bc6>
()
const getOpcodeName - Return a string representation for an opcode.
<http://llvm.org/docs/doxygen/html/classllvm_1_1ConstantExpr.html#ae4c4a080480dc15dadb10816a70c3bc6>
Constant <http://llvm.org/docs/doxygen/html/classllvm_1_1Constant.html> *
getWithOperandReplaced<http://llvm.org/docs/doxygen/html/classllvm_1_1ConstantExpr.html#a5251d509effaab5b68e085237ec6509d>
(unsigned <http://llvm.org/docs/doxygen/html/classunsigned.html> OpNo,
Constant <http://llvm.org/docs/doxygen/html/classllvm_1_1Constant.html>
*Op)
constConstant
<http://llvm.org/docs/doxygen/html/classllvm_1_1Constant.html>
*
getWithOperands<http://llvm.org/docs/doxygen/html/classllvm_1_1ConstantExpr.html#af57d494664944515629602e1ad51c1ef>
(ArrayRef
<http://llvm.org/docs/doxygen/html/classllvm_1_1ArrayRef.html><
Constant <http://llvm.org/docs/doxygen/html/classllvm_1_1Constant.html> *
>
Ops)
constConstant<http://llvm.org/docs/doxygen/html/classllvm_1_1Constant.html>
*
getWithOperands<http://llvm.org/docs/doxygen/html/classllvm_1_1ConstantExpr.html#a36814884bb1ee28d3486335b4fe90895>
(ArrayRef
<http://llvm.org/docs/doxygen/html/classllvm_1_1ArrayRef.html><
Constant <http://llvm.org/docs/doxygen/html/classllvm_1_1Constant.html> *
>
Ops, Type <http://llvm.org/docs/doxygen/html/classllvm_1_1Type.html> *Ty)
constvirtual void
destroyConstant<http://llvm.org/docs/doxygen/html/classllvm_1_1ConstantExpr.html#a7a842f2fd06ccaf677f87fc71f13241b>
()virtual void
replaceUsesOfWithOnConstant<http://llvm.org/docs/doxygen/html/classllvm_1_1ConstantExpr.html#af362257c30b27781ef22c34577e05643>
(Value <http://llvm.org/docs/doxygen/html/classllvm_1_1Value.html> *From,
Value <http://llvm.org/docs/doxygen/html/classllvm_1_1Value.html> *To,
Use<http://llvm.org/docs/doxygen/html/classllvm_1_1Use.html>
*U)
Only
isGEPWithNoNotionalOverIndexing<http://llvm.org/docs/doxygen/html/classllvm_1_1ConstantExpr.html#ae739c577bd624ff893c050032e754212>
() returns true. But how are you supposed to use others to get the
constant value?
On Thu, Jan 26, 2012 at 9:27 PM, Welson Sun <welson.sun at gmail.com>
wrote:
> Thanks Duncan,
>
> Yes, it is a ConstantExpr! Thank you!
>
> Now trying to find a clue in ConstantExpr's functions to get that
string
> :-)
>
> Regards,
> Welson
>
>
> On Thu, Jan 26, 2012 at 9:04 PM, Duncan Sands <baldrick at free.fr>
wrote:
>
>> Hi Welson Sun,
>>
>> > Hi, if I have some LLVM code like this:
>> >
>> > @.str = private unnamed_addr constant [7 x i8]
c"in_arr\00", align 1
>> > @.str1 = private unnamed_addr constant [8 x i8]
c"in_arr2\00", align 1
>> > @.str2 = private unnamed_addr constant [8 x i8]
c"out_arr\00", align 1
>> > ...
>> > ...
>> >
>> > call void (...)* @_Z16fooz(i8* *getelementptr inbounds ([7 x
i8]*
>> @.str, i64
>> > 0, i64 0)*, i32 0, i32 1024)
>> > ...
>> >
>> > I would like to get the string value of the bold argument, but
how? I
>> know it's
>> > a llvm::Value pointer, but it is not a llvm::GetElementPtrInst?
>>
>> it is a ConstantExpr getelementptr. Whenever you see something that
>> looks like
>> an instruction but is printed inline inside another instruction then
that
>> means
>> it is actually a constant, a ConstantExpr.
>>
>> Ciao, Duncan.
>>
>> >
>> >
>> > Thanks,
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> > _______________________________________________
>> > LLVM Developers mailing list
>> > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu
>> > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>>
>> _______________________________________________
>> LLVM Developers mailing list
>> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>>
>
>
>
> --
> Welson
>
> Phone: (408) 418-8385
> Email: welson.sun at gmail.com
>
>
>
--
Welson
Phone: (408) 418-8385
Email: welson.sun at gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://lists.llvm.org/pipermail/llvm-dev/attachments/20120126/dbc0e324/attachment.html>