interp: fix GEP with const value in a local variable
Этот коммит содержится в:
родитель
2cd9846cc9
коммит
bf9d62fe98
1 изменённых файлов: 7 добавлений и 6 удалений
|
@ -114,14 +114,15 @@ func (fr *frame) evalBasicBlock(bb, incoming llvm.BasicBlock, indent string) (re
|
||||||
llvmIndices[i] = inst.Operand(i + 1)
|
llvmIndices[i] = inst.Operand(i + 1)
|
||||||
}
|
}
|
||||||
indices := make([]uint32, len(llvmIndices))
|
indices := make([]uint32, len(llvmIndices))
|
||||||
for i, operand := range llvmIndices {
|
for i, llvmIndex := range llvmIndices {
|
||||||
|
operand := fr.getLocal(llvmIndex)
|
||||||
if !operand.IsConstant() {
|
if !operand.IsConstant() {
|
||||||
// not a constant operation, emit a low-level GEP
|
// Not a constant operation.
|
||||||
gep := fr.builder.CreateGEP(value.Value(), llvmIndices, inst.Name())
|
// This should be detected by the scanner, but isn't at the
|
||||||
fr.locals[inst] = &LocalValue{fr.Eval, gep}
|
// moment.
|
||||||
continue
|
panic("todo: non-const gep")
|
||||||
}
|
}
|
||||||
indices[i] = uint32(operand.ZExtValue())
|
indices[i] = uint32(operand.Value().ZExtValue())
|
||||||
}
|
}
|
||||||
result := value.GetElementPtr(indices)
|
result := value.GetElementPtr(indices)
|
||||||
if result.Type() != inst.Type() {
|
if result.Type() != inst.Type() {
|
||||||
|
|
Загрузка…
Создание таблицы
Сослаться в новой задаче