Displaying 20 results from an estimated 200 matches similar to: "[LLVMdev] size of const_ptr for array index"
2015 Mar 07
2
[LLVMdev] cannot understand global c++API code
Hi all,
translating the following c code to llvm c++Api code, I can not understand
the result.
Perhaps someone could explain it to me.
c code
---------------------------------
struct stest {
int age;
float weight;
} foo={44,67.2};
int main() {
foo.weight=68.2;
...
----------------------------------------
API code
// this is clear
ConstantFP* const_float_102 =
2015 Mar 18
5
[LLVMdev] casting Constant * to value *?
John, you are right.
I 'browsed' the doxygen's inheritance diagram.
Shouldn't I then be able to cast Constant * to Value*?
Plugging the retrieved Constant* (from ConstantExpr::getGetElementPtr)
into Instruction->setOperand compiles, but gives me an assertion failure at
runtime.
I have no access to the code at the moment. I will gather more information
possibly tomorrow.
2015 Mar 17
2
[LLVMdev] casting Constant * to value *?
Hi all,
extracting datafields of globals, the API code ends up in a Constant *
Constant* const_ptr_103 = ConstantExpr::getGetElementPtr(gvar_struct_foo,
const_ptr_103_indices);
it can be used to initialize e.g. a new instruction like:
StoreInst* void_119 = new StoreInst(const_float_102, const_ptr_103, false,
label_entry_113);
But how about replacing the operand of an already existing
2015 Mar 10
3
[LLVMdev] Chatty C++API code generation
Hi all,
when I have c code like
--- c code -------------
struct stest { /* deklariert den Strukturtyp person */
int age;
float weight;
} foo={44,67.2}; /* deklariert Variable des Typs person */
int main() {
callAFunction(foo.weight);
------------------------
The generated c++API code to me seems to be too chatty in the sense that
the foo.weight's data
2015 May 18
2
[LLVMdev] copy value of a global's data field to another global
getInitializer returns the complete initializer of the global.
My globals are complex nested structs, from which I want to extract e.g. one
double datafield.
Example:
>From a struct Stuct having double,array(3xint),float fields, I could extract
the second int value using the index sequence 0,1,1 with getGetElementPtr.
This gives me a constantPointer, but I would need to get a constInt...
2015 Jan 22
3
[LLVMdev] numeric limits of llvm Types?
Hi all,
can I access the numeric limits of the llvm types,
e.g. HalfTy, FloatTy, DoubleTy, etc.
in a fashion like the std numeric_limits tool?
std::numeric_limits<half>::min()
std::numeric_limits<half>::max()
In c++API, I want to initialize values and need to know the correct range
for the llvm types....
Thx
Alex
2015 Mar 28
2
[LLVMdev] LLVMContextImpl.h not installed?
Hi all,
I 'd like to fetch a list of structures, and found that it could be done
via
LLVMContextImpl *pImpl = Context.pImpl;
pImpl->AnonStructTypes
This however needs the inclusion of LLVMContextImpl.h, which is not
contained in the includes dir, but in the lib/IR dir (next to the .cpp
files) and is not installed under /usr/local/include...
Whats the reason for this? Isn't it
2015 Jan 22
2
[LLVMdev] access IntegerType::getSignBit from Type *
Hi,
I have a Type * which may come from an IntegerType as shown below:
Type.getIntegerBitWidth() tells me numBits.
But how to extract the IntegerType.getSignBit?
If pType isIntegerType, I need to know if it is signed or unsigned...
How to achieve this?
Thx
Alex
llvm::Type * getRandomValid_IntegerType(llvm::LLVMContext &C)
{
using namespace llvm;
//--- determine num of bits
2015 May 27
2
[LLVMdev] convert GetElemtPtr result to pointer on element?
Hi Tim,
I forgot to say that I try to do all this in the LLVM API, not IR.
I read in a bc'ed program and try to edit it using the API.
Alex
Tim Northover wrote:
>> But I can not succeed in using the getGetElementPtr result in
>> constructing an initalizer for another global value (which expects a
>> ConstantFP* and not a ConstantExpr*).
>
> The result of a
2015 Jan 14
2
[LLVMdev] list of available/valid values near an instruction
Hi Krzysztof
yes, they are available. What I want is to have a list of those values I can
iterate over....
Alex
> I'm not sure if I understand your question correctly, but all values
> whose definitions dominate the instruction that you are looking at are
> available. Globals and function arguments are always available in a
> given module or function.
>
> -Krzysztof
>
2015 May 17
2
[LLVMdev] copy value of a global's data field to another global
Hi all,
I can get access to the data stored in globals as follows:
GlobalVariable* pGvarAct=_set_a_valid_global_;
const_ptr_indicesVec=_the_indexes_
llvm::Constant* pConst;
pConst=ConstantExpr::getGetElementPtr(pGvarAct, const_ptr_indicesVec);
and e.g. use this to repalece an argumrnt of an instruction like:
I->setOperand(someArgumentIndex,pConst);
However, getGetElementPtr returns a
2015 May 31
1
[LLVMdev] how to get an independent copy of a function?
Hi,
I need to get a copy of a function which should be 'selfcontained'
(independent from the original function). Just like in C making a copy of a
functions source code, changing the name.
I tried to copy the basic blocks and their instructions (clone) to a new
function, but the module check gives 'referring to an argument in another
function'.
This seems obvious, because
2015 Jan 14
2
[LLVMdev] list of available/valid values near an instruction
I wonder if there is a list of available/valid values (globals, constants
arguments,..) in the scope of a given instruction?
Background:
Iterating over the instructions of a module, i would like to know which
values are accessible in the context of the instruction, possibly replacing
the instructions operand by a valid available other operand.
Thx
Alex
2015 Jan 12
2
[LLVMdev] debugging opt passed using gdb: could not open input file
Hi all,
I would like to be able to debug opt passes.
- I compiled llvm in debug mode
- gdb /usr/local/bin/opt
- run opt -load /path/to/LLVMHello.so -hello <any.bc> /dev/null
and then get /usr/local/bin/opt: opt: err: Could not open input file ....
could it be the <> syntax is not gdb command window conform?
I tried to find out if i could provide opt in and out files using standard
2015 Jan 15
2
[LLVMdev] AllocaInst for FunctionType?
Hi,
I'm trying to get my head around c++ - IR - c++ API and getting used
tramform manual information to code.
The manual states alloca is defined for <type>. FunstionType is a type, so
alloca for functionType should be possible? Not?
If we have a valid Module *m
we can get an allocate instruction allocating space for a non-argumented
function as follows:
AllocaInst* pa2 = new
2010 May 27
5
[LLVMdev] Using LLVM to compile Objective-C on an Xbox 360
Implementing the backend (or editing the current PPC backend as needed) is a definite option. This seems to be the real question... which is easier... maintaining the PPC backend or maintaining the rewriter. Currently (in admittedly trivial tests) I have gotten the rewriter to work and output C code. There are some outstanding issues to do with linking and accessing the reflection information
2010 May 27
4
[LLVMdev] Using LLVM to compile Objective-C on an Xbox 360
By linux derivative I meant that it borrows the linux GCC ABI... and it does. You can compile with an off the shelf GCC cross compiler and link the resultant object files ones compiled with the PS3 provided version. We have done it.
Also, as both an XBox 360 and PS3 developer, there seems to me to be nothing in the TCRs/TRCs that preclude us from using a different compiler. There are rules
2015 Feb 27
1
[LLVMdev] Replacing an initializer
Hi all,
suppose I would like to change the initial value of a global.
Is the supposed way to change the initializer via
const_global_iterator I
I->setInitializer(newOne) ?
afaik, newOne is a constant - right?
Is the original Initializer automatically purged or do I need to delete it?
thanks
Alex
2010 May 27
0
[LLVMdev] Using LLVM to compile Objective-C on an Xbox 360
Le 27 mai 2010 à 09:15, Kevin Wooten a écrit :
> Implementing the backend (or editing the current PPC backend as needed) is a definite option. This seems to be the real question... which is easier... maintaining the PPC backend or maintaining the rewriter. Currently (in admittedly trivial tests) I have gotten the rewriter to work and output C code. There are some outstanding issues to do
2010 May 27
0
[LLVMdev] Using LLVM to compile Objective-C on an Xbox 360
PS3 is not "a Linux derivative." The compilers supplied by SCE for PS3
game development are highly customized and support a customized ABI
that will take some time to adjust LLVM and Clang to support.
You'd likely also run afoul of a TRC or two, similar to the problems
you'll face with Microsoft TCRs mentioned earlier.
Alex
On May 27, 2010, at 12:15 AM, Kevin Wooten