如何从 getelementptr 入站指令获取@variabe_name

问题描述

我阅读了文档,但不确定如何获取此值。我能够阅读直接的 getelementptr 指令。 代码

 struct foo {
 unsigned char position;
};

extern struct foo f1;

void hello () {
  if (f1.position){
  }
}

红外代码

%struct.foo = type { i8 }

@f1 = external dso_local global %struct.foo,align 1
; Function Attrs: noinline nounwind optnone uwtable mustprogress
define dso_local void @_hello() #0 !dbg !9 {
  %1 = load i8,i8* getelementptr inbounds (%struct.foo,%struct.foo* @f1,i32 0,i32 0),align 1,!dbg !13
  %2 = icmp ne i8 %1,!dbg !15
  br i1 %2,label %3,label %4,!dbg !16

3:                                               
  br label %4,!dbg !17

4:                                          
  ret void,!dbg !19
}

我想从 getelementptr 入站指令中获取 f1。

非常感谢。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)