[LLVMdev] How could I hide the visible string?
Zhang Qiuyu
qiuyu at ucla.edu
Mon Sep 27 18:17:14 PDT 2004
Hi,
Is there a way to modify the string such as char a or char b? Could I use the way like "Replace an instruction with another Value" in Programm Manual? In fact, what I am interested in is string with visible expression, not all string, and I am trying to hide the orignal string by using simple way like XOR..
Is there a way to reorder the basic blocks?
Thanks.
Qiuyu
C Source code:
#include <stdio.h>
#include <stdlib.h>
char a[20]="global string test\n";
int main( int argc , char *argv[]){
char b[20]= "Internal string test";
printf("Global %s \n",a);
printf("Internal %s\n",b);
}
IR code :
target endian = little
target pointersize = 32
%struct..TorRec = type { int, void ()* }
%struct.TorRec = type { int, void ()* }
%a = internal global [20 x sbyte] c"global string test\0A\00" ; <[20 x sbyte]*> [#uses=1]
%.ctor_1 = internal global [20 x sbyte] c"Internal string test" ; <[20 x sbyte]*> [#uses=1]
%.str_1 = internal constant [12 x sbyte] c"Global %s \0A\00" ; <[12 x sbyte]*> [#uses=1]
%.str_2 = internal constant [13 x sbyte] c"Internal %s\0A\00" ; <[13 x sbyte]*> [#uses=1]
%Initialized.0__ = internal global bool false ; <bool*> [#uses=2]
implementation ; Functions:
declare int %printf(sbyte*, ...)
int %main(int %argc, sbyte** %argv) {
entry:
%b = alloca [20 x sbyte] ; <[20 x sbyte]*> [#uses=1]
%tmp.1.i = load bool* %Initialized.0__ ; <bool> [#uses=1]
br bool %tmp.1.i, label %__main.entry, label %endif.0.i
endif.0.i: ; preds = %entry
store bool true, bool* %Initialized.0__
br label %__main.entry
__main.entry: ; preds = %entry, %endif.0.i
%tmp.0 = getelementptr [20 x sbyte]* %b, uint 0, uint 0 ; <sbyte*> [#uses=2]
call void %llvm.memcpy( sbyte* %tmp.0, sbyte* getelementptr ([20 x sbyte]* %.ctor_1, long 0, long 0), uint 20, uint 1 )
%tmp.3 = call int (sbyte*, ...)* %printf( sbyte* getelementptr ([12 x sbyte]* %.str_1, long 0, long 0), sbyte* getelementptr ([20 x sbyte]* %a, long 0, long 0) ) ; <int> [#uses=0]
%tmp.6 = call int (sbyte*, ...)* %printf( sbyte* getelementptr ([13 x sbyte]* %.str_2, long 0, long 0), sbyte* %tmp.0 ) ; <int> [#uses=0]
ret int 0
}
declare void %llvm.memcpy(sbyte*, sbyte*, uint, uint)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20040927/ce790fef/attachment.html>
More information about the llvm-dev
mailing list